提交 8715120e 编写于 作者: P Peter Krempa

qemu: cgroup: Don't use priv->ncpupids to iterate domain vCPUs

Use the proper data structures for the iteration since ncpupids will be
made private later.
上级 ce43cca0
...@@ -820,7 +820,12 @@ qemuRestoreCgroupState(virDomainObjPtr vm) ...@@ -820,7 +820,12 @@ qemuRestoreCgroupState(virDomainObjPtr vm)
if (virCgroupSetCpusetMems(priv->cgroup, mem_mask) < 0) if (virCgroupSetCpusetMems(priv->cgroup, mem_mask) < 0)
goto error; 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, if (virCgroupNewThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, i,
false, &cgroup_temp) < 0 || false, &cgroup_temp) < 0 ||
virCgroupSetCpusetMemoryMigrate(cgroup_temp, true) < 0 || virCgroupSetCpusetMemoryMigrate(cgroup_temp, true) < 0 ||
...@@ -1036,7 +1041,12 @@ qemuSetupCgroupForVcpu(virDomainObjPtr vm) ...@@ -1036,7 +1041,12 @@ qemuSetupCgroupForVcpu(virDomainObjPtr vm)
&mem_mask, -1) < 0) &mem_mask, -1) < 0)
goto cleanup; 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); virCgroupFree(&cgroup_vcpu);
if (virCgroupNewThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, i, if (virCgroupNewThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, i,
true, &cgroup_vcpu) < 0) true, &cgroup_vcpu) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册