[libvirt] [PATCH v2 0/2] qemu: Guarantee correct ordering for controllers

Changes from [v1] * ensure the controllers are ordered correctly from the moment they are added to the guest configuration rather than waiting for the QEMU command line to be generated. [v1] https://www.redhat.com/archives/libvir-list/2017-September/msg00084.html Andrea Bolognani (2): conf: Add USB companion controllers with virDomainControllerInsert() conf: Add all controllers using virDomainControllerInsert() src/conf/domain_conf.c | 61 +++++++++++++++------- .../qemuxml2argv-channel-virtio-default.args | 2 +- .../qemuxml2argv-channel-virtio-unix.args | 2 +- .../qemuxml2argv-chardev-reconnect.args | 2 +- .../qemuxml2argv-pci-autoadd-idx.args | 16 +++--- .../qemuxml2argv-pseries-many-buses-2.args | 4 +- .../qemuxml2xmlout-aarch64-virtio-pci-default.xml | 6 +-- ...2xmlout-aarch64-virtio-pci-manual-addresses.xml | 6 +-- .../qemuxml2xmlout-channel-virtio-auto.xml | 2 +- ...qemuxml2xmlout-hostdev-scsi-autogen-address.xml | 6 +-- .../qemuxml2xmlout-pci-autoadd-idx.xml | 22 ++++---- .../qemuxml2xmlout-pseries-many-buses-2.xml | 6 +-- .../qemuxml2xmlout-pseries-phb-default-missing.xml | 8 +-- 13 files changed, 82 insertions(+), 61 deletions(-) -- 2.13.5

virDomainDefAddController() is very convenient, but it is only passed a limited number of information about the controller. When adding USB controllers, knowing whether the controller is a master or a companion is important because it can influence the order devices show up on the QEMU command line, and ultimately whether the guest can be started at all. To make sure USB controllers will always be sorted correctly, allocate the virDomainControllerDef structure explicitly, fill in the relevant information manually and call virDomainControllerInsert() directly. Clean up both virDomainDefAddUSBController() itself and virDomainDefAddController() while at it. The behavior is not altered, as evidenced by the lack of updates to the test suite. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/conf/domain_conf.c | 61 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2fc1fc340..b1b9d161c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16837,7 +16837,7 @@ virDomainDefAddController(virDomainDefPtr def, int type, int idx, int model) virDomainControllerDefPtr cont; if (!(cont = virDomainControllerDefNew(type))) - return NULL; + goto error; if (idx < 0) idx = virDomainControllerFindUnusedIndex(def, type); @@ -16845,12 +16845,14 @@ virDomainDefAddController(virDomainDefPtr def, int type, int idx, int model) cont->idx = idx; cont->model = model; - if (VIR_APPEND_ELEMENT_COPY(def->controllers, def->ncontrollers, cont) < 0) { - VIR_FREE(cont); - return NULL; - } + if (VIR_APPEND_ELEMENT_COPY(def->controllers, def->ncontrollers, cont) < 0) + goto error; return cont; + + error: + virDomainControllerDefFree(cont); + return NULL; } @@ -16870,15 +16872,14 @@ virDomainDefAddController(virDomainDefPtr def, int type, int idx, int model) int virDomainDefAddUSBController(virDomainDefPtr def, int idx, int model) { - virDomainControllerDefPtr cont; /* this is a *copy* of the DefPtr */ + virDomainControllerDefPtr cont; - cont = virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, - idx, model); - if (!cont) - return -1; + if (!(cont = virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, + idx, model))) + goto error; if (model != VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1) - return 0; + goto done; /* When the initial controller is ich9-usb-ehci, also add the * companion controllers @@ -16886,25 +16887,45 @@ virDomainDefAddUSBController(virDomainDefPtr def, int idx, int model) idx = cont->idx; /* in case original request was "-1" */ - if (!(cont = virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, - idx, VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1))) - return -1; + if (!(cont = virDomainControllerDefNew(VIR_DOMAIN_CONTROLLER_TYPE_USB))) + goto error; + + cont->idx = idx; + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1; cont->info.mastertype = VIR_DOMAIN_CONTROLLER_MASTER_USB; cont->info.master.usb.startport = 0; - if (!(cont = virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, - idx, VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2))) - return -1; + if (virDomainControllerInsert(def, cont) < 0) + goto error; + + if (!(cont = virDomainControllerDefNew(VIR_DOMAIN_CONTROLLER_TYPE_USB))) + goto error; + + cont->idx = idx; + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2; cont->info.mastertype = VIR_DOMAIN_CONTROLLER_MASTER_USB; cont->info.master.usb.startport = 2; - if (!(cont = virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, - idx, VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3))) - return -1; + if (virDomainControllerInsert(def, cont) < 0) + goto error; + + if (!(cont = virDomainControllerDefNew(VIR_DOMAIN_CONTROLLER_TYPE_USB))) + goto error; + + cont->idx = idx; + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3; cont->info.mastertype = VIR_DOMAIN_CONTROLLER_MASTER_USB; cont->info.master.usb.startport = 4; + if (virDomainControllerInsert(def, cont) < 0) + goto error; + + done: return 0; + + error: + virDomainControllerDefFree(cont); + return -1; } -- 2.13.5

