render / rpms / libvirt

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