mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 09:17:52 +03:00
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.
This commit is contained in:
parent
ce43cca0eb
commit
8715120e4d
@ -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)
|
|||||||
&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)
|
||||||
|
Loading…
Reference in New Issue
Block a user