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 9223F70945 for ; Tue, 14 Jun 2022 14:52:24 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 82B471F502 for ; Tue, 14 Jun 2022 14:51:54 +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)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id BF5CC1F4F9 for ; Tue, 14 Jun 2022 14:51:53 +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 92ABA43B1C for ; Tue, 14 Jun 2022 14:51:53 +0200 (CEST) Date: Tue, 14 Jun 2022 14:51:33 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20220614122242.320670-1-d.tschlatscher@proxmox.com> In-Reply-To: <20220614122242.320670-1-d.tschlatscher@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Message-Id: <1655211024.erde2ks6ir.astroid@nora.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.170 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, proxmox.com] Subject: Re: [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:52:24 -0000 On June 14, 2022 2:22 pm, Daniel Tschlatscher wrote: > 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. >=20 > The fix is to simply check whether the CT config is locked before > creating the configs for the new container. is there a reason for not just moving it to the start of the eval block=20 to avoid the same problem being re-introduced in the future? any error=20 occuring inside the eval block will then trigger a cleanup.. >=20 > Signed-off-by: Daniel Tschlatscher > --- > src/PVE/API2/LXC.pm | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > 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 =3D []; > my $running; > =20 > - PVE::LXC::Config->create_and_lock_config($newid, 0); > - PVE::Firewall::clone_vmfw_conf($vmid, $newid); > - > my $lock_and_reload =3D sub { > my ($vmid, $code) =3D @_; > return PVE::LXC::Config->lock_config($vmid, sub { > @@ -1477,6 +1474,9 @@ __PACKAGE__->register_method({ > =20 > my $src_conf =3D PVE::LXC::Config->set_lock($vmid, 'disk'); > =20 > + PVE::LXC::Config->create_and_lock_config($newid, 0); > + PVE::Firewall::clone_vmfw_conf($vmid, $newid); > + > $running =3D PVE::LXC::check_running($vmid) || 0; > =20 > my $full =3D extract_param($param, 'full'); > --=20 > 2.30.2 >=20 >=20 >=20 > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >=20 >=20 >=20