mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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:
@@ -83,6 +83,15 @@ bhyveDomainDeviceDefPostParse(virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virDomainXMLOptionPtr
|
||||||
|
virBhyveDriverCreateXMLConf(bhyveConnPtr driver)
|
||||||
|
{
|
||||||
|
virBhyveDriverDomainDefParserConfig.priv = driver;
|
||||||
|
return virDomainXMLOptionNew(&virBhyveDriverDomainDefParserConfig,
|
||||||
|
&virBhyveDriverPrivateDataCallbacks,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
virDomainDefParserConfig virBhyveDriverDomainDefParserConfig = {
|
virDomainDefParserConfig virBhyveDriverDomainDefParserConfig = {
|
||||||
.devicesPostParseCallback = bhyveDomainDeviceDefPostParse,
|
.devicesPostParseCallback = bhyveDomainDeviceDefPostParse,
|
||||||
.domainPostParseCallback = bhyveDomainDefPostParse,
|
.domainPostParseCallback = bhyveDomainDefPostParse,
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ struct _bhyveDomainObjPrivate {
|
|||||||
bhyveMonitorPtr mon;
|
bhyveMonitorPtr mon;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virDomainXMLOptionPtr virBhyveDriverCreateXMLConf(bhyveConnPtr);
|
||||||
|
|
||||||
extern virDomainXMLPrivateDataCallbacks virBhyveDriverPrivateDataCallbacks;
|
extern virDomainXMLPrivateDataCallbacks virBhyveDriverPrivateDataCallbacks;
|
||||||
extern virDomainDefParserConfig virBhyveDriverDomainDefParserConfig;
|
extern virDomainDefParserConfig virBhyveDriverDomainDefParserConfig;
|
||||||
|
|
||||||
|
|||||||
@@ -1246,9 +1246,7 @@ bhyveStateInitialize(bool privileged,
|
|||||||
if (virBhyveProbeGrubCaps(&bhyve_driver->grubcaps) < 0)
|
if (virBhyveProbeGrubCaps(&bhyve_driver->grubcaps) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(bhyve_driver->xmlopt = virDomainXMLOptionNew(&virBhyveDriverDomainDefParserConfig,
|
if (!(bhyve_driver->xmlopt = virBhyveDriverCreateXMLConf(bhyve_driver)))
|
||||||
&virBhyveDriverPrivateDataCallbacks,
|
|
||||||
NULL)))
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(bhyve_driver->domains = virDomainObjListNew()))
|
if (!(bhyve_driver->domains = virDomainObjListNew()))
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
# include "datatypes.h"
|
# include "datatypes.h"
|
||||||
|
|
||||||
# include "bhyve/bhyve_capabilities.h"
|
# include "bhyve/bhyve_capabilities.h"
|
||||||
|
# include "bhyve/bhyve_domain.h"
|
||||||
# include "bhyve/bhyve_utils.h"
|
# include "bhyve/bhyve_utils.h"
|
||||||
# include "bhyve/bhyve_command.h"
|
# include "bhyve/bhyve_command.h"
|
||||||
|
|
||||||
@@ -131,7 +132,7 @@ mymain(void)
|
|||||||
if ((driver.caps = virBhyveCapsBuild()) == NULL)
|
if ((driver.caps = virBhyveCapsBuild()) == NULL)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
if ((driver.xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL)) == NULL)
|
if ((driver.xmlopt = virBhyveDriverCreateXMLConf(&driver)) == NULL)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
# define DO_TEST_FULL(name, flags) \
|
# define DO_TEST_FULL(name, flags) \
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
<target dev='hda' bus='sata'/>
|
<target dev='hda' bus='sata'/>
|
||||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:81:c4:b1'/>
|
<mac address='52:54:00:81:c4:b1'/>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<target dev='hda' bus='sata'/>
|
<target dev='hda' bus='sata'/>
|
||||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:b9:94:02'/>
|
<mac address='52:54:00:b9:94:02'/>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
<readonly/>
|
<readonly/>
|
||||||
<address type='drive' controller='0' bus='0' target='4' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='4' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:8d:10:e1'/>
|
<mac address='52:54:00:8d:10:e1'/>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
<readonly/>
|
<readonly/>
|
||||||
<address type='drive' controller='0' bus='0' target='4' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='4' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:92:68:0e'/>
|
<mac address='52:54:00:92:68:0e'/>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<target dev='hda' bus='sata'/>
|
<target dev='hda' bus='sata'/>
|
||||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:1e:63:25'/>
|
<mac address='52:54:00:1e:63:25'/>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
<boot order='1'/>
|
<boot order='1'/>
|
||||||
<address type='drive' controller='0' bus='0' target='4' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='4' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:7a:f5:a4'/>
|
<mac address='52:54:00:7a:f5:a4'/>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
<boot order='1'/>
|
<boot order='1'/>
|
||||||
<address type='drive' controller='0' bus='0' target='4' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='4' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:fe:97:82'/>
|
<mac address='52:54:00:fe:97:82'/>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<target dev='hda' bus='sata'/>
|
<target dev='hda' bus='sata'/>
|
||||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:11:bd:26'/>
|
<mac address='52:54:00:11:bd:26'/>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<target dev='hda' bus='sata'/>
|
<target dev='hda' bus='sata'/>
|
||||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:b1:42:eb'/>
|
<mac address='52:54:00:b1:42:eb'/>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
<target dev='hda' bus='sata'/>
|
<target dev='hda' bus='sata'/>
|
||||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:35:99:c2'/>
|
<mac address='52:54:00:35:99:c2'/>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
<readonly/>
|
<readonly/>
|
||||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:6f:6a:53'/>
|
<mac address='52:54:00:6f:6a:53'/>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
<readonly/>
|
<readonly/>
|
||||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:e3:ec:9b'/>
|
<mac address='52:54:00:e3:ec:9b'/>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<target dev='vda' bus='virtio'/>
|
<target dev='vda' bus='virtio'/>
|
||||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:bc:85:fe'/>
|
<mac address='52:54:00:bc:85:fe'/>
|
||||||
<source bridge='virbr0'/>
|
<source bridge='virbr0'/>
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
<boot order='1'/>
|
<boot order='1'/>
|
||||||
<address type='drive' controller='0' bus='0' target='6' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='6' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:f4:6c:be'/>
|
<mac address='52:54:00:f4:6c:be'/>
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
<boot order='3'/>
|
<boot order='3'/>
|
||||||
<address type='drive' controller='0' bus='0' target='6' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='6' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:0e:d2:6f'/>
|
<mac address='52:54:00:0e:d2:6f'/>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<target dev='hda' bus='sata'/>
|
<target dev='hda' bus='sata'/>
|
||||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:ee:f5:79'/>
|
<mac address='52:54:00:ee:f5:79'/>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<target dev='hda' bus='sata'/>
|
<target dev='hda' bus='sata'/>
|
||||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:82:ca:a3'/>
|
<mac address='52:54:00:82:ca:a3'/>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<target dev='hda' bus='sata'/>
|
<target dev='hda' bus='sata'/>
|
||||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:22:ee:11'/>
|
<mac address='52:54:00:22:ee:11'/>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
<target dev='hda' bus='sata'/>
|
<target dev='hda' bus='sata'/>
|
||||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:ad:55:51'/>
|
<mac address='52:54:00:ad:55:51'/>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<target dev='hda' bus='sata'/>
|
<target dev='hda' bus='sata'/>
|
||||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:a7:cd:5b'/>
|
<mac address='52:54:00:a7:cd:5b'/>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<target dev='hda' bus='sata'/>
|
<target dev='hda' bus='sata'/>
|
||||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:f0:72:11'/>
|
<mac address='52:54:00:f0:72:11'/>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<target dev='hda' bus='sata'/>
|
<target dev='hda' bus='sata'/>
|
||||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
<controller type='sata' index='0'/>
|
<controller type='sata' index='0'/>
|
||||||
<interface type='bridge'>
|
<interface type='bridge'>
|
||||||
<mac address='52:54:00:4f:f3:5b'/>
|
<mac address='52:54:00:4f:f3:5b'/>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#ifdef WITH_BHYVE
|
#ifdef WITH_BHYVE
|
||||||
|
|
||||||
# include "bhyve/bhyve_capabilities.h"
|
# include "bhyve/bhyve_capabilities.h"
|
||||||
|
# include "bhyve/bhyve_domain.h"
|
||||||
# include "bhyve/bhyve_utils.h"
|
# include "bhyve/bhyve_utils.h"
|
||||||
|
|
||||||
# define VIR_FROM_THIS VIR_FROM_NONE
|
# define VIR_FROM_THIS VIR_FROM_NONE
|
||||||
@@ -49,7 +50,7 @@ mymain(void)
|
|||||||
if ((driver.caps = virBhyveCapsBuild()) == NULL)
|
if ((driver.caps = virBhyveCapsBuild()) == NULL)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
if ((driver.xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL)) == NULL)
|
if ((driver.xmlopt = virBhyveDriverCreateXMLConf(&driver)) == NULL)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
# define DO_TEST_FULL(name, is_different) \
|
# define DO_TEST_FULL(name, is_different) \
|
||||||
|
|||||||
Reference in New Issue
Block a user