[libvirt] [PATCH] lxc: fix 2 issue around cpuset
Luyao Huang
lhuang at redhat.com
Fri Apr 3 10:11:15 UTC 2015
There are two bugs in this function:
1. cannot start a vm with cpuset but without numatune settings
# virsh -c lxc:/// start helloworld
error: Failed to start domain helloworld
error: internal error: guest failed to start: Invalid value '1-3' for 'cpuset.mems': Invalid argument
we don't free &mask after use it for virCgroupSetCpusetCpus() and
then virDomainNumatuneMaybeFormatNodeset() do not get a new &mask,
then we use it in virCgroupSetCpusetMems().
2. when start a lxc with numatune memory mode not strict
# virsh -c lxc:/// start helloworld
error: Failed to start domain helloworld
error: internal error: guest failed to start: Unknown failure in libvirt_lxc startup
We shouldn't set anything in cpuset.mems for these mode.
Signed-off-by: Luyao Huang <lhuang at redhat.com>
---
src/lxc/lxc_cgroup.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index c1813e2..5e959a2 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -77,11 +77,15 @@ static int virLXCCgroupSetupCpusetTune(virDomainDefPtr def,
if (virCgroupSetCpusetCpus(cgroup, mask) < 0)
goto cleanup;
+ /* free mask to make sure we won't use it in a wrong way later */
+ VIR_FREE(mask);
}
if (virDomainNumatuneGetMode(def->numa, -1) !=
- VIR_DOMAIN_NUMATUNE_MEM_STRICT)
+ VIR_DOMAIN_NUMATUNE_MEM_STRICT) {
+ ret = 0;
goto cleanup;
+ }
if (virDomainNumatuneMaybeFormatNodeset(def->numa, nodemask,
&mask, -1) < 0)
--
1.8.3.1
More information about the libvir-list
mailing list