From 6560ce0fc847b896fa6ab858c46e3db15c8a0994 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 25 Nov 2016 10:50:00 +0100 Subject: [PATCH] start: use root cpuset cgroup if the lxc one fails This happens when no container has been started yet and the lxc/ directory has not yet been created in the cpuset cgroup. --- src/PVE/LXC.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index ab16109..810fae5 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -451,7 +451,8 @@ sub update_lxc_config { my $cores = $conf->{cores}; if (!$had_cpuset && $cores) { - my $cpuset = PVE::CpuSet->new_from_cgroup('lxc', 'effective_cpus'); + my $cpuset = eval { PVE::CpuSet->new_from_cgroup('lxc', 'effective_cpus') }; + $cpuset = PVE::CpuSet->new_from_cgroup('', 'effective_cpus') if !$cpuset; my @members = $cpuset->members(); while (scalar(@members) > $cores) { my $randidx = int(rand(scalar(@members))); -- 2.39.2