[PATCH 5/7] qemu: Fix job handling in qemuDomainSetSchedulerParametersFlags

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

 



The code modifies the domain configuration but doesn't take a MODIFY
type job to do so.
---
 src/qemu/qemu_driver.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f6b2967..c52821a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9679,6 +9679,9 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
         }
     }

+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
+        goto cleanup;
+
     for (i = 0; i < nparams; i++) {
         virTypedParameterPtr param = &params[i];
         value_ul = param->value.ul;
@@ -9688,10 +9691,10 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
             if (flags & VIR_DOMAIN_AFFECT_LIVE) {
                 unsigned long long val;
                 if (virCgroupSetCpuShares(priv->cgroup, value_ul) < 0)
-                    goto cleanup;
+                    goto endjob;

                 if (virCgroupGetCpuShares(priv->cgroup, &val) < 0)
-                    goto cleanup;
+                    goto endjob;

                 vm->def->cputune.shares = val;
                 vm->def->cputune.sharesSpecified = true;
@@ -9700,7 +9703,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
                                             &eventMaxNparams,
                                             VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES,
                                             val) < 0)
-                    goto cleanup;
+                    goto endjob;
             }

             if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
@@ -9715,7 +9718,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,

             if (flags & VIR_DOMAIN_AFFECT_LIVE && value_ul) {
                 if ((rc = qemuSetVcpusBWLive(vm, priv->cgroup, value_ul, 0)))
-                    goto cleanup;
+                    goto endjob;

                 vm->def->cputune.period = value_ul;

@@ -9723,7 +9726,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
                                             &eventMaxNparams,
                                             VIR_DOMAIN_TUNABLE_CPU_VCPU_PERIOD,
                                             value_ul) < 0)
-                    goto cleanup;
+                    goto endjob;
             }

             if (flags & VIR_DOMAIN_AFFECT_CONFIG)
@@ -9735,7 +9738,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,

             if (flags & VIR_DOMAIN_AFFECT_LIVE && value_l) {
                 if ((rc = qemuSetVcpusBWLive(vm, priv->cgroup, 0, value_l)))
-                    goto cleanup;
+                    goto endjob;

                 vm->def->cputune.quota = value_l;

@@ -9743,7 +9746,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
                                            &eventMaxNparams,
                                            VIR_DOMAIN_TUNABLE_CPU_VCPU_QUOTA,
                                            value_l) < 0)
-                    goto cleanup;
+                    goto endjob;
             }

             if (flags & VIR_DOMAIN_AFFECT_CONFIG)
@@ -9756,7 +9759,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
             if (flags & VIR_DOMAIN_AFFECT_LIVE && value_ul) {
                 if ((rc = qemuSetEmulatorBandwidthLive(vm, priv->cgroup,
                                                        value_ul, 0)))
-                    goto cleanup;
+                    goto endjob;

                 vm->def->cputune.emulator_period = value_ul;

@@ -9764,7 +9767,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
                                             &eventMaxNparams,
                                             VIR_DOMAIN_TUNABLE_CPU_EMULATOR_PERIOD,
                                             value_ul) < 0)
-                    goto cleanup;
+                    goto endjob;
             }

             if (flags & VIR_DOMAIN_AFFECT_CONFIG)
@@ -9777,7 +9780,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
             if (flags & VIR_DOMAIN_AFFECT_LIVE && value_l) {
                 if ((rc = qemuSetEmulatorBandwidthLive(vm, priv->cgroup,
                                                        0, value_l)))
-                    goto cleanup;
+                    goto endjob;

                 vm->def->cputune.emulator_quota = value_l;

@@ -9785,7 +9788,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
                                            &eventMaxNparams,
                                            VIR_DOMAIN_TUNABLE_CPU_EMULATOR_QUOTA,
                                            value_l) < 0)
-                    goto cleanup;
+                    goto endjob;
             }

             if (flags & VIR_DOMAIN_AFFECT_CONFIG)
@@ -9794,7 +9797,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
     }

     if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
-        goto cleanup;
+        goto endjob;

     if (eventNparams) {
         event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
@@ -9806,7 +9809,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
         rc = virDomainSaveConfig(cfg->configDir, vmdef);
         if (rc < 0)
-            goto cleanup;
+            goto endjob;

         virDomainObjAssignDef(vm, vmdef, false, NULL);
         vmdef = NULL;
@@ -9814,6 +9817,9 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,

     ret = 0;

+ endjob:
+    qemuDomainObjEndJob(driver, vm);
+
  cleanup:
     virDomainDefFree(vmdef);
     qemuDomObjEndAPI(&vm);
-- 
2.2.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]