render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
27b6f9
From 91bf4656fec73b8a083d7dae0a98490196f6dcbe Mon Sep 17 00:00:00 2001
27b6f9
Message-Id: <91bf4656fec73b8a083d7dae0a98490196f6dcbe@dist-git>
27b6f9
From: Michal Privoznik <mprivozn@redhat.com>
27b6f9
Date: Fri, 16 Mar 2018 12:33:12 +0100
27b6f9
Subject: [PATCH] virDomainDeviceDefValidateAliasesIterator: Ignore some
27b6f9
 hostdevs
27b6f9
27b6f9
https://bugzilla.redhat.com/show_bug.cgi?id=1556828
27b6f9
27b6f9
When defining a domain that has <interface type='hostdev'/> our
27b6f9
parser creates two entries in virDomainDef: one for <interface/>
27b6f9
and one for <hostdev/>. However, some info is shared between the
27b6f9
two which makes user alias validation fail because alias belongs
27b6f9
to the set of shared info.
27b6f9
27b6f9
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
27b6f9
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
27b6f9
(cherry picked from commit 630c6e34957666f20a66167c7a512e65fc711aa0)
27b6f9
27b6f9
https://bugzilla.redhat.com/show_bug.cgi?id=1558655
27b6f9
27b6f9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
27b6f9
---
27b6f9
 src/conf/domain_conf.c | 7 +++++++
27b6f9
 1 file changed, 7 insertions(+)
27b6f9
27b6f9
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
27b6f9
index a0c0702a6c..031d4b8e55 100644
27b6f9
--- a/src/conf/domain_conf.c
27b6f9
+++ b/src/conf/domain_conf.c
27b6f9
@@ -5571,6 +5571,13 @@ virDomainDeviceDefValidateAliasesIterator(virDomainDefPtr def,
27b6f9
         virDomainChrEquals(def->serials[0], dev->data.chr))
27b6f9
         return 0;
27b6f9
 
27b6f9
+    if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
27b6f9
+        dev->data.hostdev->parent.type == VIR_DOMAIN_DEVICE_NET) {
27b6f9
+        /* This hostdev is a copy of some previous interface.
27b6f9
+         * Aliases are duplicated. */
27b6f9
+        return 0;
27b6f9
+    }
27b6f9
+
27b6f9
     if (virHashLookup(data->aliases, alias)) {
27b6f9
         virReportError(VIR_ERR_XML_ERROR,
27b6f9
                        _("non unique alias detected: %s"),
27b6f9
-- 
27b6f9
2.16.2
27b6f9