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) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 5D64973218 for ; Thu, 27 May 2021 07:37:44 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4980019EBB for ; Thu, 27 May 2021 07:37:14 +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 89CC619EAF for ; Thu, 27 May 2021 07:37:13 +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 56B5B425A5 for ; Thu, 27 May 2021 07:37:13 +0200 (CEST) Date: Thu, 27 May 2021 07:37:04 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20210526141840.1450325-1-o.bektas@proxmox.com> <20210526141840.1450325-3-o.bektas@proxmox.com> In-Reply-To: <20210526141840.1450325-3-o.bektas@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Message-Id: <1622093373.x7tzw9zrev.astroid@nora.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.010 Adjusted score from AWL reputation of From: address 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 Subject: Re: [pve-devel] [PATCH v2 container 2/2] clear /etc/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, 27 May 2021 05:37:44 -0000 On May 26, 2021 4:18 pm, 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 > --- >=20 > src/PVE/API2/LXC.pm | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) >=20 > diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm > index a9ea3a6..413f466 100644 > --- a/src/PVE/API2/LXC.pm > +++ b/src/PVE/API2/LXC.pm > @@ -1594,7 +1594,24 @@ __PACKAGE__->register_method({ > }; > =20 > PVE::Firewall::clone_vmfw_conf($vmid, $newid); > - return $rpcenv->fork_worker('vzclone', $vmid, $authuser, $realcmd); > + > + my $task =3D eval { > + return $rpcenv->fork_worker('vzclone', $vmid, $authuser, $realcmd); this forks the task worker that does the actual cloning of=20 mountpoints/volumes, so after this point that code ($realcmd) will run=20 concurrent to the rest of the API worker itself handling the request. doing anything after forking the task worker is almost always wrong. > + }; > + if (my $err =3D $@) { > + warn $@ if $@; > + die $err; > + } > + > + my $lastconf =3D PVE::LXC::Config->load_config($newid); this config might or might not contain any of the updated/cloned=20 volumes, this is entirely up to the speed of cloning > + my $rootdir =3D PVE::LXC::mount_all($newid, $storecfg, $lastconf, 1); so this might or might not mount anything? > + 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); in which case this might or might not do anything > + > + return $task; why do you not simply clear the machine ID at the end of the task=20 worker? > + > + > }}); > =20 > =20 > --=20 > 2.20.1 >=20 >=20 > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >=20 >=20 >=20 =