]> git.proxmox.com Git - pve-container.git/commitdiff
commands: add freeze and unfreeze
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 15 May 2020 09:08:36 +0000 (11:08 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 May 2020 11:48:26 +0000 (13:48 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/LXC/Command.pm

index 0a52d47f4d54f534e17418fb4baecb2ce0e8b556..bcc481d5bf77c5f19e41c507d1144a3d5934377d 100644 (file)
@@ -16,6 +16,8 @@ use base 'Exporter';
 
 use constant {
     LXC_CMD_GET_CGROUP => 6,
+    LXC_CMD_FREEZE => 15,
+    LXC_CMD_UNFREEZE => 16,
     LXC_CMD_GET_LIMITING_CGROUP => 19,
 };
 
@@ -173,4 +175,24 @@ sub get_cgroup_path($;$$) {
     return unpack('Z*', $data);
 }
 
+# Send a freeze a container. This only makes sense on a pure cgroupv2 host.
+sub freeze($$) {
+    my ($vmid, $timeout) = @_;
+
+    my ($res, undef) =
+       simple_command($vmid, LXC_CMD_FREEZE, pack('l!', $timeout));
+
+    return $res;
+}
+
+# Send an unfreeze a container. This only makes sense on a pure cgroupv2 host.
+sub unfreeze($$) {
+    my ($vmid, $timeout) = @_;
+
+    my ($res, undef) =
+       simple_command($vmid, LXC_CMD_UNFREEZE, pack('l!', $timeout));
+
+    return $res;
+}
+
 1;