From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 B455A70911 for ; Tue, 14 Jun 2022 14:24:02 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A59551EFBA for ; Tue, 14 Jun 2022 14:23:32 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 8C01B1EFAF for ; Tue, 14 Jun 2022 14:23:31 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 62DB143B26 for ; Tue, 14 Jun 2022 14:23:31 +0200 (CEST) From: Daniel Tschlatscher To: pve-devel@lists.proxmox.com Date: Tue, 14 Jun 2022 14:22:42 +0200 Message-Id: <20220614122242.320670-1-d.tschlatscher@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.111 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [lxc.pm] Subject: [pve-devel] [PATCH container] fix: cloning a locked container creates an empty config X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jun 2022 12:24:02 -0000 When an attempt was made to clone a locked container the API would correctly present the error 'CT is locked (disk)' but create the config files for the new container anyway and then abort. The fix is to simply check whether the CT config is locked before creating the configs for the new container. Signed-off-by: Daniel Tschlatscher --- src/PVE/API2/LXC.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index 64724cb..e1b4cd3 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -1461,9 +1461,6 @@ __PACKAGE__->register_method({ my $vollist = []; my $running; - PVE::LXC::Config->create_and_lock_config($newid, 0); - PVE::Firewall::clone_vmfw_conf($vmid, $newid); - my $lock_and_reload = sub { my ($vmid, $code) = @_; return PVE::LXC::Config->lock_config($vmid, sub { @@ -1477,6 +1474,9 @@ __PACKAGE__->register_method({ my $src_conf = PVE::LXC::Config->set_lock($vmid, 'disk'); + PVE::LXC::Config->create_and_lock_config($newid, 0); + PVE::Firewall::clone_vmfw_conf($vmid, $newid); + $running = PVE::LXC::check_running($vmid) || 0; my $full = extract_param($param, 'full'); -- 2.30.2