mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 09:14:57 +00:00
qemu: fix domain startup failing with 'strict' mode in numatune
If the memory mode is specified as 'strict' and with one node, we
get the following error when starting domain.
error: Unable to write to '$cgroup_path/cpuset.mems': Device or resource busy
XML is configured with numatune as follows:
<numatune>
<memory mode='strict' nodeset='0'/>
</numatune>
It's broken by Commit 411cea638f
which moved qemuSetupCgroupForEmulator() before setting cpuset.mems
in qemuSetupCgroupPostInit.
Directory '$cgroup_path/emulator/' is created in qemuSetupCgroupForEmulator.
But '$cgroup_path/emulator/cpuset.mems' it not set and has a default value
(all nodes, such as 0-1). Then we setup '$cgroup_path/cpuset.mems' to the
nodemask (in this case it's '0') in qemuSetupCgroupPostInit. It must fail.
This patch makes '$cgroup_path/emulator/cpuset.mems' is set before
'$cgroup_path/cpuset.mems'. The action is similar with that in
qemuDomainSetNumaParamsLive.
Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
This commit is contained in:
parent
8a3844f818
commit
c6e9024867
@ -611,6 +611,7 @@ static int
|
||||
qemuSetupCpusetMems(virDomainObjPtr vm,
|
||||
virBitmapPtr nodemask)
|
||||
{
|
||||
virCgroupPtr cgroup_temp = NULL;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
char *mem_mask = NULL;
|
||||
int ret = -1;
|
||||
@ -627,13 +628,16 @@ qemuSetupCpusetMems(virDomainObjPtr vm,
|
||||
&mem_mask, -1) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (mem_mask &&
|
||||
if (mem_mask)
|
||||
if (virCgroupNewEmulator(priv->cgroup, false, &cgroup_temp) < 0 ||
|
||||
virCgroupSetCpusetMems(cgroup_temp, mem_mask) < 0 ||
|
||||
virCgroupSetCpusetMems(priv->cgroup, mem_mask) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
VIR_FREE(mem_mask);
|
||||
virCgroupFree(&cgroup_temp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user