[PATCH 32/34] qemu: vcpu: Reuse qemuProcessSetupVcpu in vcpu hotplug

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

 



Since majority of the steps is shared, the function can be reused to
simplify code.

Additionally this resolves
https://bugzilla.redhat.com/show_bug.cgi?id=1244128 since the cpu
bandwidth limiting with cgroups would not be set on the hotplug path.
---
 src/qemu/qemu_driver.c | 35 +----------------------------------
 1 file changed, 1 insertion(+), 34 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 34e82c2..71a35e4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4657,10 +4657,6 @@ qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver,
     int ret = -1;
     int rc;
     int oldvcpus = virDomainDefGetVcpus(vm->def);
-    virCgroupPtr cgroup_vcpu = NULL;
-    char *mem_mask = NULL;
-    virDomainNumatuneMemMode mem_mode;
-    pid_t vcpupid;

     if (!(vcpuinfo = virDomainDefGetVcpu(vm->def, vcpu)))
         return -1;
@@ -4688,41 +4684,12 @@ qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver,
     if (qemuDomainDetectVcpuPids(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)
         goto cleanup;

-    vcpupid = qemuDomainGetVcpuPid(vm, vcpu);
-
-    if (virDomainNumatuneGetMode(vm->def->numa, -1, &mem_mode) == 0 &&
-        mem_mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT &&
-        virDomainNumatuneMaybeFormatNodeset(vm->def->numa,
-                                            priv->autoNodeset,
-                                            &mem_mask, -1) < 0)
-        goto cleanup;
-
-    if (priv->cgroup) {
-        cgroup_vcpu = qemuDomainAddCgroupForThread(priv->cgroup,
-                                                   VIR_CGROUP_THREAD_VCPU,
-                                                   vcpu, mem_mask, vcpupid);
-        if (!cgroup_vcpu)
-            goto cleanup;
-    }
-
-    /* Inherit def->cpuset */
-    if (vm->def->cpumask) {
-        if (qemuDomainHotplugPinThread(vm->def->cpumask, vcpu, vcpupid,
-                                       cgroup_vcpu) < 0) {
-            goto cleanup;
-        }
-    }
-
-    if (vcpuinfo->sched.policy != VIR_PROC_POLICY_NONE &&
-        virProcessSetScheduler(vcpupid, vcpuinfo->sched.policy,
-                               vcpuinfo->sched.priority) < 0)
+    if (qemuProcessSetupVcpu(vm, vcpu) < 0)
         goto cleanup;

     ret = 0;

  cleanup:
-    VIR_FREE(mem_mask);
-    virCgroupFree(&cgroup_vcpu);
     return ret;
 }

-- 
2.6.2

--
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]