|
|
982648 |
From 81b2604ee418dc5fd5158406d32868c8d15f3256 Mon Sep 17 00:00:00 2001
|
|
|
982648 |
Message-Id: <81b2604ee418dc5fd5158406d32868c8d15f3256@dist-git>
|
|
|
982648 |
From: Laine Stump <laine@laine.org>
|
|
|
982648 |
Date: Wed, 12 Sep 2018 11:23:47 -0400
|
|
|
982648 |
Subject: [PATCH] conf: correct false boot order error during domain parse
|
|
|
982648 |
MIME-Version: 1.0
|
|
|
982648 |
Content-Type: text/plain; charset=UTF-8
|
|
|
982648 |
Content-Transfer-Encoding: 8bit
|
|
|
982648 |
|
|
|
982648 |
virDomainDefCollectBootOrder() is called for every item on the list
|
|
|
982648 |
for each type of device. One of the checks it makes is to gather the
|
|
|
982648 |
order attributes from the <boot> element of all devices, and assure
|
|
|
982648 |
that no two devices have been given the same order.
|
|
|
982648 |
|
|
|
982648 |
Since (internally to libvirt, *not* in the domain XML) an
|
|
|
982648 |
type='hostdev'> is on both the list of hostdev devices and the list of
|
|
|
982648 |
network devices, it will be counted twice, and the code that checks
|
|
|
982648 |
for multiple devices with the same boot order will give a false
|
|
|
982648 |
positive.
|
|
|
982648 |
|
|
|
982648 |
To remedy this, we make sure to return early for hostdev devices that
|
|
|
982648 |
have a parent.type != NONE.
|
|
|
982648 |
|
|
|
982648 |
This was introduced in commit 5b75a4, which was first in libvirt-4.4.0.
|
|
|
982648 |
|
|
|
982648 |
Resolves: https://bugzilla.redhat.com/1601318
|
|
|
982648 |
|
|
|
982648 |
Signed-off-by: Laine Stump <laine@laine.org>
|
|
|
982648 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
982648 |
(cherry picked from commit 7ea7342996d74591e00bcbf14b1eb3995f77a199)
|
|
|
982648 |
Signed-off-by: Laine Stump <laine@redhat.com>
|
|
|
982648 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
982648 |
---
|
|
|
982648 |
src/conf/domain_conf.c | 8 ++++
|
|
|
982648 |
.../net-hostdev-bootorder.args | 27 ++++++++++++
|
|
|
982648 |
.../net-hostdev-bootorder.xml | 36 ++++++++++++++++
|
|
|
982648 |
tests/qemuxml2argvtest.c | 2 +
|
|
|
982648 |
.../net-hostdev-bootorder.xml | 42 +++++++++++++++++++
|
|
|
982648 |
tests/qemuxml2xmltest.c | 2 +
|
|
|
982648 |
6 files changed, 117 insertions(+)
|
|
|
982648 |
create mode 100644 tests/qemuxml2argvdata/net-hostdev-bootorder.args
|
|
|
982648 |
create mode 100644 tests/qemuxml2argvdata/net-hostdev-bootorder.xml
|
|
|
982648 |
create mode 100644 tests/qemuxml2xmloutdata/net-hostdev-bootorder.xml
|
|
|
982648 |
|
|
|
982648 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
982648 |
index ed9687fde9..eb4e9ac523 100644
|
|
|
982648 |
--- a/src/conf/domain_conf.c
|
|
|
982648 |
+++ b/src/conf/domain_conf.c
|
|
|
982648 |
@@ -5072,6 +5072,14 @@ virDomainDefCollectBootOrder(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
|
|
982648 |
if (info->bootIndex == 0)
|
|
|
982648 |
return 0;
|
|
|
982648 |
|
|
|
982648 |
+ if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
|
|
|
982648 |
+ dev->data.hostdev->parent.type != VIR_DOMAIN_DEVICE_NONE) {
|
|
|
982648 |
+ /* This hostdev is a child of a higher level device
|
|
|
982648 |
+ * (e.g. interface), and thus already being counted on the
|
|
|
982648 |
+ * list for the other device type.
|
|
|
982648 |
+ */
|
|
|
982648 |
+ return 0;
|
|
|
982648 |
+ }
|
|
|
982648 |
if (virAsprintf(&order, "%u", info->bootIndex) < 0)
|
|
|
982648 |
goto cleanup;
|
|
|
982648 |
|
|
|
982648 |
diff --git a/tests/qemuxml2argvdata/net-hostdev-bootorder.args b/tests/qemuxml2argvdata/net-hostdev-bootorder.args
|
|
|
982648 |
new file mode 100644
|
|
|
982648 |
index 0000000000..e632d9b195
|
|
|
982648 |
--- /dev/null
|
|
|
982648 |
+++ b/tests/qemuxml2argvdata/net-hostdev-bootorder.args
|
|
|
982648 |
@@ -0,0 +1,27 @@
|
|
|
982648 |
+LC_ALL=C \
|
|
|
982648 |
+PATH=/bin \
|
|
|
982648 |
+HOME=/home/test \
|
|
|
982648 |
+USER=test \
|
|
|
982648 |
+LOGNAME=test \
|
|
|
982648 |
+QEMU_AUDIO_DRV=none \
|
|
|
982648 |
+/usr/bin/qemu-system-i686 \
|
|
|
982648 |
+-name QEMUGuest1 \
|
|
|
982648 |
+-S \
|
|
|
982648 |
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
|
|
982648 |
+-m 214 \
|
|
|
982648 |
+-smp 1,sockets=1,cores=1,threads=1 \
|
|
|
982648 |
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
|
|
982648 |
+-display none \
|
|
|
982648 |
+-no-user-config \
|
|
|
982648 |
+-nodefaults \
|
|
|
982648 |
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
|
|
|
982648 |
+server,nowait \
|
|
|
982648 |
+-mon chardev=charmonitor,id=monitor,mode=control \
|
|
|
982648 |
+-rtc base=utc \
|
|
|
982648 |
+-no-shutdown \
|
|
|
982648 |
+-no-acpi \
|
|
|
982648 |
+-usb \
|
|
|
982648 |
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
|
|
|
982648 |
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,\
|
|
|
982648 |
+bootindex=2 \
|
|
|
982648 |
+-device pci-assign,host=03:07.1,id=hostdev0,bootindex=1,bus=pci.0,addr=0x3
|
|
|
982648 |
diff --git a/tests/qemuxml2argvdata/net-hostdev-bootorder.xml b/tests/qemuxml2argvdata/net-hostdev-bootorder.xml
|
|
|
982648 |
new file mode 100644
|
|
|
982648 |
index 0000000000..cd9f32b2f3
|
|
|
982648 |
--- /dev/null
|
|
|
982648 |
+++ b/tests/qemuxml2argvdata/net-hostdev-bootorder.xml
|
|
|
982648 |
@@ -0,0 +1,36 @@
|
|
|
982648 |
+<domain type='qemu'>
|
|
|
982648 |
+ <name>QEMUGuest1</name>
|
|
|
982648 |
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
|
|
982648 |
+ <memory unit='KiB'>219136</memory>
|
|
|
982648 |
+ <currentMemory unit='KiB'>219136</currentMemory>
|
|
|
982648 |
+ <vcpu placement='static'>1</vcpu>
|
|
|
982648 |
+ <os>
|
|
|
982648 |
+ <type arch='i686' machine='pc'>hvm</type>
|
|
|
982648 |
+ </os>
|
|
|
982648 |
+ <clock offset='utc'/>
|
|
|
982648 |
+ <on_poweroff>destroy</on_poweroff>
|
|
|
982648 |
+ <on_reboot>restart</on_reboot>
|
|
|
982648 |
+ <on_crash>destroy</on_crash>
|
|
|
982648 |
+ <devices>
|
|
|
982648 |
+ <emulator>/usr/bin/qemu-system-i686</emulator>
|
|
|
982648 |
+ <disk type='block' device='disk'>
|
|
|
982648 |
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
|
|
982648 |
+ <target dev='hda' bus='ide'/>
|
|
|
982648 |
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
|
|
982648 |
+ <boot order='2'/>
|
|
|
982648 |
+ </disk>
|
|
|
982648 |
+ <controller type='usb' index='0'/>
|
|
|
982648 |
+ <controller type='ide' index='0'/>
|
|
|
982648 |
+ <controller type='pci' index='0' model='pci-root'/>
|
|
|
982648 |
+ <interface type='hostdev' managed='yes'>
|
|
|
982648 |
+ <mac address='00:11:22:33:44:55'/>
|
|
|
982648 |
+ <source>
|
|
|
982648 |
+ <address type='pci' domain='0x0000' bus='0x03' slot='0x07' function='0x1'/>
|
|
|
982648 |
+ </source>
|
|
|
982648 |
+ <boot order='1'/>
|
|
|
982648 |
+ </interface>
|
|
|
982648 |
+ <input type='mouse' bus='ps2'/>
|
|
|
982648 |
+ <input type='keyboard' bus='ps2'/>
|
|
|
982648 |
+ <memballoon model='none'/>
|
|
|
982648 |
+ </devices>
|
|
|
982648 |
+</domain>
|
|
|
982648 |
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
|
|
982648 |
index 02bb9889ee..d97dc0ea8d 100644
|
|
|
982648 |
--- a/tests/qemuxml2argvtest.c
|
|
|
982648 |
+++ b/tests/qemuxml2argvtest.c
|
|
|
982648 |
@@ -1321,6 +1321,8 @@ mymain(void)
|
|
|
982648 |
DO_TEST("net-mcast", NONE);
|
|
|
982648 |
DO_TEST("net-udp", NONE);
|
|
|
982648 |
DO_TEST("net-hostdev", NONE);
|
|
|
982648 |
+ DO_TEST("net-hostdev-bootorder",
|
|
|
982648 |
+ QEMU_CAPS_BOOTINDEX, QEMU_CAPS_PCI_BOOTINDEX);
|
|
|
982648 |
DO_TEST("net-hostdev-multidomain", NONE);
|
|
|
982648 |
DO_TEST("net-hostdev-vfio",
|
|
|
982648 |
QEMU_CAPS_DEVICE_VFIO_PCI);
|
|
|
982648 |
diff --git a/tests/qemuxml2xmloutdata/net-hostdev-bootorder.xml b/tests/qemuxml2xmloutdata/net-hostdev-bootorder.xml
|
|
|
982648 |
new file mode 100644
|
|
|
982648 |
index 0000000000..d9ecf40cf0
|
|
|
982648 |
--- /dev/null
|
|
|
982648 |
+++ b/tests/qemuxml2xmloutdata/net-hostdev-bootorder.xml
|
|
|
982648 |
@@ -0,0 +1,42 @@
|
|
|
982648 |
+<domain type='qemu'>
|
|
|
982648 |
+ <name>QEMUGuest1</name>
|
|
|
982648 |
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
|
|
982648 |
+ <memory unit='KiB'>219136</memory>
|
|
|
982648 |
+ <currentMemory unit='KiB'>219136</currentMemory>
|
|
|
982648 |
+ <vcpu placement='static'>1</vcpu>
|
|
|
982648 |
+ <os>
|
|
|
982648 |
+ <type arch='i686' machine='pc'>hvm</type>
|
|
|
982648 |
+ </os>
|
|
|
982648 |
+ <clock offset='utc'/>
|
|
|
982648 |
+ <on_poweroff>destroy</on_poweroff>
|
|
|
982648 |
+ <on_reboot>restart</on_reboot>
|
|
|
982648 |
+ <on_crash>destroy</on_crash>
|
|
|
982648 |
+ <devices>
|
|
|
982648 |
+ <emulator>/usr/bin/qemu-system-i686</emulator>
|
|
|
982648 |
+ <disk type='block' device='disk'>
|
|
|
982648 |
+ <driver name='qemu' type='raw'/>
|
|
|
982648 |
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
|
|
982648 |
+ <target dev='hda' bus='ide'/>
|
|
|
982648 |
+ <boot order='2'/>
|
|
|
982648 |
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
|
|
982648 |
+ </disk>
|
|
|
982648 |
+ <controller type='usb' index='0'>
|
|
|
982648 |
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
|
|
982648 |
+ </controller>
|
|
|
982648 |
+ <controller type='ide' index='0'>
|
|
|
982648 |
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
|
|
982648 |
+ </controller>
|
|
|
982648 |
+ <controller type='pci' index='0' model='pci-root'/>
|
|
|
982648 |
+ <interface type='hostdev' managed='yes'>
|
|
|
982648 |
+ <mac address='00:11:22:33:44:55'/>
|
|
|
982648 |
+ <source>
|
|
|
982648 |
+ <address type='pci' domain='0x0000' bus='0x03' slot='0x07' function='0x1'/>
|
|
|
982648 |
+ </source>
|
|
|
982648 |
+ <boot order='1'/>
|
|
|
982648 |
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
|
|
982648 |
+ </interface>
|
|
|
982648 |
+ <input type='mouse' bus='ps2'/>
|
|
|
982648 |
+ <input type='keyboard' bus='ps2'/>
|
|
|
982648 |
+ <memballoon model='none'/>
|
|
|
982648 |
+ </devices>
|
|
|
982648 |
+</domain>
|
|
|
982648 |
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
|
|
|
982648 |
index b76410b2c1..5bd522e765 100644
|
|
|
982648 |
--- a/tests/qemuxml2xmltest.c
|
|
|
982648 |
+++ b/tests/qemuxml2xmltest.c
|
|
|
982648 |
@@ -454,6 +454,8 @@ mymain(void)
|
|
|
982648 |
DO_TEST("net-virtio-network-portgroup", NONE);
|
|
|
982648 |
DO_TEST("net-virtio-rxtxqueuesize", NONE);
|
|
|
982648 |
DO_TEST("net-hostdev", NONE);
|
|
|
982648 |
+ DO_TEST("net-hostdev-bootorder",
|
|
|
982648 |
+ QEMU_CAPS_BOOTINDEX, QEMU_CAPS_PCI_BOOTINDEX);
|
|
|
982648 |
DO_TEST("net-hostdev-vfio", NONE);
|
|
|
982648 |
DO_TEST("net-midonet", NONE);
|
|
|
982648 |
DO_TEST("net-openvswitch", NONE);
|
|
|
982648 |
--
|
|
|
982648 |
2.19.0
|
|
|
982648 |
|