mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu_driver: fix setting vcpus for offline domain
Commit e3435caf fixed hot-plugging of vcpus with strict memory pinning on NUMA hosts, but unfortunately it also broke updating number of vcpus for offline guests using our API. The issue is that we try to create a cpu cgroup for non-running guest which fails as there are no cgroups for that domain. We should create cgroups and update cpuset.mems only if we are hot-plugging. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
04cf99a6b6
commit
e105dc9814
@ -4576,6 +4576,10 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
|
||||
priv = vm->privateData;
|
||||
|
||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (flags & VIR_DOMAIN_AFFECT_LIVE && !(flags & VIR_DOMAIN_VCPU_GUEST)) {
|
||||
if (virCgroupNewEmulator(priv->cgroup, false, &cgroup_temp) < 0)
|
||||
goto cleanup;
|
||||
|
||||
@ -4585,12 +4589,10 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
if (!(all_nodes_str = virBitmapFormat(all_nodes)))
|
||||
goto cleanup;
|
||||
|
||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virCgroupGetCpusetMems(cgroup_temp, &mem_mask) < 0 ||
|
||||
virCgroupSetCpusetMems(cgroup_temp, all_nodes_str) < 0)
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
maximum = (flags & VIR_DOMAIN_VCPU_MAXIMUM) != 0;
|
||||
flags &= ~VIR_DOMAIN_VCPU_MAXIMUM;
|
||||
|
Loading…
x
Reference in New Issue
Block a user