]> xenbits.xensource.com Git - libvirt.git/commitdiff
virDomainDefCompatibleDevice: Relax alias change check
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 29 Aug 2018 12:08:59 +0000 (14:08 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 4 Sep 2018 08:09:52 +0000 (10:09 +0200)
https://bugzilla.redhat.com/show_bug.cgi?id=1621910

When introducing this check back in 4ad54a417a1 my mindset was
that if an element is missing in update XML then user is
requesting for removal of the corresponding setting. For
instance, if <bandwidth/> is not present in update XML any QoS
previously set on <interface/> is cleared out. Well this
assumption is correct but only to some extent.

Turns out, we have some users who when updating path to ISO
image construct very minimalistic disk XML and pass it to device
update API. Such XML is lacking a lot of information, and alias
is one of them. This triggers error in
virDomainDefCompatibleDevice() because we think that user is
requesting to remove the alias. Well, they are not.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/conf/domain_conf.c

index 38cac0791330c7d72bb5968dcd73b3453de28eaa..603a4ad6524549d8da32b964026fd3e4d8a17a83 100644 (file)
@@ -28785,9 +28785,9 @@ virDomainDefCompatibleDevice(virDomainDefPtr def,
 
     if (action == VIR_DOMAIN_DEVICE_ACTION_UPDATE &&
         live &&
-        ((!!data.newInfo != !!data.oldInfo) ||
-         (data.newInfo && data.oldInfo &&
-          STRNEQ_NULLABLE(data.newInfo->alias, data.oldInfo->alias)))) {
+        (data.newInfo && data.oldInfo &&
+         data.newInfo->alias && data.oldInfo->alias &&
+         STRNEQ(data.newInfo->alias, data.oldInfo->alias))) {
         virReportError(VIR_ERR_OPERATION_DENIED, "%s",
                        _("changing device alias is not allowed"));
         return -1;