[libvirt] [PATCH 0/4] qemu: Assign addresses via virDomainDefPostParse

This series adds a new domain post parse callback virDomainDefAssignAddressesCallback, which we use in the qemu driver to trigger qemuDomainAssignAddresses via PostParse. This streamlines things a bit, but is also needed for some future work. After this series, the only remaining open coded qemuDomainAssignAddresses calls involve populating the runtime VM address caches, which I discussesd here: http://www.redhat.com/archives/libvir-list/2016-May/msg01071.html Cole Robinson (4): domain: Add virDomainDefAssignAddressesCallback qemu: Assign device addresses in PostParse qemu: Remove redundant qemuDomainAssignAddresses calls qemu: Call virDomainDefPostParse via CONFIG hotplug src/conf/domain_conf.c | 7 ++ src/conf/domain_conf.h | 8 ++ src/qemu/qemu_domain.c | 25 ++++++ src/qemu/qemu_driver.c | 90 +++++++++------------- .../qemuargv2xmldata/qemuargv2xml-pseries-disk.xml | 4 +- tests/qemuxml2argvtest.c | 2 +- tests/qemuxml2xmltest.c | 11 +-- 7 files changed, 83 insertions(+), 64 deletions(-) -- 2.7.4

This will be called at the end of virDomainDefPostParse to fill allow hypervisor drivers to fill in device addresses. --- src/conf/domain_conf.c | 7 +++++++ src/conf/domain_conf.h | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ed0c471..1c8d326 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4448,6 +4448,13 @@ virDomainDefPostParse(virDomainDefPtr def, if ((ret = virDomainDefPostParseInternal(def, &data)) < 0) return ret; + if (xmlopt->config.assignAddressesCallback) { + ret = xmlopt->config.assignAddressesCallback(def, caps, parseFlags, + xmlopt->config.priv); + if (ret < 0) + return ret; + } + if (virDomainDefPostParseCheckFeatures(def, xmlopt) < 0) return -1; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b9e696d..02594fe 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2475,6 +2475,13 @@ typedef int (*virDomainDeviceDefPostParseCallback)(virDomainDeviceDefPtr dev, virCapsPtr caps, unsigned int parseFlags, void *opaque); +/* Drive callback for assigning device addresses, called at the end + of parsing, after all defaults and implicit devices have been added */ +typedef int (*virDomainDefAssignAddressesCallback)(virDomainDef *def, + virCapsPtr caps, + unsigned int parseFlags, + void *opaque); + typedef struct _virDomainDefParserConfig virDomainDefParserConfig; typedef virDomainDefParserConfig *virDomainDefParserConfigPtr; @@ -2482,6 +2489,7 @@ struct _virDomainDefParserConfig { /* driver domain definition callbacks */ virDomainDefPostParseCallback domainPostParseCallback; virDomainDeviceDefPostParseCallback devicesPostParseCallback; + virDomainDefAssignAddressesCallback assignAddressesCallback; /* private data for the callbacks */ void *priv; -- 2.7.4

On Sat, 2016-05-14 at 16:00 -0400, Cole Robinson wrote:
This will be called at the end of virDomainDefPostParse to fill allow hypervisor drivers to fill in device addresses.
Too many "fill"s ;)
--- src/conf/domain_conf.c | 7 +++++++ src/conf/domain_conf.h | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ed0c471..1c8d326 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4448,6 +4448,13 @@ virDomainDefPostParse(virDomainDefPtr def, if ((ret = virDomainDefPostParseInternal(def, &data)) < 0) return ret; + if (xmlopt->config.assignAddressesCallback) { + ret = xmlopt->config.assignAddressesCallback(def, caps, parseFlags, + xmlopt->config.priv); + if (ret < 0) + return ret; + } + if (virDomainDefPostParseCheckFeatures(def, xmlopt) < 0) return -1; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b9e696d..02594fe 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2475,6 +2475,13 @@ typedef int (*virDomainDeviceDefPostParseCallback)(virDomainDeviceDefPtr dev, virCapsPtr caps, unsigned int parseFlags, void *opaque); +/* Drive callback for assigning device addresses, called at the end + of parsing, after all defaults and implicit devices have been added */
The second line of the comment should have a '*' as well.
+typedef int (*virDomainDefAssignAddressesCallback)(virDomainDef *def, + virCapsPtr caps, + unsigned int parseFlags, + void *opaque); + typedef struct _virDomainDefParserConfig virDomainDefParserConfig; typedef virDomainDefParserConfig *virDomainDefParserConfigPtr; @@ -2482,6 +2489,7 @@ struct _virDomainDefParserConfig { /* driver domain definition callbacks */ virDomainDefPostParseCallback domainPostParseCallback; virDomainDeviceDefPostParseCallback devicesPostParseCallback; + virDomainDefAssignAddressesCallback assignAddressesCallback; /* private data for the callbacks */ void *priv;
ACK -- Andrea Bolognani Software Engineer - Virtualization Team

This wires up qemuDomainAssignAddresses into the new virDomainDefAssignAddressesCallback, so it's always triggered via virDomainDefPostParse. We are essentially doing this already with open coded calls sprinkled about qemu argv parse output changes slightly since previously it wasn't hitting qemuDomainAssignAddresses. --- src/qemu/qemu_domain.c | 25 ++++++++++++++++++++++ .../qemuargv2xmldata/qemuargv2xml-pseries-disk.xml | 4 +++- tests/qemuxml2argvtest.c | 2 +- tests/qemuxml2xmltest.c | 11 ++-------- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b0eb3b6..50505a6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2293,9 +2293,34 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, } +static int +qemuDomainDefAssignAddressesCallback(virDomainDef *def, + virCapsPtr caps ATTRIBUTE_UNUSED, + unsigned int parseFlags ATTRIBUTE_UNUSED, + void *opaque) +{ + virQEMUDriverPtr driver = opaque; + virQEMUCapsPtr qemuCaps = NULL; + int ret = -1; + + if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, + def->emulator))) + goto cleanup; + + if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0) + goto cleanup; + + ret = 0; + cleanup: + virObjectUnref(qemuCaps); + return ret; +} + + virDomainDefParserConfig virQEMUDriverDomainDefParserConfig = { .devicesPostParseCallback = qemuDomainDeviceDefPostParse, .domainPostParseCallback = qemuDomainDefPostParse, + .assignAddressesCallback = qemuDomainDefAssignAddressesCallback, .features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG | VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN }; diff --git a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml b/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml index 8cec27c..ab9195a 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml @@ -29,7 +29,9 @@ </disk> <controller type='usb' index='0'/> <controller type='pci' index='0' model='pci-root'/> - <controller type='scsi' index='0'/> + <controller type='scsi' index='0'> + <address type='spapr-vio' reg='0x2000'/> + </controller> <input type='keyboard' bus='usb'/> <input type='mouse' bus='usb'/> <graphics type='sdl'/> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index d1cfbec..840efc9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1382,7 +1382,7 @@ mymain(void) QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION); DO_TEST("pseries-vio-user-assigned", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG); - DO_TEST_FAILURE("pseries-vio-address-clash", + DO_TEST_PARSE_ERROR("pseries-vio-address-clash", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG); DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_NVRAM); DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI, diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 5a43fa9..9eb2625 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -37,13 +37,9 @@ struct testInfo { }; static int -qemuXML2XMLPreFormatCallback(virDomainDefPtr def, const void *opaque) +qemuXML2XMLPreFormatCallback(virDomainDefPtr def ATTRIBUTE_UNUSED, + const void *opaque ATTRIBUTE_UNUSED) { - const struct testInfo *info = opaque; - - if (qemuDomainAssignAddresses(def, info->qemuCaps, NULL)) - return -1; - return 0; } @@ -153,9 +149,6 @@ testCompareStatusXMLToXMLFiles(const void *opaque) goto cleanup; } - if (qemuDomainAssignAddresses(obj->def, data->qemuCaps, NULL)) - goto cleanup; - /* format it back */ if (!(actual = virDomainObjFormat(driver.xmlopt, obj, NULL, VIR_DOMAIN_DEF_FORMAT_SECURE))) { -- 2.7.4

On Sat, 2016-05-14 at 16:00 -0400, Cole Robinson wrote:
This wires up qemuDomainAssignAddresses into the new virDomainDefAssignAddressesCallback, so it's always triggered via virDomainDefPostParse. We are essentially doing this already with open coded calls sprinkled about
Missing period.
qemu argv parse output changes slightly since previously it wasn't hitting qemuDomainAssignAddresses. --- src/qemu/qemu_domain.c | 25 ++++++++++++++++++++++ .../qemuargv2xmldata/qemuargv2xml-pseries-disk.xml | 4 +++- tests/qemuxml2argvtest.c | 2 +- tests/qemuxml2xmltest.c | 11 ++-------- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b0eb3b6..50505a6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2293,9 +2293,34 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, } +static int +qemuDomainDefAssignAddressesCallback(virDomainDef *def, + virCapsPtr caps ATTRIBUTE_UNUSED, + unsigned int parseFlags ATTRIBUTE_UNUSED,
So these two arguments are unused, and they remain unused by the end of the series... I guess you wanted to have the same signature as virDomainDefPostParseCallback()? Not sure if it's worth keeping them around, but I guess it's not a big deal either way.
+ void *opaque) +{ + virQEMUDriverPtr driver = opaque; + virQEMUCapsPtr qemuCaps = NULL; + int ret = -1; + + if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, + def->emulator))) + goto cleanup; + + if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0) + goto cleanup; + + ret = 0; + cleanup: + virObjectUnref(qemuCaps); + return ret; +} + + virDomainDefParserConfig virQEMUDriverDomainDefParserConfig = { .devicesPostParseCallback = qemuDomainDeviceDefPostParse, .domainPostParseCallback = qemuDomainDefPostParse, + .assignAddressesCallback = qemuDomainDefAssignAddressesCallback,
I'd say call it qemuDomainDefAssignAddresses for consistency's sake.
.features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG | VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN }; diff --git a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml b/tests/qemuargv2xmldata/qemuargv2xml-pseries- disk.xml index 8cec27c..ab9195a 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml @@ -29,7 +29,9 @@ </disk> <controller type='usb' index='0'/> <controller type='pci' index='0' model='pci-root'/> - <controller type='scsi' index='0'/> + <controller type='scsi' index='0'> + <address type='spapr-vio' reg='0x2000'/> + </controller> <input type='keyboard' bus='usb'/> <input type='mouse' bus='usb'/> <graphics type='sdl'/> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index d1cfbec..840efc9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1382,7 +1382,7 @@ mymain(void) QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION); DO_TEST("pseries-vio-user-assigned", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG); - DO_TEST_FAILURE("pseries-vio-address-clash", + DO_TEST_PARSE_ERROR("pseries-vio-address-clash", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG); DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_NVRAM); DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI, diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 5a43fa9..9eb2625 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -37,13 +37,9 @@ struct testInfo { }; static int -qemuXML2XMLPreFormatCallback(virDomainDefPtr def, const void *opaque) +qemuXML2XMLPreFormatCallback(virDomainDefPtr def ATTRIBUTE_UNUSED, + const void *opaque ATTRIBUTE_UNUSED) { - const struct testInfo *info = opaque; - - if (qemuDomainAssignAddresses(def, info->qemuCaps, NULL)) - return -1; - return 0; }
If you're going to remove the whole function body, why not go the extra mile? Get rid of the function altogether and just pass NULL to testCompareDomXML2XMLFiles().
@@ -153,9 +149,6 @@ testCompareStatusXMLToXMLFiles(const void *opaque) goto cleanup; } - if (qemuDomainAssignAddresses(obj->def, data->qemuCaps, NULL)) - goto cleanup; - /* format it back */ if (!(actual = virDomainObjFormat(driver.xmlopt, obj, NULL, VIR_DOMAIN_DEF_FORMAT_SECURE))) {
ACK -- Andrea Bolognani Software Engineer - Virtualization Team

On 05/17/2016 10:39 AM, Andrea Bolognani wrote:
On Sat, 2016-05-14 at 16:00 -0400, Cole Robinson wrote:
This wires up qemuDomainAssignAddresses into the new virDomainDefAssignAddressesCallback, so it's always triggered via virDomainDefPostParse. We are essentially doing this already with open coded calls sprinkled about
Missing period.
qemu argv parse output changes slightly since previously it wasn't hitting qemuDomainAssignAddresses. --- src/qemu/qemu_domain.c | 25 ++++++++++++++++++++++ .../qemuargv2xmldata/qemuargv2xml-pseries-disk.xml | 4 +++- tests/qemuxml2argvtest.c | 2 +- tests/qemuxml2xmltest.c | 11 ++-------- 4 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b0eb3b6..50505a6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2293,9 +2293,34 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, }
+static int +qemuDomainDefAssignAddressesCallback(virDomainDef *def, + virCapsPtr caps ATTRIBUTE_UNUSED, + unsigned int parseFlags ATTRIBUTE_UNUSED,
So these two arguments are unused, and they remain unused by the end of the series... I guess you wanted to have the same signature as virDomainDefPostParseCallback()?
Not sure if it's worth keeping them around, but I guess it's not a big deal either way.
I was just doing it to be consistent with the other callbacks. I just left it as is since I can imagine some day we are going to want to abide parseFlags at least.
+ void *opaque) +{ + virQEMUDriverPtr driver = opaque; + virQEMUCapsPtr qemuCaps = NULL; + int ret = -1; + + if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, + def->emulator))) + goto cleanup; + + if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0) + goto cleanup; + + ret = 0; + cleanup: + virObjectUnref(qemuCaps); + return ret; +} + + virDomainDefParserConfig virQEMUDriverDomainDefParserConfig = { .devicesPostParseCallback = qemuDomainDeviceDefPostParse, .domainPostParseCallback = qemuDomainDefPostParse, + .assignAddressesCallback = qemuDomainDefAssignAddressesCallback,
I'd say call it qemuDomainDefAssignAddresses for consistency's sake.
.features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG | VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN }; diff --git a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml b/tests/qemuargv2xmldata/qemuargv2xml-pseries- disk.xml index 8cec27c..ab9195a 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml @@ -29,7 +29,9 @@ </disk> <controller type='usb' index='0'/> <controller type='pci' index='0' model='pci-root'/> - <controller type='scsi' index='0'/> + <controller type='scsi' index='0'> + <address type='spapr-vio' reg='0x2000'/> + </controller> <input type='keyboard' bus='usb'/> <input type='mouse' bus='usb'/> <graphics type='sdl'/> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index d1cfbec..840efc9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1382,7 +1382,7 @@ mymain(void) QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION); DO_TEST("pseries-vio-user-assigned", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG); - DO_TEST_FAILURE("pseries-vio-address-clash", + DO_TEST_PARSE_ERROR("pseries-vio-address-clash", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG); DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_NVRAM); DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI, diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 5a43fa9..9eb2625 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -37,13 +37,9 @@ struct testInfo { };
static int -qemuXML2XMLPreFormatCallback(virDomainDefPtr def, const void *opaque) +qemuXML2XMLPreFormatCallback(virDomainDefPtr def ATTRIBUTE_UNUSED, + const void *opaque ATTRIBUTE_UNUSED) { - const struct testInfo *info = opaque; - - if (qemuDomainAssignAddresses(def, info->qemuCaps, NULL)) - return -1; - return 0; }
If you're going to remove the whole function body, why not go the extra mile? Get rid of the function altogether and just pass NULL to testCompareDomXML2XMLFiles().
This callback could be used for other types of testing, like assigning aliases which we don't presently test. So I decided to leave it in. Thanks, Cole

