render / rpms / libvirt

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