mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
bhyve: add virBhyveDriverCreateXMLConf
Add virBhyveDriverCreateXMLConf, a simple wrapper around virDomainXMLOptionNew that makes it easier to pass bhyveConnPtr as a private data for parser. It will be used later for device address allocation at parsing time. Update consumers to use it instead of direct calls to virDomainXMLOptionNew. As we now have proper callbacks connected for the tests, update test files accordingly to include the automatically generated PCI root controller.
This commit is contained in:
parent
20a7737d35
commit
13a050b2c3
@ -83,6 +83,15 @@ bhyveDomainDeviceDefPostParse(virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
|
||||
return 0;
|
||||
}
|
||||
|
||||
virDomainXMLOptionPtr
|
||||
virBhyveDriverCreateXMLConf(bhyveConnPtr driver)
|
||||
{
|
||||
virBhyveDriverDomainDefParserConfig.priv = driver;
|
||||
return virDomainXMLOptionNew(&virBhyveDriverDomainDefParserConfig,
|
||||
&virBhyveDriverPrivateDataCallbacks,
|
||||
NULL);
|
||||
}
|
||||
|
||||
virDomainDefParserConfig virBhyveDriverDomainDefParserConfig = {
|
||||
.devicesPostParseCallback = bhyveDomainDeviceDefPostParse,
|
||||
.domainPostParseCallback = bhyveDomainDefPostParse,
|
||||
|
@ -37,6 +37,8 @@ struct _bhyveDomainObjPrivate {
|
||||
bhyveMonitorPtr mon;
|
||||
};
|
||||
|
||||
virDomainXMLOptionPtr virBhyveDriverCreateXMLConf(bhyveConnPtr);
|
||||
|
||||
extern virDomainXMLPrivateDataCallbacks virBhyveDriverPrivateDataCallbacks;
|
||||
extern virDomainDefParserConfig virBhyveDriverDomainDefParserConfig;
|
||||
|
||||
|
@ -1246,9 +1246,7 @@ bhyveStateInitialize(bool privileged,
|
||||
if (virBhyveProbeGrubCaps(&bhyve_driver->grubcaps) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(bhyve_driver->xmlopt = virDomainXMLOptionNew(&virBhyveDriverDomainDefParserConfig,
|
||||
&virBhyveDriverPrivateDataCallbacks,
|
||||
NULL)))
|
||||
if (!(bhyve_driver->xmlopt = virBhyveDriverCreateXMLConf(bhyve_driver)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(bhyve_driver->domains = virDomainObjListNew()))
|
||||
|
@ -7,6 +7,7 @@
|
||||
# include "datatypes.h"
|
||||
|
||||
# include "bhyve/bhyve_capabilities.h"
|
||||
# include "bhyve/bhyve_domain.h"
|
||||
# include "bhyve/bhyve_utils.h"
|
||||
# include "bhyve/bhyve_command.h"
|
||||
|
||||
@ -131,7 +132,7 @@ mymain(void)
|
||||
if ((driver.caps = virBhyveCapsBuild()) == NULL)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
if ((driver.xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL)) == NULL)
|
||||
if ((driver.xmlopt = virBhyveDriverCreateXMLConf(&driver)) == NULL)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
# define DO_TEST_FULL(name, flags) \
|
||||
|
@ -23,6 +23,7 @@
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:81:c4:b1'/>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:b9:94:02'/>
|
||||
|
@ -26,6 +26,7 @@
|
||||
<readonly/>
|
||||
<address type='drive' controller='0' bus='0' target='4' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:8d:10:e1'/>
|
||||
|
@ -26,6 +26,7 @@
|
||||
<readonly/>
|
||||
<address type='drive' controller='0' bus='0' target='4' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:92:68:0e'/>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:1e:63:25'/>
|
||||
|
@ -26,6 +26,7 @@
|
||||
<boot order='1'/>
|
||||
<address type='drive' controller='0' bus='0' target='4' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:7a:f5:a4'/>
|
||||
|
@ -27,6 +27,7 @@
|
||||
<boot order='1'/>
|
||||
<address type='drive' controller='0' bus='0' target='4' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:fe:97:82'/>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:11:bd:26'/>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:b1:42:eb'/>
|
||||
|
@ -20,6 +20,7 @@
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:35:99:c2'/>
|
||||
|
@ -20,6 +20,7 @@
|
||||
<readonly/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:6f:6a:53'/>
|
||||
|
@ -20,6 +20,7 @@
|
||||
<readonly/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:e3:ec:9b'/>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<target dev='vda' bus='virtio'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:bc:85:fe'/>
|
||||
<source bridge='virbr0'/>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<boot order='1'/>
|
||||
<address type='drive' controller='0' bus='0' target='6' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:f4:6c:be'/>
|
||||
|
@ -34,6 +34,7 @@
|
||||
<boot order='3'/>
|
||||
<address type='drive' controller='0' bus='0' target='6' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:0e:d2:6f'/>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:ee:f5:79'/>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:82:ca:a3'/>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:22:ee:11'/>
|
||||
|
@ -23,6 +23,7 @@
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:ad:55:51'/>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:a7:cd:5b'/>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:f0:72:11'/>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='52:54:00:4f:f3:5b'/>
|
||||
|
@ -5,6 +5,7 @@
|
||||
#ifdef WITH_BHYVE
|
||||
|
||||
# include "bhyve/bhyve_capabilities.h"
|
||||
# include "bhyve/bhyve_domain.h"
|
||||
# include "bhyve/bhyve_utils.h"
|
||||
|
||||
# define VIR_FROM_THIS VIR_FROM_NONE
|
||||
@ -49,7 +50,7 @@ mymain(void)
|
||||
if ((driver.caps = virBhyveCapsBuild()) == NULL)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
if ((driver.xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL)) == NULL)
|
||||
if ((driver.xmlopt = virBhyveDriverCreateXMLConf(&driver)) == NULL)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
# define DO_TEST_FULL(name, is_different) \
|
||||
|
Loading…
Reference in New Issue
Block a user