All these calls come near immediately after parsing the domain XML, which now triggers qemuDomainAssignAddresses. So drop the now redundnat calls --- src/qemu/qemu_driver.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 37d970e..f47c620 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1771,7 +1771,6 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, virObjectEventPtr event = NULL; virObjectEventPtr event2 = NULL; unsigned int start_flags = VIR_QEMU_PROCESS_START_COLD; - virQEMUCapsPtr qemuCaps = NULL; virCapsPtr caps = NULL; unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE | VIR_DOMAIN_DEF_PARSE_ABI_UPDATE; @@ -1799,12 +1798,6 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, if (virDomainCreateXMLEnsureACL(conn, def) < 0) goto cleanup; - if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator))) - goto cleanup; - - if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0) - goto cleanup; - if (!(vm = virDomainObjListAdd(driver->domains, def, driver->xmlopt, VIR_DOMAIN_OBJ_LIST_ADD_LIVE | @@ -1858,7 +1851,6 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, qemuDomainEventQueue(driver, event2); } virObjectUnref(caps); - virObjectUnref(qemuCaps); virNWFilterUnlockFilterUpdates(); return dom; } @@ -7249,7 +7241,6 @@ static virDomainPtr qemuDomainDefineXMLFlags(virConnectPtr conn, const char *xml virDomainObjPtr vm = NULL; virDomainPtr dom = NULL; virObjectEventPtr event = NULL; - virQEMUCapsPtr qemuCaps = NULL; virQEMUDriverConfigPtr cfg; virCapsPtr caps = NULL; unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE | @@ -7272,12 +7263,6 @@ static virDomainPtr qemuDomainDefineXMLFlags(virConnectPtr conn, const char *xml if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0) goto cleanup; - if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator))) - goto cleanup; - - if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0) - goto cleanup; - if (!(vm = virDomainObjListAdd(driver->domains, def, driver->xmlopt, 0, &oldDef))) @@ -7328,7 +7313,6 @@ static virDomainPtr qemuDomainDefineXMLFlags(virConnectPtr conn, const char *xml virDomainDefFree(def); virDomainObjEndAPI(&vm); qemuDomainEventQueue(driver, event); - virObjectUnref(qemuCaps); virObjectUnref(caps); virObjectUnref(cfg); return dom; @@ -15975,9 +15959,6 @@ static virDomainPtr qemuDomainQemuAttach(virConnectPtr conn, if (qemuAssignDeviceAliases(def, qemuCaps) < 0) goto cleanup; - if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0) - goto cleanup; - if (!(vm = virDomainObjListAdd(driver->domains, def, driver->xmlopt, VIR_DOMAIN_OBJ_LIST_ADD_LIVE | -- 2.7.4

On Sat, 2016-05-14 at 16:00 -0400, Cole Robinson wrote:
All these calls come near immediately after parsing the domain XML, which now triggers qemuDomainAssignAddresses. So drop the now redundnat calls --- src/qemu/qemu_driver.c | 19 ------------------- 1 file changed, 19 deletions(-)
This would make more sense squashed together with the previous commit IMHO. ACK either way. -- Andrea Bolognani Software Engineer - Virtualization Team

On 05/17/2016 10:42 AM, Andrea Bolognani wrote:
On Sat, 2016-05-14 at 16:00 -0400, Cole Robinson wrote:
All these calls come near immediately after parsing the domain XML, which now triggers qemuDomainAssignAddresses. So drop the now redundnat calls --- src/qemu/qemu_driver.c | 19 ------------------- 1 file changed, 19 deletions(-)
This would make more sense squashed together with the previous commit IMHO.
ACK either way.
I wanted to keep it separate incase I missed something in this part or this part was more contentious. But I've squashed it into the previous patch Thanks, Cole

hotplug APIs with the AFFECT_CONFIG flag are essentially replicating 'insert <device> into XML document, and redefine XML'. Thinking of it this way, it's natural that we call virDomainDefPostParse after manually editing the XML here. Not only does doing so allow us to drop a bunch of open coded calls to qemuDomainAssignAddresses, but it also means we are going through the standard channels for XML validation and potentially catching errors in user submitted XML. --- src/qemu/qemu_driver.c | 71 ++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f47c620..c5fc069 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7775,10 +7775,12 @@ qemuDomainUpdateDeviceLive(virConnectPtr conn, } static int -qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, - virDomainDefPtr vmdef, +qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev, - virConnectPtr conn) + virConnectPtr conn, + virCapsPtr caps, + unsigned int parse_flags, + virDomainXMLOptionPtr xmlopt) { virDomainDiskDefPtr disk; virDomainNetDefPtr net; @@ -7803,11 +7805,6 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, return -1; /* vmdef has the pointer. Generic codes for vmdef will do all jobs */ dev->data.disk = NULL; - if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) - if (virDomainDefAddImplicitDevices(vmdef) < 0) - return -1; - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break; case VIR_DOMAIN_DEVICE_NET: @@ -7815,8 +7812,6 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, if (virDomainNetInsert(vmdef, net)) return -1; dev->data.net = NULL; - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break; case VIR_DOMAIN_DEVICE_HOSTDEV: @@ -7829,10 +7824,6 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, if (virDomainHostdevInsert(vmdef, hostdev)) return -1; dev->data.hostdev = NULL; - if (virDomainDefAddImplicitDevices(vmdef) < 0) - return -1; - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break; case VIR_DOMAIN_DEVICE_LEASE: @@ -7863,18 +7854,12 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, return -1; dev->data.controller = NULL; - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break; case VIR_DOMAIN_DEVICE_CHR: if (qemuDomainChrInsert(vmdef, dev->data.chr) < 0) return -1; dev->data.chr = NULL; - if (virDomainDefAddImplicitDevices(vmdef) < 0) - return -1; - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break; case VIR_DOMAIN_DEVICE_FS: @@ -7902,8 +7887,6 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, return -1; dev->data.rng = NULL; - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break; case VIR_DOMAIN_DEVICE_MEMORY: @@ -7941,13 +7924,20 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, virDomainDeviceTypeToString(dev->type)); return -1; } + + if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt) < 0) + return -1; + return 0; } static int qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, - virDomainDeviceDefPtr dev) + virDomainDeviceDefPtr dev, + virCapsPtr caps, + unsigned int parse_flags, + virDomainXMLOptionPtr xmlopt) { virDomainDiskDefPtr disk, det_disk; virDomainNetDefPtr net; @@ -8077,13 +8067,19 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceTypeToString(dev->type)); return -1; } + + if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt) < 0) + return -1; + return 0; } static int -qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps, - virDomainDefPtr vmdef, - virDomainDeviceDefPtr dev) +qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef, + virDomainDeviceDefPtr dev, + virCapsPtr caps, + unsigned int parse_flags, + virDomainXMLOptionPtr xmlopt) { virDomainDiskDefPtr orig, disk; virDomainGraphicsDefPtr newGraphics; @@ -8141,9 +8137,6 @@ qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps, vmdef->nets[pos] = net; dev->data.net = NULL; - - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break; case VIR_DOMAIN_DEVICE_FS: @@ -8172,6 +8165,10 @@ qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps, virDomainDeviceTypeToString(dev->type)); return -1; } + + if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt) < 0) + return -1; + return 0; } @@ -8247,8 +8244,9 @@ static int qemuDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, VIR_DOMAIN_DEVICE_ACTION_ATTACH) < 0) goto endjob; - if ((ret = qemuDomainAttachDeviceConfig(qemuCaps, vmdef, dev, - dom->conn)) < 0) + if ((ret = qemuDomainAttachDeviceConfig(vmdef, dev, dom->conn, caps, + parse_flags, + driver->xmlopt)) < 0) goto endjob; } @@ -8316,6 +8314,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, qemuDomainObjPrivatePtr priv; virQEMUDriverConfigPtr cfg = NULL; virCapsPtr caps = NULL; + unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE; virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG | @@ -8341,7 +8340,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, dev = dev_copy = virDomainDeviceDefParse(xml, vm->def, caps, driver->xmlopt, - VIR_DOMAIN_DEF_PARSE_INACTIVE); + parse_flags); if (dev == NULL) goto endjob; @@ -8374,7 +8373,9 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, VIR_DOMAIN_DEVICE_ACTION_UPDATE) < 0) goto endjob; - if ((ret = qemuDomainUpdateDeviceConfig(qemuCaps, vmdef, dev)) < 0) + if ((ret = qemuDomainUpdateDeviceConfig(vmdef, dev, caps, + parse_flags, + driver->xmlopt)) < 0) goto endjob; } @@ -8494,7 +8495,9 @@ static int qemuDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, VIR_DOMAIN_DEVICE_ACTION_DETACH) < 0) goto endjob; - if ((ret = qemuDomainDetachDeviceConfig(vmdef, dev)) < 0) + if ((ret = qemuDomainDetachDeviceConfig(vmdef, dev, caps, + parse_flags, + driver->xmlopt)) < 0) goto endjob; } -- 2.7.4

On Sat, 2016-05-14 at 16:00 -0400, Cole Robinson wrote:
hotplug APIs with the AFFECT_CONFIG flag are essentially replicating 'insert <device> into XML document, and redefine XML'. Thinking of it this way, it's natural that we call virDomainDefPostParse after manually editing the XML here. Not only does doing so allow us to drop a bunch of open coded calls to qemuDomainAssignAddresses, but it also means we are going through the standard channels for XML validation and potentially catching errors in user submitted XML. --- src/qemu/qemu_driver.c | 71 ++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f47c620..c5fc069 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7775,10 +7775,12 @@ qemuDomainUpdateDeviceLive(virConnectPtr conn, } static int -qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, - virDomainDefPtr vmdef, +qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev, - virConnectPtr conn) + virConnectPtr conn, + virCapsPtr caps, + unsigned int parse_flags,
s/parse_flags/parseFlags/g
+ virDomainXMLOptionPtr xmlopt) { virDomainDiskDefPtr disk; virDomainNetDefPtr net; @@ -7803,11 +7805,6 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, return -1; /* vmdef has the pointer. Generic codes for vmdef will do all jobs */ dev->data.disk = NULL; - if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) - if (virDomainDefAddImplicitDevices(vmdef) < 0) - return -1;
You removed the check on disk->bus here, and that concerns me a little. Can you please spend a few words explaining why this is safe?
- if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break; case VIR_DOMAIN_DEVICE_NET: @@ -7815,8 +7812,6 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, if (virDomainNetInsert(vmdef, net)) return -1; dev->data.net = NULL; - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break; case VIR_DOMAIN_DEVICE_HOSTDEV: @@ -7829,10 +7824,6 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, if (virDomainHostdevInsert(vmdef, hostdev)) return -1; dev->data.hostdev = NULL; - if (virDomainDefAddImplicitDevices(vmdef) < 0) - return -1; - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break; case VIR_DOMAIN_DEVICE_LEASE: @@ -7863,18 +7854,12 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, return -1; dev->data.controller = NULL; - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break; case VIR_DOMAIN_DEVICE_CHR: if (qemuDomainChrInsert(vmdef, dev->data.chr) < 0) return -1; dev->data.chr = NULL; - if (virDomainDefAddImplicitDevices(vmdef) < 0) - return -1; - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break; case VIR_DOMAIN_DEVICE_FS: @@ -7902,8 +7887,6 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, return -1; dev->data.rng = NULL; - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break; case VIR_DOMAIN_DEVICE_MEMORY: @@ -7941,13 +7924,20 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, virDomainDeviceTypeToString(dev->type)); return -1; } + + if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt) < 0) + return -1; + return 0; } static int qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, - virDomainDeviceDefPtr dev) + virDomainDeviceDefPtr dev, + virCapsPtr caps, + unsigned int parse_flags, + virDomainXMLOptionPtr xmlopt) { virDomainDiskDefPtr disk, det_disk; virDomainNetDefPtr net; @@ -8077,13 +8067,19 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceTypeToString(dev->type)); return -1; } + + if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt) < 0) + return -1; + return 0; } static int -qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps, - virDomainDefPtr vmdef, - virDomainDeviceDefPtr dev) +qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef, + virDomainDeviceDefPtr dev, + virCapsPtr caps, + unsigned int parse_flags, + virDomainXMLOptionPtr xmlopt) { virDomainDiskDefPtr orig, disk; virDomainGraphicsDefPtr newGraphics; @@ -8141,9 +8137,6 @@ qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps, vmdef->nets[pos] = net; dev->data.net = NULL; - - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break; case VIR_DOMAIN_DEVICE_FS: @@ -8172,6 +8165,10 @@ qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps, virDomainDeviceTypeToString(dev->type)); return -1; } + + if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt) < 0) + return -1; + return 0; } @@ -8247,8 +8244,9 @@ static int qemuDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, VIR_DOMAIN_DEVICE_ACTION_ATTACH) < 0) goto endjob; - if ((ret = qemuDomainAttachDeviceConfig(qemuCaps, vmdef, dev, - dom->conn)) < 0) + if ((ret = qemuDomainAttachDeviceConfig(vmdef, dev, dom->conn, caps, + parse_flags, + driver->xmlopt)) < 0) goto endjob; } @@ -8316,6 +8314,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, qemuDomainObjPrivatePtr priv; virQEMUDriverConfigPtr cfg = NULL; virCapsPtr caps = NULL; + unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE; virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG | @@ -8341,7 +8340,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, dev = dev_copy = virDomainDeviceDefParse(xml, vm->def, caps, driver->xmlopt, - VIR_DOMAIN_DEF_PARSE_INACTIVE); + parse_flags); if (dev == NULL) goto endjob; @@ -8374,7 +8373,9 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, VIR_DOMAIN_DEVICE_ACTION_UPDATE) < 0) goto endjob; - if ((ret = qemuDomainUpdateDeviceConfig(qemuCaps, vmdef, dev)) < 0) + if ((ret = qemuDomainUpdateDeviceConfig(vmdef, dev, caps, + parse_flags, + driver->xmlopt)) < 0) goto endjob; } @@ -8494,7 +8495,9 @@ static int qemuDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, VIR_DOMAIN_DEVICE_ACTION_DETACH) < 0) goto endjob; - if ((ret = qemuDomainDetachDeviceConfig(vmdef, dev)) < 0) + if ((ret = qemuDomainDetachDeviceConfig(vmdef, dev, caps, + parse_flags, + driver->xmlopt)) < 0) goto endjob; }
The rest looks reasonable, and the fact that this change doesn't require altering the test suite in any way is definitely reassuring. -- Andrea Bolognani Software Engineer - Virtualization Team

