From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <s.ivanov@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 792006AE67
 for <pve-devel@lists.proxmox.com>; Mon, 25 Jan 2021 14:22:44 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 6B0D8A9E0
 for <pve-devel@lists.proxmox.com>; Mon, 25 Jan 2021 14:22:14 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id D46B7A9CF
 for <pve-devel@lists.proxmox.com>; Mon, 25 Jan 2021 14:22:12 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id A10A94555C
 for <pve-devel@lists.proxmox.com>; Mon, 25 Jan 2021 14:22:12 +0100 (CET)
Date: Mon, 25 Jan 2021 14:22:11 +0100
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: Wolfgang Bumiller <w.bumiller@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Message-ID: <20210125142211.342feeee@rosa.proxmox.com>
In-Reply-To: <20210125110532.20342-1-w.bumiller@proxmox.com>
References: <20210125110532.20342-1-w.bumiller@proxmox.com>
X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.066 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pve-devel] [PATCH container] use monitor commands to freeze on
 pure-v2 setups
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 25 Jan 2021 13:22:44 -0000

Gave the patch a spin on a v2-only system.
* it fixes the issue as described

we had a short chat off-list with Wolfgang - and considered restructuring
the code a bit (currently the patch makes parts of PVE::CGroup dead code)

but for alleviating the immediate issue:
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>


On Mon, 25 Jan 2021 12:05:32 +0100
Wolfgang Bumiller <w.bumiller@proxmox.com> wrote:

> 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;