]> xenbits.xensource.com Git - libvirt.git/commitdiff
virDomainDeviceDefValidateAliasesIterator: Ignore some hostdevs
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 16 Mar 2018 11:33:12 +0000 (12:33 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 20 Mar 2018 14:30:14 +0000 (15:30 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=1556828

When defining a domain that has <interface type='hostdev'/> our
parser creates two entries in virDomainDef: one for <interface/>
and one for <hostdev/>. However, some info is shared between the
two which makes user alias validation fail because alias belongs
to the set of shared info.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/conf/domain_conf.c

index 86fc275116309dc0ce8669863b3ef731e81af0fa..c8d051fa9f45456e8b0446c1ebfd4266e2b3bfe2 100644 (file)
@@ -5584,6 +5584,13 @@ virDomainDeviceDefValidateAliasesIterator(virDomainDefPtr def,
         virDomainChrEquals(def->serials[0], dev->data.chr))
         return 0;
 
+    if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
+        dev->data.hostdev->parent.type == VIR_DOMAIN_DEVICE_NET) {
+        /* This hostdev is a copy of some previous interface.
+         * Aliases are duplicated. */
+        return 0;
+    }
+
     if (virHashLookup(data->aliases, alias)) {
         virReportError(VIR_ERR_XML_ERROR,
                        _("non unique alias detected: %s"),