On 05/17/2016 01:20 PM, Andrea Bolognani wrote:
On Sat, 2016-05-14 at 16:00 -0400, Cole Robinson wrote:
hotplug APIs with the AFFECT_CONFIG flag are essentially replicating 'insert <device> into XML document, and redefine XML'. Thinking of it this way, it's natural that we call virDomainDefPostParse after manually editing the XML here.
Not only does doing so allow us to drop a bunch of open coded calls to qemuDomainAssignAddresses, but it also means we are going through the standard channels for XML validation and potentially catching errors in user submitted XML. --- src/qemu/qemu_driver.c | 71 ++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 34 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f47c620..c5fc069 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7775,10 +7775,12 @@ qemuDomainUpdateDeviceLive(virConnectPtr conn, }
static int -qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, - virDomainDefPtr vmdef, +qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev, - virConnectPtr conn) + virConnectPtr conn, + virCapsPtr caps, + unsigned int parse_flags,
s/parse_flags/parseFlags/g
+ virDomainXMLOptionPtr xmlopt) { virDomainDiskDefPtr disk; virDomainNetDefPtr net; @@ -7803,11 +7805,6 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, return -1; /* vmdef has the pointer. Generic codes for vmdef will do all jobs */ dev->data.disk = NULL; - if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) - if (virDomainDefAddImplicitDevices(vmdef) < 0) - return -1;
You removed the check on disk->bus here, and that concerns me a little. Can you please spend a few words explaining why this is safe?
I think the idea behind that check was 'adding a virtio disk doesn't need any implied controller, but bus=scsi might, so only call AddImplicit for non-virtio' However AddImplicit _must_ do the right thing here anyways, since for example it is called every time we parse the XML, like reading it from disk on libvirtd startup. So the check here was overly paranoid (but maybe it made sense once)
- if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break;
case VIR_DOMAIN_DEVICE_NET: @@ -7815,8 +7812,6 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, if (virDomainNetInsert(vmdef, net)) return -1; dev->data.net = NULL; - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break;
case VIR_DOMAIN_DEVICE_HOSTDEV: @@ -7829,10 +7824,6 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, if (virDomainHostdevInsert(vmdef, hostdev)) return -1; dev->data.hostdev = NULL; - if (virDomainDefAddImplicitDevices(vmdef) < 0) - return -1; - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break;
case VIR_DOMAIN_DEVICE_LEASE: @@ -7863,18 +7854,12 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, return -1; dev->data.controller = NULL;
- if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break;
case VIR_DOMAIN_DEVICE_CHR: if (qemuDomainChrInsert(vmdef, dev->data.chr) < 0) return -1; dev->data.chr = NULL; - if (virDomainDefAddImplicitDevices(vmdef) < 0) - return -1; - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break;
case VIR_DOMAIN_DEVICE_FS: @@ -7902,8 +7887,6 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, return -1; dev->data.rng = NULL;
- if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break;
case VIR_DOMAIN_DEVICE_MEMORY: @@ -7941,13 +7924,20 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, virDomainDeviceTypeToString(dev->type)); return -1; } + + if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt) < 0) + return -1; + return 0; }
static int qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, - virDomainDeviceDefPtr dev) + virDomainDeviceDefPtr dev, + virCapsPtr caps, + unsigned int parse_flags, + virDomainXMLOptionPtr xmlopt) { virDomainDiskDefPtr disk, det_disk; virDomainNetDefPtr net; @@ -8077,13 +8067,19 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceTypeToString(dev->type)); return -1; } + + if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt) < 0) + return -1; + return 0; }
static int -qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps, - virDomainDefPtr vmdef, - virDomainDeviceDefPtr dev) +qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef, + virDomainDeviceDefPtr dev, + virCapsPtr caps, + unsigned int parse_flags, + virDomainXMLOptionPtr xmlopt) { virDomainDiskDefPtr orig, disk; virDomainGraphicsDefPtr newGraphics; @@ -8141,9 +8137,6 @@ qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps,
vmdef->nets[pos] = net; dev->data.net = NULL; - - if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0) - return -1; break;
case VIR_DOMAIN_DEVICE_FS: @@ -8172,6 +8165,10 @@ qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps, virDomainDeviceTypeToString(dev->type)); return -1; } + + if (virDomainDefPostParse(vmdef, caps, parse_flags, xmlopt) < 0) + return -1; + return 0; }
@@ -8247,8 +8244,9 @@ static int qemuDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, VIR_DOMAIN_DEVICE_ACTION_ATTACH) < 0) goto endjob;
- if ((ret = qemuDomainAttachDeviceConfig(qemuCaps, vmdef, dev, - dom->conn)) < 0) + if ((ret = qemuDomainAttachDeviceConfig(vmdef, dev, dom->conn, caps, + parse_flags, + driver->xmlopt)) < 0) goto endjob; }
@@ -8316,6 +8314,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, qemuDomainObjPrivatePtr priv; virQEMUDriverConfigPtr cfg = NULL; virCapsPtr caps = NULL; + unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG | @@ -8341,7 +8340,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
dev = dev_copy = virDomainDeviceDefParse(xml, vm->def, caps, driver->xmlopt, - VIR_DOMAIN_DEF_PARSE_INACTIVE); + parse_flags); if (dev == NULL) goto endjob;
@@ -8374,7 +8373,9 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, VIR_DOMAIN_DEVICE_ACTION_UPDATE) < 0) goto endjob;
- if ((ret = qemuDomainUpdateDeviceConfig(qemuCaps, vmdef, dev)) < 0) + if ((ret = qemuDomainUpdateDeviceConfig(vmdef, dev, caps, + parse_flags, + driver->xmlopt)) < 0) goto endjob; }
@@ -8494,7 +8495,9 @@ static int qemuDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, VIR_DOMAIN_DEVICE_ACTION_DETACH) < 0) goto endjob;
- if ((ret = qemuDomainDetachDeviceConfig(vmdef, dev)) < 0) + if ((ret = qemuDomainDetachDeviceConfig(vmdef, dev, caps, + parse_flags, + driver->xmlopt)) < 0) goto endjob; }
The rest looks reasonable, and the fact that this change doesn't require altering the test suite in any way is definitely reassuring.
Unfortunately the test suite may not cover this stuff, I didn't confirm. There is qemuhotplugtest.c but it's kind of complicated. Thanks, Cole

