[pve-devel] [PATCH container] start: use root cpuset cgroup if the lxc one fails

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Nov 25 10:51:51 CET 2016


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.1.4





More information about the pve-devel mailing list