]> git.proxmox.com Git - pve-manager.git/commitdiff
rebalance_lxc_containers: make it work with new lxc/<ID>/ns subgroup
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 21 Dec 2016 10:04:33 +0000 (11:04 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 21 Dec 2016 10:04:33 +0000 (11:04 +0100)
PVE/Service/pvestatd.pm

index 377483341b9b5ade17a0458b5b64b855f2529107..74813877a0e11c9e0625fafbeb7d454b9b420971 100755 (executable)
@@ -334,7 +334,21 @@ sub rebalance_lxc_containers {
        if (!$newset->is_equal($cpuset)) {
            syslog('info', "modified cpu set for lxc/$vmid: " .
                   $newset->short_string());
-           eval { $newset->write_to_cgroup("lxc/$vmid"); };
+           eval {
+               # allow all, so that we can set new cpuset in /ns
+               $all_cpus->write_to_cgroup("lxc/$vmid");
+               eval {
+                   $newset->write_to_cgroup("lxc/$vmid/ns");
+               };
+               if (my $err = $@) {
+                   warn $err;
+                   # restore original
+                   $cpuset->write_to_cgroup("lxc/$vmid");
+               } else {
+                   # also apply to container root cgroup
+                   $newset->write_to_cgroup("lxc/$vmid");
+               }
+           };
            warn $@ if $@;
        }
     }