On Tue, 2016-05-17 at 14:24 -0400, Cole Robinson wrote:
+ virDomainXMLOptionPtr xmlopt) { virDomainDiskDefPtr disk; virDomainNetDefPtr net; @@ -7803,11 +7805,6 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, return -1; /* vmdef has the pointer. Generic codes for vmdef will do all jobs */ dev->data.disk = NULL; - if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) - if (virDomainDefAddImplicitDevices(vmdef) < 0) - return -1;
You removed the check on disk->bus here, and that concerns me a little. Can you please spend a few words explaining why this is safe?
I think the idea behind that check was 'adding a virtio disk doesn't need any implied controller, but bus=scsi might, so only call AddImplicit for non-virtio'
However AddImplicit _must_ do the right thing here anyways, since for example it is called every time we parse the XML, like reading it from disk on libvirtd startup. So the check here was overly paranoid (but maybe it made sense once)
Makes sense, thanks for the explanation. ACK with the argument name changed. -- Andrea Bolognani Software Engineer - Virtualization Team

On 05/17/2016 01:20 PM, Andrea Bolognani wrote:
On Sat, 2016-05-14 at 16:00 -0400, Cole Robinson wrote:
hotplug APIs with the AFFECT_CONFIG flag are essentially replicating 'insert <device> into XML document, and redefine XML'. Thinking of it this way, it's natural that we call virDomainDefPostParse after manually editing the XML here.
Not only does doing so allow us to drop a bunch of open coded calls to qemuDomainAssignAddresses, but it also means we are going through the standard channels for XML validation and potentially catching errors in user submitted XML. --- src/qemu/qemu_driver.c | 71 ++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 34 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f47c620..c5fc069 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7775,10 +7775,12 @@ qemuDomainUpdateDeviceLive(virConnectPtr conn, }
static int -qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps, - virDomainDefPtr vmdef, +qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev, - virConnectPtr conn) + virConnectPtr conn, + virCapsPtr caps, + unsigned int parse_flags,
s/parse_flags/parseFlags/g
Actually everywhere else in this file uses parse_flags, including other hotplug routines, so I kept it this way Thanks, Cole

Upcoming patches are going to make the disk portion of these test cases fail. In order to make it work, we would need to extend the qemuargv2xml test infrastructure to handle qemuCaps. This is worthwhile to do at some point but isn't critical. Instead just drop the offending portion, which isn't even the target of the test cases anyways --- tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-off-argv.args | 4 +--- tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-off-argv.xml | 5 ----- tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-on-argv.args | 4 +--- tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-on-argv.xml | 5 ----- tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-off-argv.args | 4 +--- tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-off-argv.xml | 5 ----- tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-on-argv.args | 4 +--- tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-on-argv.xml | 5 ----- tests/qemuargv2xmldata/qemuargv2xml-machine-keywrap-none-argv.args | 4 +--- tests/qemuargv2xmldata/qemuargv2xml-machine-keywrap-none-argv.xml | 5 ----- 10 files changed, 5 insertions(+), 40 deletions(-) diff --git a/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-off-argv.args b/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-off-argv.args index c1609b1..ed88352 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-off-argv.args +++ b/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-off-argv.args @@ -15,6 +15,4 @@ QEMU_AUDIO_DRV=none \ -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait \ -no-acpi \ --boot c \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=virtio,index=0,\ -id=drive-virtio-disk0 +-boot c diff --git a/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-off-argv.xml b/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-off-argv.xml index 7ccdc67..7c100a7 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-off-argv.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-off-argv.xml @@ -14,11 +14,6 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-s390x</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='vda' bus='virtio'/> - </disk> <memballoon model='none'/> <panic model='s390'/> </devices> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-on-argv.args b/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-on-argv.args index 775b484..99f58f0 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-on-argv.args +++ b/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-on-argv.args @@ -15,6 +15,4 @@ QEMU_AUDIO_DRV=none \ -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait \ -no-acpi \ --boot c \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=virtio,index=0,\ -id=drive-virtio-disk0 +-boot c diff --git a/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-on-argv.xml b/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-on-argv.xml index a02523d..94bb6b2 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-on-argv.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-on-argv.xml @@ -14,11 +14,6 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-s390x</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='vda' bus='virtio'/> - </disk> <memballoon model='none'/> <panic model='s390'/> </devices> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-off-argv.args b/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-off-argv.args index e35ab0f..2ffd45e 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-off-argv.args +++ b/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-off-argv.args @@ -15,6 +15,4 @@ QEMU_AUDIO_DRV=none \ -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait \ -no-acpi \ --boot c \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=virtio,index=0,\ -id=drive-virtio-disk0 +-boot c diff --git a/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-off-argv.xml b/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-off-argv.xml index 7f0c871..a707ce3 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-off-argv.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-off-argv.xml @@ -14,11 +14,6 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-s390x</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='vda' bus='virtio'/> - </disk> <memballoon model='none'/> <panic model='s390'/> </devices> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-on-argv.args b/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-on-argv.args index 18dd415..c0102ed 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-on-argv.args +++ b/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-on-argv.args @@ -15,6 +15,4 @@ QEMU_AUDIO_DRV=none \ -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait \ -no-acpi \ --boot c \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=virtio,index=0,\ -id=drive-virtio-disk0 +-boot c diff --git a/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-on-argv.xml b/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-on-argv.xml index d4721dc..41c464a 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-on-argv.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-on-argv.xml @@ -14,11 +14,6 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-s390x</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='vda' bus='virtio'/> - </disk> <memballoon model='none'/> <panic model='s390'/> </devices> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-machine-keywrap-none-argv.args b/tests/qemuargv2xmldata/qemuargv2xml-machine-keywrap-none-argv.args index 283e9b3..0bf57fc 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-machine-keywrap-none-argv.args +++ b/tests/qemuargv2xmldata/qemuargv2xml-machine-keywrap-none-argv.args @@ -15,6 +15,4 @@ QEMU_AUDIO_DRV=none \ -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait \ -no-acpi \ --boot c \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=virtio,index=0,\ -id=drive-virtio-disk0 +-boot c diff --git a/tests/qemuargv2xmldata/qemuargv2xml-machine-keywrap-none-argv.xml b/tests/qemuargv2xmldata/qemuargv2xml-machine-keywrap-none-argv.xml index 5483040..0b0ce70 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-machine-keywrap-none-argv.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-machine-keywrap-none-argv.xml @@ -14,11 +14,6 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-s390x</emulator> - <disk type='block' device='disk'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='vda' bus='virtio'/> - </disk> <memballoon model='none'/> <panic model='s390'/> </devices> -- 2.7.4