On 09/07/2017 01:00 PM, Andrea Bolognani wrote:
virDomainDefAddController() is very convenient, but it is only passed a limited number of information about the controller.
When adding USB controllers, knowing whether the controller is a master or a companion is important because it can influence the order devices show up on the QEMU command line, and ultimately whether the guest can be started at all.
After reading this, I was expecting that virDomainDefAddController() was going to get new args. But what we really got was a cleanup of virDomainDefAddController() that doesn't change its behavior, and a modification to virDomainDevAddUSBController() that avoids calling virDomainDefAddController() when it's adding a USB2 controller. Nothing wrong with that, I was just surprised :-) BTW, did you figure out a way that a bug could be experienced without this change, or is this all theoretical?
To make sure USB controllers will always be sorted correctly, allocate the virDomainControllerDef structure explicitly, fill in the relevant information manually and call virDomainControllerInsert() directly.
Maybe you could spell out more explicitly that you're replacing calls to virDomainDefAddController() with [blah blah], so it's easier for dense people like me to pick up on what's happening.
Clean up both virDomainDefAddUSBController() itself and virDomainDefAddController() while at it.
The cleanup of virDomainDefAddController seems unrelated to the change to virDomainDevAddUSBController() (since it is eliminating calls to virDomainDefAddController()). I'm debating whether or not it's worth asking you to split those two things into separate patches - that would have made it quicker for me to figure out what was being done, but that's all water under the bridge now, so it would just be creating work for you for no real gain.
The behavior is not altered, as evidenced by the lack of updates to the test suite.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/conf/domain_conf.c | 61 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 20 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2fc1fc340..b1b9d161c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16837,7 +16837,7 @@ virDomainDefAddController(virDomainDefPtr def, int type, int idx, int model) virDomainControllerDefPtr cont;
if (!(cont = virDomainControllerDefNew(type))) - return NULL; + goto error;
if (idx < 0) idx = virDomainControllerFindUnusedIndex(def, type); @@ -16845,12 +16845,14 @@ virDomainDefAddController(virDomainDefPtr def, int type, int idx, int model) cont->idx = idx; cont->model = model;
- if (VIR_APPEND_ELEMENT_COPY(def->controllers, def->ncontrollers, cont) < 0) { - VIR_FREE(cont); - return NULL; - } + if (VIR_APPEND_ELEMENT_COPY(def->controllers, def->ncontrollers, cont) < 0) + goto error;
return cont; + + error: + virDomainControllerDefFree(cont); + return NULL; }
As said previously - the bit above doesn't fit with the rest of the patch.
@@ -16870,15 +16872,14 @@ virDomainDefAddController(virDomainDefPtr def, int type, int idx, int model) int virDomainDefAddUSBController(virDomainDefPtr def, int idx, int model) { - virDomainControllerDefPtr cont; /* this is a *copy* of the DefPtr */ + virDomainControllerDefPtr cont;
Why did you remove the comment? It's just a (poorly worded) reminder that cont shouldn't be directly free'd, since it's only a copy of the pointer that was already added to def->controllers.
- cont = virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, - idx, model); - if (!cont) - return -1; + if (!(cont = virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, + idx, model))) + goto error;
if (model != VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1) - return 0; + goto done;
/* When the initial controller is ich9-usb-ehci, also add the * companion controllers @@ -16886,25 +16887,45 @@ virDomainDefAddUSBController(virDomainDefPtr def, int idx, int model)
idx = cont->idx; /* in case original request was "-1" */
- if (!(cont = virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, - idx, VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1))) - return -1; + if (!(cont = virDomainControllerDefNew(VIR_DOMAIN_CONTROLLER_TYPE_USB))) + goto error; + + cont->idx = idx; + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1; cont->info.mastertype = VIR_DOMAIN_CONTROLLER_MASTER_USB; cont->info.master.usb.startport = 0;
- if (!(cont = virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, - idx, VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2))) - return -1; + if (virDomainControllerInsert(def, cont) < 0) + goto error; + + if (!(cont = virDomainControllerDefNew(VIR_DOMAIN_CONTROLLER_TYPE_USB))) + goto error; + + cont->idx = idx; + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2; cont->info.mastertype = VIR_DOMAIN_CONTROLLER_MASTER_USB; cont->info.master.usb.startport = 2;
- if (!(cont = virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, - idx, VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3))) - return -1; + if (virDomainControllerInsert(def, cont) < 0) + goto error; + + if (!(cont = virDomainControllerDefNew(VIR_DOMAIN_CONTROLLER_TYPE_USB))) + goto error; + + cont->idx = idx; + cont->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3; cont->info.mastertype = VIR_DOMAIN_CONTROLLER_MASTER_USB; cont->info.master.usb.startport = 4;
+ if (virDomainControllerInsert(def, cont) < 0) + goto error; + + done: return 0; + + error: + virDomainControllerDefFree(cont); + return -1; }
It all looks fine other than the unrelated stuff (which is also fine, just a bit out of place). ACK. I'll leave it to you whether to split the patch or push it as it is.

