[PATCH 2/7] qemu: Fix job handling in qemuDomainPinEmulator

[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 | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4882cab..fa2259a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5116,17 +5116,20 @@ qemuDomainPinEmulator(virDomainPtr dom,

     pid = vm->pid;

+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
+        goto cleanup;
+
     if (flags & VIR_DOMAIN_AFFECT_LIVE) {

         if (priv->vcpupids != NULL) {
             if (VIR_ALLOC(newVcpuPin) < 0)
-                goto cleanup;
+                goto endjob;

             if (virDomainVcpuPinAdd(&newVcpuPin, &newVcpuPinNum, cpumap, maplen, -1) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                _("failed to update vcpupin"));
                 virDomainVcpuPinDefArrayFree(newVcpuPin, newVcpuPinNum);
-                goto cleanup;
+                goto endjob;
             }

             if (virCgroupHasController(priv->cgroup,
@@ -5135,20 +5138,20 @@ qemuDomainPinEmulator(virDomainPtr dom,
                  * Configure the corresponding cpuset cgroup.
                  */
                 if (virCgroupNewEmulator(priv->cgroup, false, &cgroup_emulator) < 0)
-                    goto cleanup;
+                    goto endjob;
                 if (qemuSetupCgroupEmulatorPin(cgroup_emulator,
                                                newVcpuPin[0]->cpumask) < 0) {
                     virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                                    _("failed to set cpuset.cpus in cgroup"
                                      " for emulator threads"));
-                    goto cleanup;
+                    goto endjob;
                 }
             } else {
                 if (virProcessSetAffinity(pid, pcpumap) < 0) {
                     virReportError(VIR_ERR_SYSTEM_ERROR, "%s",
                                    _("failed to set cpu affinity for "
                                      "emulator threads"));
-                    goto cleanup;
+                    goto endjob;
                 }
             }

@@ -5157,7 +5160,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
                     virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                    _("failed to delete emulatorpin xml of "
                                      "a running domain"));
-                    goto cleanup;
+                    goto endjob;
                 }
             } else {
                 virDomainVcpuPinDefFree(vm->def->cputune.emulatorpin);
@@ -5170,18 +5173,18 @@ qemuDomainPinEmulator(virDomainPtr dom,
         } else {
             virReportError(VIR_ERR_OPERATION_INVALID,
                            "%s", _("cpu affinity is not supported"));
-            goto cleanup;
+            goto endjob;
         }

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

         str = virBitmapFormat(pcpumap);
         if (virTypedParamsAddString(&eventParams, &eventNparams,
                                     &eventMaxparams,
                                     VIR_DOMAIN_TUNABLE_CPU_EMULATORPIN,
                                     str) < 0)
-            goto cleanup;
+            goto endjob;

         event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
     }
@@ -5193,23 +5196,26 @@ qemuDomainPinEmulator(virDomainPtr dom,
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                _("failed to delete emulatorpin xml of "
                                  "a persistent domain"));
-                goto cleanup;
+                goto endjob;
             }
         } else {
             if (virDomainEmulatorPinAdd(persistentDef, cpumap, maplen) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                _("failed to update or add emulatorpin xml "
                                  "of a persistent domain"));
-                goto cleanup;
+                goto endjob;
             }
         }

         ret = virDomainSaveConfig(cfg->configDir, persistentDef);
-        goto cleanup;
+        goto endjob;
     }

     ret = 0;

+ endjob:
+    qemuDomainObjEndJob(driver, vm);
+
  cleanup:
     if (cgroup_emulator)
         virCgroupFree(&cgroup_emulator);
-- 
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]