All qemu versions we support have QEMU_CAPS_DEVICE, so checking for it is redundant. Remove the usage. The code diff isn't clear, but all that code is just inindented with no other change. Test cases that hit qemuDomainAssignAddresses but don't have infrastructure for specifying qemuCaps values see lots of churn, since now PCI addresses are in the XML output. --- src/qemu/qemu_domain_address.c | 252 ++++++++++----------- .../disk_snapshot_redefine.xml | 12 +- .../external_vm_redefine.xml | 12 +- tests/domainsnapshotxml2xmlout/full_domain.xml | 12 +- tests/domainsnapshotxml2xmlout/metadata.xml | 12 +- tests/qemuargv2xmldata/qemuargv2xml-boot-cdrom.xml | 8 +- .../qemuargv2xmldata/qemuargv2xml-boot-floppy.xml | 8 +- .../qemuargv2xmldata/qemuargv2xml-boot-network.xml | 8 +- .../qemuargv2xml-clock-localtime.xml | 8 +- tests/qemuargv2xmldata/qemuargv2xml-clock-utc.xml | 8 +- .../qemuargv2xml-console-compat.xml | 8 +- .../qemuargv2xml-disk-cdrom-empty.xml | 8 +- tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom.xml | 8 +- .../qemuargv2xml-disk-drive-boot-cdrom.xml | 8 +- .../qemuargv2xml-disk-drive-boot-disk.xml | 8 +- .../qemuargv2xml-disk-drive-cache-directsync.xml | 8 +- .../qemuargv2xml-disk-drive-cache-unsafe.xml | 8 +- .../qemuargv2xml-disk-drive-cache-v2-none.xml | 8 +- .../qemuargv2xml-disk-drive-cache-v2-wb.xml | 8 +- .../qemuargv2xml-disk-drive-cache-v2-wt.xml | 8 +- ...muargv2xml-disk-drive-error-policy-enospace.xml | 8 +- .../qemuargv2xml-disk-drive-error-policy-stop.xml | 8 +- ...xml-disk-drive-error-policy-wreport-rignore.xml | 8 +- .../qemuargv2xml-disk-drive-fmt-qcow.xml | 8 +- .../qemuargv2xml-disk-drive-network-gluster.xml | 6 +- .../qemuargv2xml-disk-drive-network-iscsi-auth.xml | 6 +- .../qemuargv2xml-disk-drive-network-iscsi.xml | 6 +- .../qemuargv2xml-disk-drive-network-nbd-export.xml | 9 +- ...argv2xml-disk-drive-network-nbd-ipv6-export.xml | 9 +- .../qemuargv2xml-disk-drive-network-nbd-ipv6.xml | 9 +- .../qemuargv2xml-disk-drive-network-nbd-unix.xml | 9 +- .../qemuargv2xml-disk-drive-network-nbd.xml | 9 +- .../qemuargv2xml-disk-drive-network-rbd-auth.xml | 9 +- ...emuargv2xml-disk-drive-network-rbd-ceph-env.xml | 9 +- .../qemuargv2xml-disk-drive-network-rbd-ipv6.xml | 9 +- .../qemuargv2xml-disk-drive-network-rbd.xml | 12 +- .../qemuargv2xml-disk-drive-network-sheepdog.xml | 9 +- .../qemuargv2xmldata/qemuargv2xml-disk-floppy.xml | 8 +- tests/qemuargv2xmldata/qemuargv2xml-disk-many.xml | 8 +- tests/qemuargv2xmldata/qemuargv2xml-disk-usb.xml | 8 +- .../qemuargv2xmldata/qemuargv2xml-disk-virtio.xml | 10 +- .../qemuargv2xmldata/qemuargv2xml-disk-xenvbd.xml | 8 +- .../qemuargv2xml-graphics-sdl-fullscreen.xml | 9 +- .../qemuargv2xmldata/qemuargv2xml-graphics-sdl.xml | 9 +- .../qemuargv2xml-graphics-vnc-policy.xml | 9 +- .../qemuargv2xml-graphics-vnc-sasl.xml | 9 +- .../qemuargv2xml-graphics-vnc-socket.xml | 9 +- .../qemuargv2xml-graphics-vnc-tls.xml | 9 +- .../qemuargv2xml-graphics-vnc-websocket.xml | 5 +- .../qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml | 9 +- .../qemuargv2xml-hostdev-pci-address.xml | 9 +- .../qemuargv2xml-hostdev-usb-address.xml | 8 +- .../qemuargv2xmldata/qemuargv2xml-hyperv-panic.xml | 4 +- tests/qemuargv2xmldata/qemuargv2xml-hyperv.xml | 4 +- .../qemuargv2xml-input-usbmouse.xml | 8 +- .../qemuargv2xml-input-usbtablet.xml | 8 +- .../qemuargv2xmldata/qemuargv2xml-kvm-features.xml | 4 +- tests/qemuargv2xmldata/qemuargv2xml-kvmclock.xml | 4 +- .../qemuargv2xml-machine-core-off.xml | 8 +- .../qemuargv2xml-machine-core-on.xml | 8 +- tests/qemuargv2xmldata/qemuargv2xml-migrate.xml | 8 +- tests/qemuargv2xmldata/qemuargv2xml-misc-acpi.xml | 8 +- .../qemuargv2xml-misc-disable-s3.xml | 8 +- .../qemuargv2xml-misc-disable-suspends.xml | 8 +- .../qemuargv2xml-misc-enable-s4.xml | 8 +- .../qemuargv2xml-misc-no-reboot.xml | 8 +- tests/qemuargv2xmldata/qemuargv2xml-misc-uuid.xml | 8 +- .../qemuargv2xml-net-eth-ifname.xml | 9 +- tests/qemuargv2xmldata/qemuargv2xml-net-eth.xml | 9 +- tests/qemuargv2xmldata/qemuargv2xml-net-user.xml | 9 +- tests/qemuargv2xmldata/qemuargv2xml-net-virtio.xml | 9 +- .../qemuargv2xml-nographics-vga.xml | 8 +- .../qemuargv2xmldata/qemuargv2xml-nosharepages.xml | 8 +- .../qemuargv2xmldata/qemuargv2xml-parallel-tcp.xml | 8 +- .../qemuargv2xmldata/qemuargv2xml-pseries-disk.xml | 5 +- .../qemuargv2xml-pseries-nvram.xml | 4 +- .../qemuargv2xml-qemu-ns-no-env.xml | 8 +- .../qemuargv2xml-reboot-timeout-disabled.xml | 4 +- .../qemuargv2xml-reboot-timeout-enabled.xml | 4 +- tests/qemuargv2xmldata/qemuargv2xml-restore-v2.xml | 8 +- tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml | 8 +- .../qemuargv2xmldata/qemuargv2xml-serial-file.xml | 8 +- .../qemuargv2xmldata/qemuargv2xml-serial-many.xml | 8 +- tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml | 8 +- .../qemuargv2xml-serial-tcp-telnet.xml | 8 +- tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml | 8 +- tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml | 8 +- .../qemuargv2xmldata/qemuargv2xml-serial-unix.xml | 8 +- tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml | 8 +- tests/qemuargv2xmldata/qemuargv2xml-smp.xml | 8 +- tests/qemuargv2xmldata/qemuargv2xml-sound.xml | 16 +- tests/qemuargv2xmldata/qemuargv2xml-watchdog.xml | 8 +- tests/qemuxml2argvtest.c | 2 +- 93 files changed, 688 insertions(+), 305 deletions(-) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 9c8c262..9d09b3a 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -1463,158 +1463,155 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, int ret = -1; virDomainPCIAddressSetPtr addrs = NULL; qemuDomainObjPrivatePtr priv = NULL; + int max_idx = -1; + int nbuses = 0; + size_t i; + int rv; + bool buses_reserved = true; - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - int max_idx = -1; - int nbuses = 0; - size_t i; - int rv; - bool buses_reserved = true; - - virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCI_DEVICE; + virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCI_DEVICE; - for (i = 0; i < def->ncontrollers; i++) { - if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) { - if ((int) def->controllers[i]->idx > max_idx) - max_idx = def->controllers[i]->idx; - } + for (i = 0; i < def->ncontrollers; i++) { + if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) { + if ((int) def->controllers[i]->idx > max_idx) + max_idx = def->controllers[i]->idx; } + } - nbuses = max_idx + 1; - - if (nbuses > 0 && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_BRIDGE)) { - virDomainDeviceInfo info; + nbuses = max_idx + 1; - /* 1st pass to figure out how many PCI bridges we need */ - if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, true))) - goto cleanup; + if (nbuses > 0 && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_BRIDGE)) { + virDomainDeviceInfo info; - if (qemuDomainValidateDevicePCISlotsChipsets(def, qemuCaps, - addrs) < 0) - goto cleanup; + /* 1st pass to figure out how many PCI bridges we need */ + if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, true))) + goto cleanup; - for (i = 0; i < addrs->nbuses; i++) { - if (!qemuDomainPCIBusFullyReserved(&addrs->buses[i])) - buses_reserved = false; - } + if (qemuDomainValidateDevicePCISlotsChipsets(def, qemuCaps, + addrs) < 0) + goto cleanup; - /* Reserve 1 extra slot for a (potential) bridge only if buses - * are not fully reserved yet - */ - if (!buses_reserved && - virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0) - goto cleanup; + for (i = 0; i < addrs->nbuses; i++) { + if (!qemuDomainPCIBusFullyReserved(&addrs->buses[i])) + buses_reserved = false; + } - if (qemuDomainAssignDevicePCISlots(def, qemuCaps, addrs) < 0) - goto cleanup; + /* Reserve 1 extra slot for a (potential) bridge only if buses + * are not fully reserved yet + */ + if (!buses_reserved && + virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0) + goto cleanup; - for (i = 1; i < addrs->nbuses; i++) { - virDomainPCIAddressBusPtr bus = &addrs->buses[i]; + if (qemuDomainAssignDevicePCISlots(def, qemuCaps, addrs) < 0) + goto cleanup; - if ((rv = virDomainDefMaybeAddController( - def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, - i, bus->model)) < 0) - goto cleanup; - /* If we added a new bridge, we will need one more address */ - if (rv > 0 && - virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0) - goto cleanup; - } - nbuses = addrs->nbuses; - virDomainPCIAddressSetFree(addrs); - addrs = NULL; + for (i = 1; i < addrs->nbuses; i++) { + virDomainPCIAddressBusPtr bus = &addrs->buses[i]; - } else if (max_idx > 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("PCI bridges are not supported " - "by this QEMU binary")); - goto cleanup; + if ((rv = virDomainDefMaybeAddController( + def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, + i, bus->model)) < 0) + goto cleanup; + /* If we added a new bridge, we will need one more address */ + if (rv > 0 && + virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0) + goto cleanup; } + nbuses = addrs->nbuses; + virDomainPCIAddressSetFree(addrs); + addrs = NULL; - if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, false))) - goto cleanup; + } else if (max_idx > 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("PCI bridges are not supported " + "by this QEMU binary")); + goto cleanup; + } - if (qemuDomainSupportsPCI(def, qemuCaps)) { - if (qemuDomainValidateDevicePCISlotsChipsets(def, qemuCaps, - addrs) < 0) - goto cleanup; + if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, false))) + goto cleanup; - if (qemuDomainAssignDevicePCISlots(def, qemuCaps, addrs) < 0) - goto cleanup; + if (qemuDomainSupportsPCI(def, qemuCaps)) { + if (qemuDomainValidateDevicePCISlotsChipsets(def, qemuCaps, + addrs) < 0) + goto cleanup; - for (i = 0; i < def->ncontrollers; i++) { - virDomainControllerDefPtr cont = def->controllers[i]; - int idx = cont->idx; - virPCIDeviceAddressPtr addr; - virDomainPCIControllerOptsPtr options; + if (qemuDomainAssignDevicePCISlots(def, qemuCaps, addrs) < 0) + goto cleanup; - if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_PCI) - continue; + for (i = 0; i < def->ncontrollers; i++) { + virDomainControllerDefPtr cont = def->controllers[i]; + int idx = cont->idx; + virPCIDeviceAddressPtr addr; + virDomainPCIControllerOptsPtr options; - addr = &cont->info.addr.pci; - options = &cont->opts.pciopts; + if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_PCI) + continue; - /* set default model name (the actual name of the - * device in qemu) for any controller that doesn't yet - * have it set. - */ - qemuDomainPCIControllerSetDefaultModelName(cont); + addr = &cont->info.addr.pci; + options = &cont->opts.pciopts; - /* set defaults for any other auto-generated config - * options for this controller that haven't been - * specified in config. - */ - switch ((virDomainControllerModelPCI)cont->model) { - case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: - if (options->chassisNr == -1) - options->chassisNr = cont->idx; - break; - case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: - if (options->chassis == -1) - options->chassis = cont->idx; - if (options->port == -1) - options->port = (addr->slot << 3) + addr->function; - break; - case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: - if (options->chassis == -1) - options->chassis = cont->idx; - if (options->port == -1) - options->port = addr->slot; - break; - case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: - case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: - if (options->busNr == -1) - options->busNr = qemuDomainAddressFindNewBusNr(def); - if (options->busNr == -1) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("No free busNr lower than current " - "lowest busNr is available to " - "auto-assign to bus %d. Must be " - "manually assigned"), - addr->bus); - goto cleanup; - } - break; - case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: - case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: - case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: - case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: - case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: - break; - } + /* set default model name (the actual name of the + * device in qemu) for any controller that doesn't yet + * have it set. + */ + qemuDomainPCIControllerSetDefaultModelName(cont); - /* check if every PCI bridge controller's ID is greater than - * the bus it is placed onto - */ - if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE && - idx <= addr->bus) { + /* set defaults for any other auto-generated config + * options for this controller that haven't been + * specified in config. + */ + switch ((virDomainControllerModelPCI)cont->model) { + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: + if (options->chassisNr == -1) + options->chassisNr = cont->idx; + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: + if (options->chassis == -1) + options->chassis = cont->idx; + if (options->port == -1) + options->port = (addr->slot << 3) + addr->function; + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: + if (options->chassis == -1) + options->chassis = cont->idx; + if (options->port == -1) + options->port = addr->slot; + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: + if (options->busNr == -1) + options->busNr = qemuDomainAddressFindNewBusNr(def); + if (options->busNr == -1) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("PCI controller at index %d (0x%02x) has " - "bus='0x%02x', but bus must be <= index"), - idx, idx, addr->bus); + _("No free busNr lower than current " + "lowest busNr is available to " + "auto-assign to bus %d. Must be " + "manually assigned"), + addr->bus); goto cleanup; } + break; + case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: + break; + } + + /* check if every PCI bridge controller's ID is greater than + * the bus it is placed onto + */ + if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE && + idx <= addr->bus) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("PCI controller at index %d (0x%02x) has " + "bus='0x%02x', but bus must be <= index"), + idx, idx, addr->bus); + goto cleanup; } } } @@ -1681,7 +1678,6 @@ qemuDomainReleaseDeviceAddress(virDomainObjPtr vm, VIR_WARN("Unable to release CCW address on %s", NULLSTR(devstr)); else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && - virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && virDomainPCIAddressReleaseSlot(priv->pciaddrs, &info->addr.pci) < 0) VIR_WARN("Unable to release PCI address on %s", diff --git a/tests/domainsnapshotxml2xmlout/disk_snapshot_redefine.xml b/tests/domainsnapshotxml2xmlout/disk_snapshot_redefine.xml index eb7f567..297ca7f 100644 --- a/tests/domainsnapshotxml2xmlout/disk_snapshot_redefine.xml +++ b/tests/domainsnapshotxml2xmlout/disk_snapshot_redefine.xml @@ -70,12 +70,18 @@ <target dev='hdf' bus='ide'/> <address type='drive' controller='0' bus='5' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> - <controller type='ide' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </memballoon> </devices> </domain> <active>1</active> diff --git a/tests/domainsnapshotxml2xmlout/external_vm_redefine.xml b/tests/domainsnapshotxml2xmlout/external_vm_redefine.xml index e8e4640..e2e7a40 100644 --- a/tests/domainsnapshotxml2xmlout/external_vm_redefine.xml +++ b/tests/domainsnapshotxml2xmlout/external_vm_redefine.xml @@ -35,12 +35,18 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> - <controller type='ide' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </memballoon> </devices> </domain> </domainsnapshot> diff --git a/tests/domainsnapshotxml2xmlout/full_domain.xml b/tests/domainsnapshotxml2xmlout/full_domain.xml index 7d70a11..0b0b7e0 100644 --- a/tests/domainsnapshotxml2xmlout/full_domain.xml +++ b/tests/domainsnapshotxml2xmlout/full_domain.xml @@ -28,12 +28,18 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> - <controller type='ide' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </memballoon> </devices> </domain> <active>1</active> diff --git a/tests/domainsnapshotxml2xmlout/metadata.xml b/tests/domainsnapshotxml2xmlout/metadata.xml index 9a2c24f..f0d8d07 100644 --- a/tests/domainsnapshotxml2xmlout/metadata.xml +++ b/tests/domainsnapshotxml2xmlout/metadata.xml @@ -32,12 +32,18 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> - <controller type='ide' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> - <memballoon model='virtio'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </memballoon> </devices> </domain> </domainsnapshot> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-boot-cdrom.xml b/tests/qemuargv2xmldata/qemuargv2xml-boot-cdrom.xml index 5bcc1a7..f4a471a 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-boot-cdrom.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-boot-cdrom.xml @@ -21,9 +21,13 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-boot-floppy.xml b/tests/qemuargv2xmldata/qemuargv2xml-boot-floppy.xml index a507558..9bf4414 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-boot-floppy.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-boot-floppy.xml @@ -26,10 +26,14 @@ <target dev='fda' bus='fdc'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <controller type='fdc' index='0'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-boot-network.xml b/tests/qemuargv2xmldata/qemuargv2xml-boot-network.xml index d060da6..b7e5dde 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-boot-network.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-boot-network.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-clock-localtime.xml b/tests/qemuargv2xmldata/qemuargv2xml-clock-localtime.xml index 7ffdb97..b039541 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-clock-localtime.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-clock-localtime.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-clock-utc.xml b/tests/qemuargv2xmldata/qemuargv2xml-clock-utc.xml index ecefafa..9beaf06 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-clock-utc.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-clock-utc.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml b/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml index 3768715..5a17374 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <serial type='pty'> <target port='0'/> </serial> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom-empty.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom-empty.xml index aaa7e32..ea7653b 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom-empty.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom-empty.xml @@ -26,9 +26,13 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom.xml index 146f453..f8a7c77 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-cdrom.xml @@ -27,9 +27,13 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-cdrom.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-cdrom.xml index 2984763..12d27d6 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-cdrom.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-cdrom.xml @@ -27,9 +27,13 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-disk.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-disk.xml index 40ffdfc..ab7a9ed 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-disk.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-boot-disk.xml @@ -27,9 +27,13 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-directsync.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-directsync.xml index 5a12671..08198f5 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-directsync.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-directsync.xml @@ -27,9 +27,13 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-unsafe.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-unsafe.xml index a6215bc..544524b 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-unsafe.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-unsafe.xml @@ -27,9 +27,13 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-none.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-none.xml index 8064075..70c5576 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-none.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-none.xml @@ -27,9 +27,13 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wb.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wb.xml index 92d6250..8ee2360 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wb.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wb.xml @@ -27,9 +27,13 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wt.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wt.xml index 0ce3530..a18fda7 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wt.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-cache-v2-wt.xml @@ -27,9 +27,13 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-enospace.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-enospace.xml index 59b9262..38f3877 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-enospace.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-enospace.xml @@ -27,9 +27,13 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-stop.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-stop.xml index 8be911e..f3afc3f 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-stop.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-stop.xml @@ -27,9 +27,13 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-wreport-rignore.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-wreport-rignore.xml index fade9b6..d8eefcb 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-wreport-rignore.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-error-policy-wreport-rignore.xml @@ -27,9 +27,13 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-fmt-qcow.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-fmt-qcow.xml index a904719..d14710f 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-fmt-qcow.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-fmt-qcow.xml @@ -27,9 +27,13 @@ <readonly/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.xml index 0c66e7f..160fd9d 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-gluster.xml @@ -20,6 +20,7 @@ <host name='example.org' port='6000'/> </source> <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> <disk type='network' device='disk'> <driver name='qemu' type='raw'/> @@ -27,8 +28,11 @@ <host transport='unix' socket='/path/to/sock'/> </source> <target dev='vdb' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi-auth.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi-auth.xml index b5f948b..36da19e 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi-auth.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi-auth.xml @@ -23,6 +23,7 @@ <host name='example.org' port='6000'/> </source> <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> <disk type='network' device='disk'> <driver name='qemu' type='raw'/> @@ -30,8 +31,11 @@ <host name='example.org' port='6000'/> </source> <target dev='vdb' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi.xml index 31fc9f2..05c7315 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi.xml @@ -20,6 +20,7 @@ <host name='example.org' port='6000'/> </source> <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> <disk type='network' device='disk'> <driver name='qemu' type='raw'/> @@ -27,8 +28,11 @@ <host name='example.org' port='6000'/> </source> <target dev='vdb' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-export.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-export.xml index 8f50481..74ec758 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-export.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-export.xml @@ -26,10 +26,15 @@ <host name='example.org' port='6000'/> </source> <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6-export.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6-export.xml index a0557e0..25a4fb8 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6-export.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6-export.xml @@ -26,10 +26,15 @@ <host name='::1' port='6000'/> </source> <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6.xml index 2828249..979caf5 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-ipv6.xml @@ -26,10 +26,15 @@ <host name='::1' port='6000'/> </source> <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-unix.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-unix.xml index 1a315b7..fc08eb3 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-unix.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd-unix.xml @@ -26,10 +26,15 @@ <host transport='unix' socket='/var/run/nbdsock'/> </source> <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd.xml index feae85d..9c2e959 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-nbd.xml @@ -26,10 +26,15 @@ <host name='example.org' port='6000'/> </source> <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-auth.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-auth.xml index bf82750..c3ef946 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-auth.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-auth.xml @@ -31,10 +31,15 @@ <host name='mon3.example.org' port='6322'/> </source> <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ceph-env.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ceph-env.xml index afa11ec..928a30c 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ceph-env.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ceph-env.xml @@ -28,10 +28,15 @@ <host name='mon3.example.org' port='6322'/> </source> <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ipv6.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ipv6.xml index 7f73472..331b6b9 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ipv6.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-ipv6.xml @@ -29,10 +29,15 @@ <host name='2001:db8::ff00:42:8329' port='6322'/> </source> <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd.xml index d605aac..fd4e505 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd.xml @@ -28,6 +28,7 @@ <host name='mon3.example.org' port='6322'/> </source> <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> <disk type='network' device='disk'> <driver name='qemu' type='raw'/> @@ -35,6 +36,7 @@ <snapshot name='asdf'/> </source> <target dev='vdb' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> <disk type='network' device='disk'> <driver name='qemu' type='raw'/> @@ -45,6 +47,7 @@ <snapshot name='foo'/> </source> <target dev='vdc' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </disk> <disk type='network' device='disk'> <driver name='qemu' type='raw'/> @@ -53,10 +56,15 @@ <config file='/blah/test.conf'/> </source> <target dev='vdd' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-sheepdog.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-sheepdog.xml index 5868d5b..0f789e2 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-sheepdog.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-sheepdog.xml @@ -26,10 +26,15 @@ <host name='example.org' port='6000'/> </source> <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-floppy.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-floppy.xml index 85f8b41..ff31982 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-floppy.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-floppy.xml @@ -32,10 +32,14 @@ <target dev='fdb' bus='fdc'/> <address type='drive' controller='0' bus='0' target='0' unit='1'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <controller type='fdc' index='0'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-many.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-many.xml index 8ce58e3..834708c 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-many.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-many.xml @@ -38,9 +38,13 @@ <target dev='hdd' bus='ide'/> <address type='drive' controller='0' bus='1' target='0' unit='1'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-usb.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-usb.xml index 729c3c0..8bf3990 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-usb.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-usb.xml @@ -25,9 +25,13 @@ <source file='/tmp/usbdisk.img'/> <target dev='sda' bus='usb'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-virtio.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-virtio.xml index 9889132..fb8ab06 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-virtio.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-virtio.xml @@ -31,15 +31,21 @@ <driver name='qemu' type='raw'/> <source file='/tmp/data.img'/> <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/tmp/logs.img'/> <target dev='vdb' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-xenvbd.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-xenvbd.xml index 2fe02f9..17c5e2c 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-xenvbd.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-xenvbd.xml @@ -37,9 +37,13 @@ <source file='/tmp/logs.img'/> <target dev='xvdg' bus='xen'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl-fullscreen.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl-fullscreen.xml index 0bc0436..5ff9913 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl-fullscreen.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl-fullscreen.xml @@ -20,14 +20,19 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority' fullscreen='yes'/> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl.xml index 7cd9d6c..f99a829 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-sdl.xml @@ -20,14 +20,19 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'/> <video> <model type='vga' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-policy.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-policy.xml index 3ebb375..eaf6997 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-policy.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-policy.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='65530' autoport='no' listen='::' sharePolicy='allow-exclusive'> @@ -30,6 +34,7 @@ </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-sasl.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-sasl.xml index 5b7d560..7f66e5e 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-sasl.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-sasl.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'> @@ -30,6 +34,7 @@ </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-socket.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-socket.xml index 93daa76..edbaab3 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-socket.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-socket.xml @@ -20,14 +20,19 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' socket='/tmp/foo.socket'/> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-tls.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-tls.xml index 5b7d560..7f66e5e 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-tls.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-tls.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'> @@ -30,6 +34,7 @@ </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-websocket.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-websocket.xml index 260ad1c..bafbcc2 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-websocket.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc-websocket.xml @@ -14,7 +14,9 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu</emulator> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> @@ -23,6 +25,7 @@ </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml index 374345b..430d440 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5903' autoport='no' listen='2001:1:2:3:4:5:1234:1234'> @@ -30,6 +34,7 @@ </graphics> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-hostdev-pci-address.xml b/tests/qemuargv2xmldata/qemuargv2xml-hostdev-pci-address.xml index 99cc9d7..111f659 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-hostdev-pci-address.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-hostdev-pci-address.xml @@ -20,15 +20,20 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <hostdev mode='subsystem' type='pci' managed='yes'> <source> <address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/> </source> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </hostdev> <memballoon model='none'/> </devices> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-hostdev-usb-address.xml b/tests/qemuargv2xmldata/qemuargv2xml-hostdev-usb-address.xml index ddc95d7..d4a3f41 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-hostdev-usb-address.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-hostdev-usb-address.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <hostdev mode='subsystem' type='usb' managed='no'> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-hyperv-panic.xml b/tests/qemuargv2xmldata/qemuargv2xml-hyperv-panic.xml index e549e05..c71c65d 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-hyperv-panic.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-hyperv-panic.xml @@ -17,7 +17,9 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu</emulator> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-hyperv.xml b/tests/qemuargv2xmldata/qemuargv2xml-hyperv.xml index 5a19af0..53ce642 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-hyperv.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-hyperv.xml @@ -22,7 +22,9 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu</emulator> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-input-usbmouse.xml b/tests/qemuargv2xmldata/qemuargv2xml-input-usbmouse.xml index 5a3a9e6..83aeb03 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-input-usbmouse.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-input-usbmouse.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='usb'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-input-usbtablet.xml b/tests/qemuargv2xmldata/qemuargv2xml-input-usbtablet.xml index 0b9c242..cf1a018 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-input-usbtablet.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-input-usbtablet.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-kvm-features.xml b/tests/qemuargv2xmldata/qemuargv2xml-kvm-features.xml index 840e3e2..3f21de3 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-kvm-features.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-kvm-features.xml @@ -20,7 +20,9 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu</emulator> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-kvmclock.xml b/tests/qemuargv2xmldata/qemuargv2xml-kvmclock.xml index ae8ccc9..888dd9e 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-kvmclock.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-kvmclock.xml @@ -19,7 +19,9 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/kvm</emulator> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-machine-core-off.xml b/tests/qemuargv2xmldata/qemuargv2xml-machine-core-off.xml index 84ebc9b..13c4ffe 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-machine-core-off.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-machine-core-off.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-machine-core-on.xml b/tests/qemuargv2xmldata/qemuargv2xml-machine-core-on.xml index b0d7454..05da1dc 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-machine-core-on.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-machine-core-on.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-migrate.xml b/tests/qemuargv2xmldata/qemuargv2xml-migrate.xml index ecefafa..9beaf06 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-migrate.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-migrate.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-acpi.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-acpi.xml index 397615c..3752878 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-misc-acpi.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-acpi.xml @@ -23,9 +23,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-s3.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-s3.xml index 546e48f..9c08695 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-s3.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-s3.xml @@ -23,9 +23,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-suspends.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-suspends.xml index 7ab1c73..1697d00 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-suspends.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-suspends.xml @@ -24,9 +24,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-enable-s4.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-enable-s4.xml index 2bc8875..5d9148f 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-misc-enable-s4.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-enable-s4.xml @@ -23,9 +23,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-no-reboot.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-no-reboot.xml index e14536b..0456fa1 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-misc-no-reboot.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-no-reboot.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-uuid.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-uuid.xml index 397615c..3752878 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-misc-uuid.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-uuid.xml @@ -23,9 +23,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-net-eth-ifname.xml b/tests/qemuargv2xmldata/qemuargv2xml-net-eth-ifname.xml index e9c0378..113bd19 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-net-eth-ifname.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-net-eth-ifname.xml @@ -20,14 +20,19 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <interface type='ethernet'> <mac address='00:11:22:33:44:55'/> <script path='/etc/qemu-ifup'/> <target dev='nic02'/> <model type='rtl8139'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-net-eth.xml b/tests/qemuargv2xmldata/qemuargv2xml-net-eth.xml index 96ad0a8..54194d7 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-net-eth.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-net-eth.xml @@ -20,13 +20,18 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <interface type='ethernet'> <mac address='00:11:22:33:44:55'/> <script path='/etc/qemu-ifup'/> <model type='rtl8139'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-net-user.xml b/tests/qemuargv2xmldata/qemuargv2xml-net-user.xml index 7dd1cfe..133f5f1 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-net-user.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-net-user.xml @@ -20,12 +20,17 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <interface type='user'> <mac address='00:11:22:33:44:55'/> <model type='rtl8139'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-net-virtio.xml b/tests/qemuargv2xmldata/qemuargv2xml-net-virtio.xml index db033eb..7d8ff10 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-net-virtio.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-net-virtio.xml @@ -20,12 +20,17 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <interface type='user'> <mac address='00:11:22:33:44:55'/> <model type='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-nographics-vga.xml b/tests/qemuargv2xmldata/qemuargv2xml-nographics-vga.xml index ecefafa..9beaf06 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-nographics-vga.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-nographics-vga.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-nosharepages.xml b/tests/qemuargv2xmldata/qemuargv2xml-nosharepages.xml index 3b95c6e..b627d70 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-nosharepages.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-nosharepages.xml @@ -23,9 +23,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-parallel-tcp.xml b/tests/qemuargv2xmldata/qemuargv2xml-parallel-tcp.xml index 0bb1f3a..e4c4437 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-parallel-tcp.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-parallel-tcp.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <parallel type='tcp'> <source mode='bind' host='127.0.0.1' service='9999'/> <protocol type='raw'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml b/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml index ab9195a..1bad8ee 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml @@ -27,7 +27,9 @@ <readonly/> <address type='drive' controller='0' bus='0' target='0' unit='2'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <controller type='scsi' index='0'> <address type='spapr-vio' reg='0x2000'/> @@ -37,6 +39,7 @@ <graphics type='sdl'/> <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> <panic model='pseries'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml b/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml index eafe49d..7e9f864 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml @@ -14,7 +14,9 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-ppc64</emulator> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <memballoon model='none'/> <nvram> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-qemu-ns-no-env.xml b/tests/qemuargv2xmldata/qemuargv2xml-qemu-ns-no-env.xml index 98df80e..5d67117 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-qemu-ns-no-env.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-qemu-ns-no-env.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-disabled.xml b/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-disabled.xml index 29ddd9f..21654d7 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-disabled.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-disabled.xml @@ -15,7 +15,9 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu</emulator> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-enabled.xml b/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-enabled.xml index 1d7f6f1..dd0b7d8 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-enabled.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-reboot-timeout-enabled.xml @@ -15,7 +15,9 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu</emulator> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-restore-v2.xml b/tests/qemuargv2xmldata/qemuargv2xml-restore-v2.xml index ecefafa..9beaf06 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-restore-v2.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-restore-v2.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml index b80218b..eb46e9f 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <serial type='dev'> <source path='/dev/ttyS2'/> <target port='0'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml index 90182a8..be03983 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <serial type='file'> <source path='/tmp/serial.log'/> <target port='0'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml index e8a628a..82737e4 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <serial type='pty'> <target port='0'/> </serial> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml index 3768715..5a17374 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <serial type='pty'> <target port='0'/> </serial> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml index ca625a0..316b9c4 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <serial type='tcp'> <source mode='bind' host='127.0.0.1' service='9999'/> <protocol type='telnet'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml index c747dde..492679a 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <serial type='tcp'> <source mode='connect' host='127.0.0.1' service='9999'/> <protocol type='raw'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml index 1187e2a..31a34ca 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <serial type='udp'> <source mode='bind' host='127.0.0.1' service='9999'/> <source mode='connect' host='127.0.0.1' service='9998'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml index 8734c75..5a15fc7 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <serial type='unix'> <source mode='connect' path='/tmp/serial.sock'/> <target port='0'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml index 11575b7..8dca851 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <serial type='vc'> <target port='0'/> </serial> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-smp.xml b/tests/qemuargv2xmldata/qemuargv2xml-smp.xml index 1a4ada1..1a52569 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-smp.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-smp.xml @@ -23,9 +23,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='none'/> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-sound.xml b/tests/qemuargv2xmldata/qemuargv2xml-sound.xml index 0557f61..6d60d1e 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-sound.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-sound.xml @@ -20,15 +20,23 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <sound model='pcspk'/> - <sound model='es1370'/> + <sound model='es1370'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </sound> <sound model='sb16'/> - <sound model='ac97'/> + <sound model='ac97'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </sound> <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuargv2xmldata/qemuargv2xml-watchdog.xml b/tests/qemuargv2xmldata/qemuargv2xml-watchdog.xml index 757ac86..29e1b0c 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-watchdog.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-watchdog.xml @@ -20,9 +20,13 @@ <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='ide' index='0'/> + <controller type='ide' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <watchdog model='ib700' action='poweroff'/> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 840efc9..a83102d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1563,7 +1563,7 @@ mymain(void) QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL); DO_TEST_PARSE_ERROR("440fx-wrong-root", NONE); - DO_TEST_FAILURE("pcie-root-port-too-many", + DO_TEST_PARSE_ERROR("pcie-root-port-too-many", QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420, -- 2.7.4

On Sat, 2016-05-14 at 17:39 -0400, Cole Robinson wrote:
All qemu versions we support have QEMU_CAPS_DEVICE, so checking for it is redundant. Remove the usage. The code diff isn't clear, but all that code is just inindented with no other change.
'git show -w' is your friend ;) This information, however, should probably be moved out of the commit message and after the '---' separator.
Test cases that hit qemuDomainAssignAddresses but don't have infrastructure for specifying qemuCaps values see lots of churn, since now PCI addresses are in the XML output.
So, I want to make sure I'm getting this right: the addresses should have been there in the first place, and would be if we were processing the input files in the real world, outside of the test suite; however, since the addresses being there depend on QEMU_CAPS_DEVICE, and some test cases run with an empty virQEMUCaps, they never appeared until we got rid of the check on QEMU_CAPS_DEVICE. ACK if the above makes sense. -- Andrea Bolognani Software Engineer - Virtualization Team

On 05/18/2016 06:27 AM, Andrea Bolognani wrote:
On Sat, 2016-05-14 at 17:39 -0400, Cole Robinson wrote:
All qemu versions we support have QEMU_CAPS_DEVICE, so checking for it is redundant. Remove the usage.
The code diff isn't clear, but all that code is just inindented with no other change.
'git show -w' is your friend ;)
This information, however, should probably be moved out of the commit message and after the '---' separator.
Test cases that hit qemuDomainAssignAddresses but don't have infrastructure for specifying qemuCaps values see lots of churn, since now PCI addresses are in the XML output.
So, I want to make sure I'm getting this right: the addresses should have been there in the first place, and would be if we were processing the input files in the real world, outside of the test suite; however, since the addresses being there depend on QEMU_CAPS_DEVICE, and some test cases run with an empty virQEMUCaps, they never appeared until we got rid of the check on QEMU_CAPS_DEVICE.
ACK if the above makes sense.
Kind of. Prior to patch #2, the test suite output was correct (no addresses), it's what we were returning via domxml-from-native. After patch #2, the test suite output was wrong for all real world usage; it didn't change because it was only hitting a !QEMU_CAPS_DEVICE code path So the potentially contentious bit is that patch #2 changes domxml-from-native output to contain addresses, however that's exactly the same result that will happen when the XML would eventually be defined anyways, so it's effectively the same result as pre-patch #2 anyways. If we think of domxml-from-native as telling the user 'this is exactly what libvirt thinks that command line is' then we are now giving more accurate results Let me know if that still warrants the ACK Thanks, Cole

