render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
9119d9
From 34202c841fb328d20be3ea0618996940e187f3f9 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <34202c841fb328d20be3ea0618996940e187f3f9@dist-git>
9119d9
From: Shanzhi Yu <shyu@redhat.com>
9119d9
Date: Wed, 22 Oct 2014 09:54:36 +0200
9119d9
Subject: [PATCH] qemu: save domain status after set the blkio parameters
9119d9
9119d9
After set the blkio parameters for running domain, save the change into
9119d9
live xml is needed to survive restarting the libvirtd, same story with
9119d9
bug 1146511, meanwhile add call qemuDomainObjBeginJob/qemuDomainObjEndJob
9119d9
in qemuDomainSetBlkioParameters
9119d9
9119d9
Signed-off-by: Shanzhi Yu <shyu@redhat.com>
9119d9
(cherry picked from commit bde879c1847f8181ca144c0807ae83906de8440d)
9119d9
9119d9
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1146511
9119d9
9119d9
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/qemu/qemu_driver.c | 16 +++++++++++++---
9119d9
 1 file changed, 13 insertions(+), 3 deletions(-)
9119d9
9119d9
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
9119d9
index 36b394e..12a32ec 100644
9119d9
--- a/src/qemu/qemu_driver.c
9119d9
+++ b/src/qemu/qemu_driver.c
9119d9
@@ -7993,15 +7993,18 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
9119d9
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
9119d9
         goto cleanup;
9119d9
 
9119d9
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
9119d9
+        goto cleanup;
9119d9
+
9119d9
     if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags,
9119d9
                                         &persistentDef) < 0)
9119d9
-        goto cleanup;
9119d9
+        goto endjob;
9119d9
 
9119d9
     if (flags & VIR_DOMAIN_AFFECT_LIVE) {
9119d9
         if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_BLKIO)) {
9119d9
             virReportError(VIR_ERR_OPERATION_INVALID, "%s",
9119d9
                            _("blkio cgroup isn't mounted"));
9119d9
-            goto cleanup;
9119d9
+            goto endjob;
9119d9
         }
9119d9
     }
9119d9
 
9119d9
@@ -8094,9 +8097,12 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
9119d9
                 VIR_FREE(devices);
9119d9
             }
9119d9
         }
9119d9
+
9119d9
+        if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
9119d9
+            goto endjob;
9119d9
     }
9119d9
     if (ret < 0)
9119d9
-        goto cleanup;
9119d9
+        goto endjob;
9119d9
     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
9119d9
         /* Clang can't see that if we get here, persistentDef was set.  */
9119d9
         sa_assert(persistentDef);
9119d9
@@ -8134,6 +8140,10 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
9119d9
             ret = -1;
9119d9
     }
9119d9
 
9119d9
+ endjob:
9119d9
+    if (!qemuDomainObjEndJob(driver, vm))
9119d9
+        vm = NULL;
9119d9
+
9119d9
  cleanup:
9119d9
     if (vm)
9119d9
         virObjectUnlock(vm);
9119d9
-- 
9119d9
2.1.3
9119d9