Doing so is smarter than just appending them, because it takes the controller index into account and will prevent problematic situations such as a PCI Bridge being listed before the PCI controller it's supposed to be plugged into, which QEMU can't cope with. Although the QEMU command line for affected guests will be altered, none of the changes should impact the guest ABI. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1479674 Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/conf/domain_conf.c | 2 +- .../qemuxml2argv-channel-virtio-default.args | 2 +- .../qemuxml2argv-channel-virtio-unix.args | 2 +- .../qemuxml2argv-chardev-reconnect.args | 2 +- .../qemuxml2argv-pci-autoadd-idx.args | 16 ++++++++-------- .../qemuxml2argv-pseries-many-buses-2.args | 4 ++-- .../qemuxml2xmlout-aarch64-virtio-pci-default.xml | 6 +++--- ...2xmlout-aarch64-virtio-pci-manual-addresses.xml | 6 +++--- .../qemuxml2xmlout-channel-virtio-auto.xml | 2 +- ...qemuxml2xmlout-hostdev-scsi-autogen-address.xml | 6 +++--- .../qemuxml2xmlout-pci-autoadd-idx.xml | 22 +++++++++++----------- .../qemuxml2xmlout-pseries-many-buses-2.xml | 6 +++--- .../qemuxml2xmlout-pseries-phb-default-missing.xml | 8 ++++---- 13 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b1b9d161c..388701680 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16845,7 +16845,7 @@ virDomainDefAddController(virDomainDefPtr def, int type, int idx, int model) cont->idx = idx; cont->model = model; - if (VIR_APPEND_ELEMENT_COPY(def->controllers, def->ncontrollers, cont) < 0) + if (virDomainControllerInsert(def, cont) < 0) goto error; return cont; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-default.args b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-default.args index 1d1501b39..4ebca6e06 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-default.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-default.args @@ -19,8 +19,8 @@ server,nowait \ -mon chardev=charmonitor,id=monitor,mode=readline \ -no-acpi \ -boot c \ --device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 \ +-device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ -usb \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.args b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.args index 8e0452a9f..baed9c853 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.args @@ -19,8 +19,8 @@ server,nowait \ -mon chardev=charmonitor,id=monitor,mode=readline \ -no-acpi \ -boot c \ --device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 \ +-device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ -usb \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-chardev-reconnect.args b/tests/qemuxml2argvdata/qemuxml2argv-chardev-reconnect.args index 8c6586e48..f4f35b07e 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-chardev-reconnect.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-chardev-reconnect.args @@ -19,8 +19,8 @@ server,nowait \ -mon chardev=charmonitor,id=monitor,mode=readline \ -no-acpi \ -boot c \ --device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 \ +-device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ -device usb-ccid,id=ccid0,bus=usb.0,port=1 \ -usb \ -chardev socket,id=charsmartcard0,path=/tmp/channel/asdf,reconnect=20 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.args b/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.args index 6b2f21bba..5e8c57bd5 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.args @@ -17,14 +17,14 @@ QEMU_AUDIO_DRV=none \ server,nowait \ -mon chardev=charmonitor,id=monitor,mode=readline \ -boot c \ --device pci-bridge,chassis_nr=8,id=pci.8,bus=pci.0,addr=0x3 \ --device pci-bridge,chassis_nr=1,id=pci.1,bus=pci.0,addr=0x4 \ --device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.0,addr=0x5 \ --device pci-bridge,chassis_nr=3,id=pci.3,bus=pci.0,addr=0x6 \ --device pci-bridge,chassis_nr=4,id=pci.4,bus=pci.0,addr=0x7 \ --device pci-bridge,chassis_nr=5,id=pci.5,bus=pci.0,addr=0x8 \ --device pci-bridge,chassis_nr=6,id=pci.6,bus=pci.0,addr=0x9 \ --device pci-bridge,chassis_nr=7,id=pci.7,bus=pci.0,addr=0xa \ +-device pci-bridge,chassis_nr=1,id=pci.1,bus=pci.0,addr=0x3 \ +-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.0,addr=0x4 \ +-device pci-bridge,chassis_nr=3,id=pci.3,bus=pci.0,addr=0x5 \ +-device pci-bridge,chassis_nr=4,id=pci.4,bus=pci.0,addr=0x6 \ +-device pci-bridge,chassis_nr=5,id=pci.5,bus=pci.0,addr=0x7 \ +-device pci-bridge,chassis_nr=6,id=pci.6,bus=pci.0,addr=0x8 \ +-device pci-bridge,chassis_nr=7,id=pci.7,bus=pci.0,addr=0x9 \ +-device pci-bridge,chassis_nr=8,id=pci.8,bus=pci.0,addr=0xa \ -usb \ -drive file=/var/iso/f18kde.iso,format=raw,if=none,media=cdrom,\ id=drive-ide0-1-0,readonly=on \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-many-buses-2.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-many-buses-2.args index 13fed02f8..1a78db45f 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-many-buses-2.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-many-buses-2.args @@ -18,5 +18,5 @@ QEMU_AUDIO_DRV=none \ server,nowait \ -mon chardev=charmonitor,id=monitor,mode=readline \ -boot c \ --device spapr-pci-host-bridge,index=1,id=pci.2 \ --device spapr-pci-host-bridge,index=2,id=pci.1 +-device spapr-pci-host-bridge,index=1,id=pci.1 \ +-device spapr-pci-host-bridge,index=2,id=pci.2 diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml index e5496424b..3c0b71dde 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml @@ -32,9 +32,6 @@ <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/> </disk> <controller type='pci' index='0' model='pcie-root'/> - <controller type='virtio-serial' index='0'> - <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/> - </controller> <controller type='pci' index='1' model='pcie-root-port'> <model name='ioh3420'/> <target chassis='1' port='0x8'/> @@ -65,6 +62,9 @@ <target chassis='6' port='0xd'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x5'/> </controller> + <controller type='virtio-serial' index='0'> + <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/> + </controller> <interface type='user'> <mac address='52:54:00:09:a4:37'/> <model type='virtio'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml index 83d8dcc4a..ee9ec022c 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml @@ -41,14 +41,14 @@ <target chassisNr='2'/> <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> </controller> - <controller type='scsi' index='0' model='virtio-scsi'> - <address type='pci' domain='0x0000' bus='0x03' slot='0x01' function='0x0'/> - </controller> <controller type='pci' index='3' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='3'/> <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/> </controller> + <controller type='scsi' index='0' model='virtio-scsi'> + <address type='pci' domain='0x0000' bus='0x03' slot='0x01' function='0x0'/> + </controller> <interface type='user'> <mac address='52:54:00:09:a4:37'/> <model type='virtio'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml index 6fd035815..c2c07732b 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml @@ -31,10 +31,10 @@ <controller type='virtio-serial' index='1'> <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/> </controller> - <controller type='pci' index='0' model='pci-root'/> <controller type='virtio-serial' index='2'> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </controller> + <controller type='pci' index='0' model='pci-root'/> <channel type='pty'> <target type='virtio' name='org.linux-kvm.port.0'/> <address type='virtio-serial' controller='0' bus='0' port='1'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-autogen-address.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-autogen-address.xml index 8e93056ee..998cbb5aa 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-autogen-address.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-autogen-address.xml @@ -22,6 +22,9 @@ <controller type='scsi' index='0' model='virtio-scsi'> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </controller> + <controller type='scsi' index='1'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </controller> <controller type='usb' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> @@ -29,9 +32,6 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='scsi' index='1'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> - </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <hostdev mode='subsystem' type='scsi' managed='yes'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml index c6437391c..f44398d6c 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml @@ -32,45 +32,45 @@ <controller type='ide' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> - <controller type='pci' index='8' model='pci-bridge'> - <model name='pci-bridge'/> - <target chassisNr='8'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> - </controller> <controller type='pci' index='0' model='pci-root'/> <controller type='pci' index='1' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='1'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </controller> <controller type='pci' index='2' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='2'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </controller> <controller type='pci' index='3' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='3'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </controller> <controller type='pci' index='4' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='4'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </controller> <controller type='pci' index='5' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='5'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </controller> <controller type='pci' index='6' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='6'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </controller> <controller type='pci' index='7' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='7'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> + </controller> + <controller type='pci' index='8' model='pci-bridge'> + <model name='pci-bridge'/> + <target chassisNr='8'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/> </controller> <input type='mouse' bus='ps2'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-many-buses-2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-many-buses-2.xml index 14f3e3624..7e0bb2053 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-many-buses-2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-many-buses-2.xml @@ -18,15 +18,15 @@ <model name='spapr-pci-host-bridge'/> <target index='0'/> </controller> - <controller type='pci' index='2' model='pci-root'> + <controller type='pci' index='1' model='pci-root'> <model name='spapr-pci-host-bridge'/> <target index='1'/> </controller> - <controller type='usb' index='0' model='none'/> - <controller type='pci' index='1' model='pci-root'> + <controller type='pci' index='2' model='pci-root'> <model name='spapr-pci-host-bridge'/> <target index='2'/> </controller> + <controller type='usb' index='0' model='none'/> <memballoon model='none'/> <panic model='pseries'/> </devices> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-default-missing.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-default-missing.xml index 62708b4a4..2c1e64e88 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-default-missing.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-default-missing.xml @@ -14,6 +14,10 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-ppc64</emulator> + <controller type='pci' index='0' model='pci-root'> + <model name='spapr-pci-host-bridge'/> + <target index='0'/> + </controller> <controller type='pci' index='1' model='pci-root'> <model name='spapr-pci-host-bridge'/> <target index='1'/> @@ -23,10 +27,6 @@ <target index='2'/> </controller> <controller type='usb' index='0' model='none'/> - <controller type='pci' index='0' model='pci-root'> - <model name='spapr-pci-host-bridge'/> - <target index='0'/> - </controller> <memballoon model='none'/> <panic model='pseries'/> </devices> -- 2.13.5