On 05/18/2016 07:53 AM, Cole Robinson wrote:
Kind of. Prior to patch #2, the test suite output was correct (no addresses), it's what we were returning via domxml-from-native. After patch #2, the test suite output was wrong for all real world usage; it didn't change because it was only hitting a !QEMU_CAPS_DEVICE code path
So the potentially contentious bit is that patch #2 changes domxml-from-native output to contain addresses, however that's exactly the same result that will happen when the XML would eventually be defined anyways, so it's effectively the same result as pre-patch #2 anyways. If we think of domxml-from-native as telling the user 'this is exactly what libvirt thinks that command line is' then we are now giving more accurate results
Let me know if that still warrants the ACK
My opinion is that this is a change for the better. While it is true that this could lead to XML that potentially shows different PCI addresses than what would have been auto-assigned by qemu when presented with the original commandline, it *is* showing the addresses that would be auto-allocated by libvirt if you had fed the "un-addressified" XML to libvirt - so at least the user will get a warning rather than being surprised at runtime. And it's not as if the output of domxml-from-native has ever produced anything even close to the correct XML in any real world situation. (dreadkopp in public #virt pastebin'ed an example last night - 90% of it was translated directly into <qemu:arg> elements).

On Wed, 2016-05-18 at 09:58 -0400, Laine Stump wrote:
On 05/18/2016 07:53 AM, Cole Robinson wrote:
Kind of. Prior to patch #2, the test suite output was correct (no addresses), it's what we were returning via domxml-from-native. After patch #2, the test suite output was wrong for all real world usage; it didn't change because it was only hitting a !QEMU_CAPS_DEVICE code path
So the potentially contentious bit is that patch #2 changes domxml-from-native output to contain addresses, however that's exactly the same result that will happen when the XML would eventually be defined anyways, so it's effectively the same result as pre-patch #2 anyways. If we think of domxml-from-native as telling the user 'this is exactly what libvirt thinks that command line is' then we are now giving more accurate results
Let me know if that still warrants the ACK
My opinion is that this is a change for the better. While it is true that this could lead to XML that potentially shows different PCI addresses than what would have been auto-assigned by qemu when presented with the original commandline, it *is* showing the addresses that would be auto-allocated by libvirt if you had fed the "un-addressified" XML to libvirt - so at least the user will get a warning rather than being surprised at runtime. And it's not as if the output of domxml-from-native has ever produced anything even close to the correct XML in any real world situation. (dreadkopp in public #virt pastebin'ed an example last night - 90% of it was translated directly into <qemu:arg> elements).
After reading Cole's explanation, I tend to agree. So I guess we can go ahead and merge this, as well as 5/4 :) -- Andrea Bolognani Software Engineer - Virtualization Team

