99cbc7
From ae90fc830dc58f2802360ef3822e64b0a4294af1 Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <ae90fc830dc58f2802360ef3822e64b0a4294af1@dist-git>
99cbc7
From: Michal Privoznik <mprivozn@redhat.com>
99cbc7
Date: Tue, 4 Sep 2018 10:38:49 +0200
99cbc7
Subject: [PATCH] virDomainDetachDeviceFlags: Clarify update semantics
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 users want to update a path to a CDROM they tend to
99cbc7
construct a very minimal XML and feed the API with it. This is
99cbc7
not a good practice as it breaks the assumptions the API is built
99cbc7
on. Most notably, leaving an element out should be treated as a
99cbc7
request for removal of the corresponding setting. Just like
99cbc7
leaving out <bandwidth/> clears out any QoS previously set.
99cbc7
99cbc7
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
99cbc7
Reviewed-by: Erik Skultety <eskultet@redhat.com>
99cbc7
(cherry picked from commit 2864b4cd1ccda9c12f0c0ceb340836c42a2a0e52)
99cbc7
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
---
99cbc7
 src/libvirt-domain.c | 8 ++++++++
99cbc7
 1 file changed, 8 insertions(+)
99cbc7
99cbc7
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
99cbc7
index ab7266dc19..ad0ded9ee3 100644
99cbc7
--- a/src/libvirt-domain.c
99cbc7
+++ b/src/libvirt-domain.c
99cbc7
@@ -8315,6 +8315,14 @@ virDomainDetachDeviceFlags(virDomainPtr domain,
99cbc7
  * media, altering the graphics configuration such as password,
99cbc7
  * reconfiguring the NIC device backend connectivity, etc.
99cbc7
  *
99cbc7
+ * The supplied XML description of the device should contain all
99cbc7
+ * the information that is found in the corresponding domain XML.
99cbc7
+ * Leaving out any piece of information may be treated as a
99cbc7
+ * request for its removal, which may be denied. For instance,
99cbc7
+ * when users want to change CDROM media only for live XML, they
99cbc7
+ * must provide live disk XML as found in the corresponding live
99cbc7
+ * domain XML with only the disk path changed.
99cbc7
+ *
99cbc7
  * Returns 0 in case of success, -1 in case of failure.
99cbc7
  */
99cbc7
 int
99cbc7
-- 
99cbc7
2.18.0
99cbc7