]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: save domain status after set the blkio parameters
authorShanzhi Yu <shyu@redhat.com>
Mon, 6 Oct 2014 15:00:00 +0000 (17:00 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Thu, 9 Oct 2014 09:50:26 +0000 (11:50 +0200)
After set the blkio parameters for running domain, save the change into
live xml is needed to survive restarting the libvirtd, same story with
bug 1146511, meanwhile add call qemuDomainObjBeginJob/qemuDomainObjEndJob
in qemuDomainSetBlkioParameters

Signed-off-by: Shanzhi Yu <shyu@redhat.com>
src/qemu/qemu_driver.c

index 4e2b35668295d2b96a370df07ee22881190bda89..352775e8f85b784c9e3d05e705a37620f8ad3286 100644 (file)
@@ -8097,15 +8097,18 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
         goto cleanup;
 
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
+        goto cleanup;
+
     if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags,
                                         &persistentDef) < 0)
-        goto cleanup;
+        goto endjob;
 
     if (flags & VIR_DOMAIN_AFFECT_LIVE) {
         if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_BLKIO)) {
             virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                            _("blkio cgroup isn't mounted"));
-            goto cleanup;
+            goto endjob;
         }
     }
 
@@ -8198,9 +8201,12 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
                 VIR_FREE(devices);
             }
         }
+
+        if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+            goto endjob;
     }
     if (ret < 0)
-        goto cleanup;
+        goto endjob;
     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
         /* Clang can't see that if we get here, persistentDef was set.  */
         sa_assert(persistentDef);
@@ -8238,6 +8244,10 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
             ret = -1;
     }
 
+ endjob:
+    if (!qemuDomainObjEndJob(driver, vm))
+        vm = NULL;
+
  cleanup:
     if (vm)
         virObjectUnlock(vm);