On 05/18/2016 10:59 AM, Andrea Bolognani wrote:
On Wed, 2016-05-18 at 09:58 -0400, Laine Stump wrote:
On 05/18/2016 07:53 AM, Cole Robinson wrote:
Kind of. Prior to patch #2, the test suite output was correct (no addresses), it's what we were returning via domxml-from-native. After patch #2, the test suite output was wrong for all real world usage; it didn't change because it was only hitting a !QEMU_CAPS_DEVICE code path
So the potentially contentious bit is that patch #2 changes domxml-from-native output to contain addresses, however that's exactly the same result that will happen when the XML would eventually be defined anyways, so it's effectively the same result as pre-patch #2 anyways. If we think of domxml-from-native as telling the user 'this is exactly what libvirt thinks that command line is' then we are now giving more accurate results
Let me know if that still warrants the ACK
My opinion is that this is a change for the better. While it is true that this could lead to XML that potentially shows different PCI addresses than what would have been auto-assigned by qemu when presented with the original commandline, it *is* showing the addresses that would be auto-allocated by libvirt if you had fed the "un-addressified" XML to libvirt - so at least the user will get a warning rather than being surprised at runtime. And it's not as if the output of domxml-from-native has ever produced anything even close to the correct XML in any real world situation. (dreadkopp in public #virt pastebin'ed an example last night - 90% of it was translated directly into <qemu:arg> elements).
After reading Cole's explanation, I tend to agree.
So I guess we can go ahead and merge this, as well as 5/4 :)
Thanks pushed now with your suggested changes, except the bits I just mailed about - Cole

