render / rpms / libvirt

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