[pve-devel] [PATCH container 1/3] commands: add freeze and unfreeze

Wolfgang Bumiller w.bumiller at proxmox.com
Thu May 14 15:22:29 CEST 2020


Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 src/PVE/LXC/Command.pm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

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





More information about the pve-devel mailing list