On Sat, 2016-05-14 at 17:39 -0400, Cole Robinson wrote:
Upcoming patches are going to make the disk portion of these test cases fail. In order to make it work, we would need to extend the qemuargv2xml test infrastructure to handle qemuCaps. This is worthwhile to do at some point but isn't critical.
Instead just drop the offending portion, which isn't even the target of the test cases anyways --- tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-off-argv.args | 4 +--- tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-off-argv.xml | 5 ----- tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-on-argv.args | 4 +--- tests/qemuargv2xmldata/qemuargv2xml-machine-aeskeywrap-on-argv.xml | 5 ----- tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-off-argv.args | 4 +--- tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-off-argv.xml | 5 ----- tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-on-argv.args | 4 +--- tests/qemuargv2xmldata/qemuargv2xml-machine-deakeywrap-on-argv.xml | 5 ----- tests/qemuargv2xmldata/qemuargv2xml-machine-keywrap-none-argv.args | 4 +--- tests/qemuargv2xmldata/qemuargv2xml-machine-keywrap-none-argv.xml | 5 ----- 10 files changed, 5 insertions(+), 40 deletions(-)
ACK if my explanation in 6/4 was correct. -- Andrea Bolognani Software Engineer - Virtualization Team
participants (3)
-
Andrea Bolognani
-
Cole Robinson
-
Laine Stump