]> git.proxmox.com Git - pve-container.git/commitdiff
get_cgroup_path: add fallback for lxc 3
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 15 May 2020 09:08:37 +0000 (11:08 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 May 2020 11:48:26 +0000 (13:48 +0200)
Fixes some hotplug issues with containers still running
lxc 3.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/LXC/Command.pm

index bcc481d5bf77c5f19e41c507d1144a3d5934377d..beed8906273f6a592c3506324921a9b6b979443d 100644 (file)
@@ -169,6 +169,17 @@ sub get_cgroup_path($;$$) {
        $limiting ? LXC_CMD_GET_LIMITING_CGROUP : LXC_CMD_GET_CGROUP,
        defined($subsystem) && pack('Z*', $subsystem),
     );
+    if (!defined($res) && defined($subsystem)) {
+       # If the container was started with an older lxc the above command
+       # failed as it does not have an LXC_CMD_GET_LIMITING_CGROUP command
+       # yet. Instead, we had this as an additional parameter in the subsystem
+       # name.
+       ($res, $data) = simple_command(
+           $vmid,
+           LXC_CMD_GET_CGROUP,
+           pack('Z*C', $subsystem, 1),
+       );
+    }
     return undef if !defined $res;
 
     # data is a zero-terminated string: