[PATCH 3/6] qemu: driver: Save status XML when starting a block job

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Few jobs (which don't) use the 'mirror' element did not save the status
XML. It will be helpful to do so once we start tracking jobs fully.
---
 src/qemu/qemu_driver.c | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4855c9047..cf60b8d6b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16489,6 +16489,7 @@ qemuDomainBlockPullCommon(virQEMUDriverPtr driver,
                           unsigned int flags)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
+    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
     char *device = NULL;
     virDomainDiskDefPtr disk;
     virStorageSourcePtr baseSource = NULL;
@@ -16580,10 +16581,15 @@ qemuDomainBlockPullCommon(virQEMUDriverPtr driver,

     QEMU_DOMAIN_DISK_PRIVATE(disk)->blockjob = true;

+    if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
+        VIR_WARN("Unable to save status on vm %s after state change",
+                 vm->def->name);
+
  endjob:
     qemuDomainObjEndJob(driver, vm);

  cleanup:
+    virObjectUnref(cfg);
     VIR_FREE(basePath);
     VIR_FREE(backingPath);
     VIR_FREE(device);
@@ -17311,6 +17317,7 @@ qemuDomainBlockCommit(virDomainPtr dom,
                       unsigned int flags)
 {
     virQEMUDriverPtr driver = dom->conn->privateData;
+    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
     qemuDomainObjPrivatePtr priv;
     virDomainObjPtr vm = NULL;
     char *device = NULL;
@@ -17503,24 +17510,18 @@ qemuDomainBlockCommit(virDomainPtr dom,
         goto endjob;
     }

-    if (ret == 0)
+    if (ret == 0) {
         QEMU_DOMAIN_DISK_PRIVATE(disk)->blockjob = true;
-
-    if (mirror) {
-        if (ret == 0) {
-            virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
-
-            mirror = NULL;
-            if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
-                VIR_WARN("Unable to save status on vm %s after block job",
-                         vm->def->name);
-            virObjectUnref(cfg);
-        } else {
-            disk->mirror = NULL;
-            disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN;
-        }
+        mirror = NULL;
+    } else {
+        disk->mirror = NULL;
+        disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN;
     }

+    if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
+        VIR_WARN("Unable to save status on vm %s after block job",
+                 vm->def->name);
+
  endjob:
     if (ret < 0 && clean_access) {
         virErrorPtr orig_err = virSaveLastError();
@@ -17542,6 +17543,7 @@ qemuDomainBlockCommit(virDomainPtr dom,
     VIR_FREE(basePath);
     VIR_FREE(backingPath);
     VIR_FREE(device);
+    virObjectUnref(cfg);
     virDomainObjEndAPI(&vm);
     return ret;
 }
-- 
2.14.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux