render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
99cbc7
From 311a7eaeef6f90ee1ce063b75673dddfbd392346 Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <311a7eaeef6f90ee1ce063b75673dddfbd392346@dist-git>
99cbc7
From: Michal Privoznik <mprivozn@redhat.com>
99cbc7
Date: Tue, 4 Sep 2018 10:38:48 +0200
99cbc7
Subject: [PATCH] virDomainDefCompatibleDevice: Relax alias change check
99cbc7
MIME-Version: 1.0
99cbc7
Content-Type: text/plain; charset=UTF-8
99cbc7
Content-Transfer-Encoding: 8bit
99cbc7
99cbc7
RHEL-7.6: https://bugzilla.redhat.com/show_bug.cgi?id=1621910
99cbc7
RHEL-8.0: https://bugzilla.redhat.com/show_bug.cgi?id=1603133
99cbc7
99cbc7
When introducing this check back in 4ad54a417a1 my mindset was
99cbc7
that if an element is missing in update XML then user is
99cbc7
requesting for removal of the corresponding setting. For
99cbc7
instance, if <bandwidth/> is not present in update XML any QoS
99cbc7
previously set on <interface/> is cleared out. Well this
99cbc7
assumption is correct but only to some extent.
99cbc7
99cbc7
Turns out, we have some users who when updating path to ISO
99cbc7
image construct very minimalistic disk XML and pass it to device
99cbc7
update API. Such XML is lacking a lot of information, and alias
99cbc7
is one of them. This triggers error in
99cbc7
virDomainDefCompatibleDevice() because we think that user is
99cbc7
requesting to remove the alias. Well, they are not.
99cbc7
99cbc7
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
99cbc7
Reviewed-by: John Ferlan <jferlan@redhat.com>
99cbc7
(cherry picked from commit b48d9e939bcf32a8d6e571313637e2eefe52e117)
99cbc7
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
---
99cbc7
 src/conf/domain_conf.c | 6 +++---
99cbc7
 1 file changed, 3 insertions(+), 3 deletions(-)
99cbc7
99cbc7
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
99cbc7
index 8a43e607e9..49b0a59918 100644
99cbc7
--- a/src/conf/domain_conf.c
99cbc7
+++ b/src/conf/domain_conf.c
99cbc7
@@ -28378,9 +28378,9 @@ virDomainDefCompatibleDevice(virDomainDefPtr def,
99cbc7
 
99cbc7
     if (action == VIR_DOMAIN_DEVICE_ACTION_UPDATE &&
99cbc7
         live &&
99cbc7
-        ((!!data.newInfo != !!data.oldInfo) ||
99cbc7
-         (data.newInfo && data.oldInfo &&
99cbc7
-          STRNEQ_NULLABLE(data.newInfo->alias, data.oldInfo->alias)))) {
99cbc7
+        (data.newInfo && data.oldInfo &&
99cbc7
+         data.newInfo->alias && data.oldInfo->alias &&
99cbc7
+         STRNEQ(data.newInfo->alias, data.oldInfo->alias))) {
99cbc7
         virReportError(VIR_ERR_OPERATION_DENIED, "%s",
99cbc7
                        _("changing device alias is not allowed"));
99cbc7
         return -1;
99cbc7
-- 
99cbc7
2.18.0
99cbc7