mirror of https://gitee.com/openkylin/libvirt.git
qemu: qemuDomainHotplugVcpus - separate out the del cgroup and pin
Future IOThread setting patches would copy the code anyway, so create and generalize a delete cgroup and pindef for the vcpu into its own API. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
0ed8e47a7e
commit
97a1d94fa0
|
@ -4669,6 +4669,25 @@ qemuDomainAddCgroupForThread(virCgroupPtr cgroup,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
qemuDomainDelCgroupForThread(virCgroupPtr cgroup,
|
||||||
|
virCgroupThreadName nameval,
|
||||||
|
int index)
|
||||||
|
{
|
||||||
|
virCgroupPtr new_cgroup = NULL;
|
||||||
|
|
||||||
|
if (cgroup) {
|
||||||
|
if (virCgroupNewThread(cgroup, nameval, index, false, &new_cgroup) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* Remove the offlined cgroup */
|
||||||
|
virCgroupRemove(new_cgroup);
|
||||||
|
virCgroupFree(&new_cgroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
|
qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
|
@ -4823,16 +4842,10 @@ qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = oldvcpus - 1; i >= nvcpus; i--) {
|
for (i = oldvcpus - 1; i >= nvcpus; i--) {
|
||||||
if (priv->cgroup) {
|
if (qemuDomainDelCgroupForThread(priv->cgroup,
|
||||||
if (virCgroupNewThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, i,
|
VIR_CGROUP_THREAD_VCPU, i) < 0)
|
||||||
false, &cgroup_vcpu) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Remove cgroup for the offlined vcpu */
|
|
||||||
virCgroupRemove(cgroup_vcpu);
|
|
||||||
virCgroupFree(&cgroup_vcpu);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free vcpupin setting */
|
/* Free vcpupin setting */
|
||||||
virDomainPinDel(&vm->def->cputune.vcpupin,
|
virDomainPinDel(&vm->def->cputune.vcpupin,
|
||||||
&vm->def->cputune.nvcpupin,
|
&vm->def->cputune.nvcpupin,
|
||||||
|
|
Loading…
Reference in New Issue