[libvirt] [PATCH] conf: fix bogus error when <boot order='1'/> is in an <interface type='hostdev'>

Laine Stump laine at laine.org
Fri Sep 7 01:14:26 UTC 2018


virDomainDefCollectBootOrder() is called for every item on the list
for each type of device. Since an <interface type='hostdev'> is on
both the list of hostdev devices and the list of network devices, it
will be counted twice, and the code that checks for multiple devices
with the same boot order will give a false positive.

To remedy this, we make sure to return early for hostdev devices that
have a parent.type != NONE.

This was introduced in commit 5b75a4, which was first in libvirt-4.4.0.

Resolves: https://bugzilla.redhat.com/1601318
Signed-off-by: Laine Stump <laine at laine.org>
---
 src/conf/domain_conf.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 77cc73744f..71a2fb0426 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5062,6 +5062,14 @@ virDomainDefCollectBootOrder(virDomainDefPtr def ATTRIBUTE_UNUSED,
     if (info->bootIndex == 0)
         return 0;
 
+    if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
+        dev->data.hostdev->parent.type != VIR_DOMAIN_DEVICE_NONE) {
+        /* This hostdev is a child of a higher level device
+         * (e.g. interface), and thus already being counted on the
+         * list for the other device type.
+         */
+        return 0;
+    }
     if (virAsprintf(&order, "%u", info->bootIndex) < 0)
         goto cleanup;
 
-- 
2.14.4




More information about the libvir-list mailing list