all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH container] use monitor commands to freeze on pure-v2 setups
Date: Mon, 25 Jan 2021 12:05:32 +0100	[thread overview]
Message-ID: <20210125110532.20342-1-w.bumiller@proxmox.com> (raw)

even an explicit query for the 'unified' cgroup hierarchy
does not work on lxc when run in a pure v2 environment via
the kernel options

    systemd.unified_cgroup_hierarchy=1 cgroup_no_v1=all

so let's use the freeze commands provided by lxc we already
have code for...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
See-also: https://forum.proxmox.com/threads/short-read-on-command-socket-error-when-running-backup-of-lxc-containers.82978/
---
 src/PVE/LXC.pm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index e7a6951..7e84a0e 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -2463,12 +2463,20 @@ sub get_lxc_version() {
 
 sub freeze($) {
     my ($vmid) = @_;
-    PVE::LXC::CGroup->new($vmid)->freeze_thaw(1);
+    if (PVE::CGroup::cgroup_mode() == 2) {
+	PVE::LXC::Command::freeze($vmid, 30);
+    } else {
+	PVE::LXC::CGroup->new($vmid)->freeze_thaw(1);
+    }
 }
 
 sub thaw($) {
     my ($vmid) = @_;
-    PVE::LXC::CGroup->new($vmid)->freeze_thaw(0);
+    if (PVE::CGroup::cgroup_mode() == 2) {
+	PVE::LXC::Command::unfreeze($vmid, 30);
+    } else {
+	PVE::LXC::CGroup->new($vmid)->freeze_thaw(0);
+    }
 }
 
 1;
-- 
2.20.1





             reply	other threads:[~2021-01-25 11:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 11:05 Wolfgang Bumiller [this message]
2021-01-25 13:22 ` Stoiko Ivanov
2021-01-26 17:26 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210125110532.20342-1-w.bumiller@proxmox.com \
    --to=w.bumiller@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal