From 34202c841fb328d20be3ea0618996940e187f3f9 Mon Sep 17 00:00:00 2001 Message-Id: <34202c841fb328d20be3ea0618996940e187f3f9@dist-git> From: Shanzhi Yu Date: Wed, 22 Oct 2014 09:54:36 +0200 Subject: [PATCH] qemu: save domain status after set the blkio parameters 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 (cherry picked from commit bde879c1847f8181ca144c0807ae83906de8440d) Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1146511 Signed-off-by: Pavel Hrdina Signed-off-by: Jiri Denemark --- src/qemu/qemu_driver.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 36b394e..12a32ec 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7993,15 +7993,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; } } @@ -8094,9 +8097,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); @@ -8134,6 +8140,10 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, ret = -1; } + endjob: + if (!qemuDomainObjEndJob(driver, vm)) + vm = NULL; + cleanup: if (vm) virObjectUnlock(vm); -- 2.1.3