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