]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Always save status XML in qemuDomainBlockJobAbort
authorPeter Krempa <pkrempa@redhat.com>
Thu, 24 Jan 2019 16:13:58 +0000 (17:13 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 7 Feb 2019 13:32:32 +0000 (14:32 +0100)
For copy and active commit jobs we record the state of the mirror so
that we can recover. The status XML was not saved in case of
qemuDomainBlockPivot due to an oversight.

Save the XML always when invoking qemuDomainBlockJobAbort even if
the job is not currently tracking any state. This will change later and
also this is not a particularly hot code path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c

index 427c1d02a8bff659be43d9f68e8a46b49a5f4ca5..daaf86ad6d4527e832a7ccb8a7103793d8a57167 100644 (file)
@@ -17313,7 +17313,6 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
     char *device = NULL;
     virDomainDiskDefPtr disk = NULL;
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
-    bool save = false;
     bool pivot = !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT);
     bool async = !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC);
     qemuBlockJobDataPtr job = NULL;
@@ -17365,10 +17364,8 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
         if ((ret = qemuDomainBlockPivot(driver, vm, device, disk)) < 0)
             goto endjob;
     } else {
-        if (disk->mirror) {
+        if (disk->mirror)
             disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_ABORT;
-            save = true;
-        }
 
         qemuDomainObjEnterMonitor(driver, vm);
         ret = qemuMonitorBlockJobCancel(qemuDomainGetMonitor(vm), device);
@@ -17384,11 +17381,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
         }
     }
 
-    /* If we have made changes to XML due to a copy job, make a best
-     * effort to save it now.  But we can ignore failure, since there
-     * will be further changes when the event marks completion.  */
-    if (save)
-        ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps));
+    ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps));
 
     /*
      * With the ABORT_ASYNC flag we don't need to do anything, the event will