Fixes some hotplug issues with containers still running
lxc 3.

Signed-off-by: Wolfgang Bumiller <w.bumil...@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


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to