]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Use inactive definition when removing disk from config
authorPeter Krempa <pkrempa@redhat.com>
Tue, 7 Jan 2014 16:58:47 +0000 (17:58 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 8 Jan 2014 08:47:44 +0000 (09:47 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=1049529

The 'detach-disk' command in virsh used the active XML definition of a
domain even when attempting to remove a disk from the config only. If
the disk was only in the inactive definition the operation failed. Fix
this by using the inactive XML in case that only the config is affected.

tools/virsh-domain.c

index 5468365c45d463e6864d6a57abbe615dc3e63afd..506baf44cce66ede8efc9e6d867b6421a504be49 100644 (file)
@@ -10175,7 +10175,12 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd)
     if (vshCommandOptStringReq(ctl, cmd, "target", &target) < 0)
         goto cleanup;
 
-    if (!(doc = virDomainGetXMLDesc(dom, 0)))
+    if (flags == VIR_DOMAIN_AFFECT_CONFIG)
+        doc = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_INACTIVE);
+    else
+        doc = virDomainGetXMLDesc(dom, 0);
+
+    if (!doc)
         goto cleanup;
 
     if (persistent &&