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 9EFEB7142B for ; Thu, 10 Jun 2021 13:52:20 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8D1BE2E9EC for ; Thu, 10 Jun 2021 13:51:50 +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 CA0AB2E9D6 for ; Thu, 10 Jun 2021 13:51:49 +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 940B346755 for ; Thu, 10 Jun 2021 13:51:49 +0200 (CEST) Date: Thu, 10 Jun 2021 13:51:42 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20210527092601.148400-1-o.bektas@proxmox.com> <20210527092601.148400-3-o.bektas@proxmox.com> In-Reply-To: <20210527092601.148400-3-o.bektas@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Message-Id: <1623325655.31c1k050qm.astroid@nora.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.908 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com, lxc.pm] Subject: Re: [pve-devel] [PATCH v3 container 2/2] clear machine-id also after container clone 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: Thu, 10 Jun 2021 11:52:20 -0000 On May 27, 2021 11:26 am, Oguz Bektas wrote: > pass $clone=3D1 to avoid removing the file. instead we truncate it to an > empty file >=20 > Signed-off-by: Oguz Bektas > --- > v2->v3: > * clear machine-id at the end of clone task worker >=20 > src/PVE/API2/LXC.pm | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm > index a9ea3a6..d5c12dc 100644 > --- a/src/PVE/API2/LXC.pm > +++ b/src/PVE/API2/LXC.pm > @@ -1590,6 +1590,12 @@ __PACKAGE__->register_method({ > die "clone failed: $err"; > } > =20 > + my $lastconf =3D PVE::LXC::Config->load_config($newid); > + my $rootdir =3D PVE::LXC::mount_all($newid, $storecfg, $lastconf, 1= ); > + my $lxc_setup =3D PVE::LXC::Setup->new($lastconf, $rootdir); > + $lxc_setup->clear_machine_id($lastconf, 1); > + PVE::LXC::umount_all($newid, $storecfg, $lastconf, 1); this is dangerous - the config is not locked anymore at this point, and=20 we don't hold any other lock either! another unrelated thing I just noticed - in case the clone fails, we=20 don't remove a potentially cloned firewall config.. > + > return; > }; > =20 > --=20 > 2.20.1 >=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