[PATCH 34/34] qemu: cgroup: Don't use priv->ncpupids to iterate domain vCPUs

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

 



Use the proper data structures for the iteration since ncpupids will be
made private later.
---
 src/qemu/qemu_cgroup.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index d8a2b03..06c20c1 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -800,7 +800,12 @@ qemuRestoreCgroupState(virDomainObjPtr vm)
     if (virCgroupSetCpusetMems(priv->cgroup, mem_mask) < 0)
         goto error;

-    for (i = 0; i < priv->nvcpupids; i++) {
+    for (i = 0; i < virDomainDefGetVCpusMax(vm->def); i++) {
+        virDomainVCpuInfoPtr vcpu = virDomainDefGetVCpu(vm->def, i);
+
+        if (!vcpu->online)
+            continue;
+
         if (virCgroupNewThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, i,
                                false, &cgroup_temp) < 0 ||
             virCgroupSetCpusetMemoryMigrate(cgroup_temp, true) < 0 ||
@@ -1016,7 +1021,12 @@ qemuSetupCgroupForVcpu(virDomainObjPtr vm)
                                             &mem_mask, -1) < 0)
         goto cleanup;

-    for (i = 0; i < priv->nvcpupids; i++) {
+    for (i = 0; i < virDomainDefGetVCpusMax(def); i++) {
+        virDomainVCpuInfoPtr vcpu = virDomainDefGetVCpu(def, i);
+
+        if (!vcpu->online)
+            continue;
+
         virCgroupFree(&cgroup_vcpu);
         if (virCgroupNewThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, i,
                                true, &cgroup_vcpu) < 0)
-- 
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]