On 09/07/2017 01:00 PM, Andrea Bolognani wrote:
Doing so is smarter than just appending them, because it takes the controller index into account and will prevent problematic situations such as a PCI Bridge being listed before the PCI controller it's supposed to be plugged into, which QEMU can't cope with.
Although the QEMU command line for affected guests will be altered, none of the changes should impact the guest ABI.
ACK as long as it doesn't mess up migration (I guess we need to find some config that already works, but changes the ordering with the new code, and make sure it can be migrated from old->new. Or we could assume that 1) we believe it isn't a problem, and 2) in practice most things that would be re-ordered wouldn't have worked at all without the re-ordering, so it's a non-issue).
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1479674
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/conf/domain_conf.c | 2 +- .../qemuxml2argv-channel-virtio-default.args | 2 +- .../qemuxml2argv-channel-virtio-unix.args | 2 +- .../qemuxml2argv-chardev-reconnect.args | 2 +- .../qemuxml2argv-pci-autoadd-idx.args | 16 ++++++++-------- .../qemuxml2argv-pseries-many-buses-2.args | 4 ++-- .../qemuxml2xmlout-aarch64-virtio-pci-default.xml | 6 +++--- ...2xmlout-aarch64-virtio-pci-manual-addresses.xml | 6 +++--- .../qemuxml2xmlout-channel-virtio-auto.xml | 2 +- ...qemuxml2xmlout-hostdev-scsi-autogen-address.xml | 6 +++--- .../qemuxml2xmlout-pci-autoadd-idx.xml | 22 +++++++++++----------- .../qemuxml2xmlout-pseries-many-buses-2.xml | 6 +++--- .../qemuxml2xmlout-pseries-phb-default-missing.xml | 8 ++++---- 13 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b1b9d161c..388701680 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16845,7 +16845,7 @@ virDomainDefAddController(virDomainDefPtr def, int type, int idx, int model) cont->idx = idx; cont->model = model;
- if (VIR_APPEND_ELEMENT_COPY(def->controllers, def->ncontrollers, cont) < 0) + if (virDomainControllerInsert(def, cont) < 0) goto error;
return cont; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-default.args b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-default.args index 1d1501b39..4ebca6e06 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-default.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-default.args @@ -19,8 +19,8 @@ server,nowait \ -mon chardev=charmonitor,id=monitor,mode=readline \ -no-acpi \ -boot c \ --device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 \ +-device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ -usb \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.args b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.args index 8e0452a9f..baed9c853 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.args @@ -19,8 +19,8 @@ server,nowait \ -mon chardev=charmonitor,id=monitor,mode=readline \ -no-acpi \ -boot c \ --device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 \ +-device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ -usb \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-chardev-reconnect.args b/tests/qemuxml2argvdata/qemuxml2argv-chardev-reconnect.args index 8c6586e48..f4f35b07e 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-chardev-reconnect.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-chardev-reconnect.args @@ -19,8 +19,8 @@ server,nowait \ -mon chardev=charmonitor,id=monitor,mode=readline \ -no-acpi \ -boot c \ --device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 \ +-device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \ -device usb-ccid,id=ccid0,bus=usb.0,port=1 \ -usb \ -chardev socket,id=charsmartcard0,path=/tmp/channel/asdf,reconnect=20 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.args b/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.args index 6b2f21bba..5e8c57bd5 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.args @@ -17,14 +17,14 @@ QEMU_AUDIO_DRV=none \ server,nowait \ -mon chardev=charmonitor,id=monitor,mode=readline \ -boot c \ --device pci-bridge,chassis_nr=8,id=pci.8,bus=pci.0,addr=0x3 \ --device pci-bridge,chassis_nr=1,id=pci.1,bus=pci.0,addr=0x4 \ --device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.0,addr=0x5 \ --device pci-bridge,chassis_nr=3,id=pci.3,bus=pci.0,addr=0x6 \ --device pci-bridge,chassis_nr=4,id=pci.4,bus=pci.0,addr=0x7 \ --device pci-bridge,chassis_nr=5,id=pci.5,bus=pci.0,addr=0x8 \ --device pci-bridge,chassis_nr=6,id=pci.6,bus=pci.0,addr=0x9 \ --device pci-bridge,chassis_nr=7,id=pci.7,bus=pci.0,addr=0xa \ +-device pci-bridge,chassis_nr=1,id=pci.1,bus=pci.0,addr=0x3 \ +-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.0,addr=0x4 \ +-device pci-bridge,chassis_nr=3,id=pci.3,bus=pci.0,addr=0x5 \ +-device pci-bridge,chassis_nr=4,id=pci.4,bus=pci.0,addr=0x6 \ +-device pci-bridge,chassis_nr=5,id=pci.5,bus=pci.0,addr=0x7 \ +-device pci-bridge,chassis_nr=6,id=pci.6,bus=pci.0,addr=0x8 \ +-device pci-bridge,chassis_nr=7,id=pci.7,bus=pci.0,addr=0x9 \ +-device pci-bridge,chassis_nr=8,id=pci.8,bus=pci.0,addr=0xa \ -usb \ -drive file=/var/iso/f18kde.iso,format=raw,if=none,media=cdrom,\ id=drive-ide0-1-0,readonly=on \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-many-buses-2.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-many-buses-2.args index 13fed02f8..1a78db45f 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-many-buses-2.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-many-buses-2.args @@ -18,5 +18,5 @@ QEMU_AUDIO_DRV=none \ server,nowait \ -mon chardev=charmonitor,id=monitor,mode=readline \ -boot c \ --device spapr-pci-host-bridge,index=1,id=pci.2 \ --device spapr-pci-host-bridge,index=2,id=pci.1 +-device spapr-pci-host-bridge,index=1,id=pci.1 \ +-device spapr-pci-host-bridge,index=2,id=pci.2 diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml index e5496424b..3c0b71dde 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml @@ -32,9 +32,6 @@ <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/> </disk> <controller type='pci' index='0' model='pcie-root'/> - <controller type='virtio-serial' index='0'> - <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/> - </controller> <controller type='pci' index='1' model='pcie-root-port'> <model name='ioh3420'/> <target chassis='1' port='0x8'/> @@ -65,6 +62,9 @@ <target chassis='6' port='0xd'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x5'/> </controller> + <controller type='virtio-serial' index='0'> + <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/> + </controller> <interface type='user'> <mac address='52:54:00:09:a4:37'/> <model type='virtio'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml index 83d8dcc4a..ee9ec022c 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml @@ -41,14 +41,14 @@ <target chassisNr='2'/> <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> </controller> - <controller type='scsi' index='0' model='virtio-scsi'> - <address type='pci' domain='0x0000' bus='0x03' slot='0x01' function='0x0'/> - </controller> <controller type='pci' index='3' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='3'/> <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/> </controller> + <controller type='scsi' index='0' model='virtio-scsi'> + <address type='pci' domain='0x0000' bus='0x03' slot='0x01' function='0x0'/> + </controller> <interface type='user'> <mac address='52:54:00:09:a4:37'/> <model type='virtio'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml index 6fd035815..c2c07732b 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml @@ -31,10 +31,10 @@ <controller type='virtio-serial' index='1'> <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/> </controller> - <controller type='pci' index='0' model='pci-root'/> <controller type='virtio-serial' index='2'> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </controller> + <controller type='pci' index='0' model='pci-root'/> <channel type='pty'> <target type='virtio' name='org.linux-kvm.port.0'/> <address type='virtio-serial' controller='0' bus='0' port='1'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-autogen-address.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-autogen-address.xml index 8e93056ee..998cbb5aa 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-autogen-address.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-autogen-address.xml @@ -22,6 +22,9 @@ <controller type='scsi' index='0' model='virtio-scsi'> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </controller> + <controller type='scsi' index='1'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </controller> <controller type='usb' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> @@ -29,9 +32,6 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <controller type='pci' index='0' model='pci-root'/> - <controller type='scsi' index='1'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> - </controller> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <hostdev mode='subsystem' type='scsi' managed='yes'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml index c6437391c..f44398d6c 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml @@ -32,45 +32,45 @@ <controller type='ide' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> - <controller type='pci' index='8' model='pci-bridge'> - <model name='pci-bridge'/> - <target chassisNr='8'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> - </controller> <controller type='pci' index='0' model='pci-root'/> <controller type='pci' index='1' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='1'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </controller> <controller type='pci' index='2' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='2'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </controller> <controller type='pci' index='3' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='3'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </controller> <controller type='pci' index='4' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='4'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </controller> <controller type='pci' index='5' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='5'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </controller> <controller type='pci' index='6' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='6'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </controller> <controller type='pci' index='7' model='pci-bridge'> <model name='pci-bridge'/> <target chassisNr='7'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> + </controller> + <controller type='pci' index='8' model='pci-bridge'> + <model name='pci-bridge'/> + <target chassisNr='8'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/> </controller> <input type='mouse' bus='ps2'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-many-buses-2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-many-buses-2.xml index 14f3e3624..7e0bb2053 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-many-buses-2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-many-buses-2.xml @@ -18,15 +18,15 @@ <model name='spapr-pci-host-bridge'/> <target index='0'/> </controller> - <controller type='pci' index='2' model='pci-root'> + <controller type='pci' index='1' model='pci-root'> <model name='spapr-pci-host-bridge'/> <target index='1'/> </controller> - <controller type='usb' index='0' model='none'/> - <controller type='pci' index='1' model='pci-root'> + <controller type='pci' index='2' model='pci-root'> <model name='spapr-pci-host-bridge'/> <target index='2'/> </controller> + <controller type='usb' index='0' model='none'/> <memballoon model='none'/> <panic model='pseries'/> </devices> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-default-missing.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-default-missing.xml index 62708b4a4..2c1e64e88 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-default-missing.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-default-missing.xml @@ -14,6 +14,10 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-ppc64</emulator> + <controller type='pci' index='0' model='pci-root'> + <model name='spapr-pci-host-bridge'/> + <target index='0'/> + </controller> <controller type='pci' index='1' model='pci-root'> <model name='spapr-pci-host-bridge'/> <target index='1'/> @@ -23,10 +27,6 @@ <target index='2'/> </controller> <controller type='usb' index='0' model='none'/> - <controller type='pci' index='0' model='pci-root'> - <model name='spapr-pci-host-bridge'/> - <target index='0'/> - </controller> <memballoon model='none'/> <panic model='pseries'/> </devices>
participants (2)
-
Andrea Bolognani
-
Laine Stump