[pve-devel] [PATCH v2 container 2/7] get_cgroup_path: add fallback for lxc 3

Wolfgang Bumiller w.bumiller at proxmox.com
Fri May 15 11:08:37 CEST 2020


Fixes some hotplug issues with containers still running
lxc 3.

Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
New in this version. This was previously part of the freeze code but is
actually required in general for hotplugging (which previously used the
old non-limiting path and therefore still mostly worked, but could fail
under some circumstances and wouldn't properly keep hotplugged changes
enforced on privileged containers).

 src/PVE/LXC/Command.pm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/PVE/LXC/Command.pm b/src/PVE/LXC/Command.pm
index bcc481d..beed890 100644
--- a/src/PVE/LXC/Command.pm
+++ b/src/PVE/LXC/Command.pm
@@ -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:
-- 
2.20.1





More information about the pve-devel mailing list