]> git.proxmox.com Git - pve-container.git/commitdiff
start: use root cpuset cgroup if the lxc one fails
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 25 Nov 2016 09:50:00 +0000 (10:50 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 25 Nov 2016 09:50:00 +0000 (10:50 +0100)
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

index ab16109cad5176a28b49349045752e283be5aafc..810fae57af5c153c1e833c96d40fba39ff8d5de7 100644 (file)
@@ -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)));