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 2B8F3891D6 for ; Fri, 12 Aug 2022 09:14:47 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1EA9826F53 for ; Fri, 12 Aug 2022 09:14:17 +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 for ; Fri, 12 Aug 2022 09:14:15 +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 1BF2843444 for ; Fri, 12 Aug 2022 09:14:09 +0200 (CEST) Date: Fri, 12 Aug 2022 09:14:07 +0200 From: Wolfgang Bumiller To: Fiona Ebner Cc: pve-devel@lists.proxmox.com Message-ID: <20220812071407.na66gjdqokm6acsu@casey.proxmox.com> References: <20220808123642.2412163-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220808123642.2412163-1-f.ebner@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.279 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. [config.pm, proxmox.com] Subject: [pve-devel] applied: [PATCH container] apply pending mountpoint: also hotplug non-volume mount points 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: Fri, 12 Aug 2022 07:14:47 -0000 applied, thanks On Mon, Aug 08, 2022 at 02:36:42PM +0200, Fiona Ebner wrote: > Previously, bind and device mount points were applied to the > configuration, but not actually hot-plugged/mounted, causing a > mismatch for running containers. > > Reported in the community forum: > https://forum.proxmox.com/threads/113364/ > > Signed-off-by: Fiona Ebner > --- > > Better viewed with -w > > src/PVE/LXC/Config.pm | 60 +++++++++++++++++++++---------------------- > 1 file changed, 29 insertions(+), 31 deletions(-) > > diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm > index b4b0261..23c1ba7 100644 > --- a/src/PVE/LXC/Config.pm > +++ b/src/PVE/LXC/Config.pm > @@ -1471,40 +1471,38 @@ sub apply_pending_mountpoint { > > my $mp = $class->parse_volume($opt, $conf->{pending}->{$opt}); > my $old = $conf->{$opt}; > - if ($mp->{type} eq 'volume') { > - if ($mp->{volume} =~ $PVE::LXC::NEW_DISK_RE) { > - my $original_value = $conf->{pending}->{$opt}; > - my $vollist = PVE::LXC::create_disks( > - $storecfg, > - $vmid, > - { $opt => $original_value }, > - $conf, > - 1, > - ); > - if ($running) { > - # Re-parse mount point: > - my $mp = $class->parse_volume($opt, $conf->{pending}->{$opt}); > - eval { > - PVE::LXC::mountpoint_hotplug($vmid, $conf, $opt, $mp, $storecfg); > - }; > - my $err = $@; > - if ($err) { > - PVE::LXC::destroy_disks($storecfg, $vollist); > - # The pending-changes code collects errors but keeps on looping through further > - # pending changes, so unroll the change in $conf as well if destroy_disks() > - # didn't die(). > - $conf->{pending}->{$opt} = $original_value; > - die $err; > - } > - } > - } else { > - die "skip\n" if $running && defined($old); # TODO: "changing" mount points? > - $rescan_volume->($storecfg, $mp); > - if ($running) { > + if ($mp->{type} eq 'volume' && $mp->{volume} =~ $PVE::LXC::NEW_DISK_RE) { > + my $original_value = $conf->{pending}->{$opt}; > + my $vollist = PVE::LXC::create_disks( > + $storecfg, > + $vmid, > + { $opt => $original_value }, > + $conf, > + 1, > + ); > + if ($running) { > + # Re-parse mount point: > + my $mp = $class->parse_volume($opt, $conf->{pending}->{$opt}); > + eval { > PVE::LXC::mountpoint_hotplug($vmid, $conf, $opt, $mp, $storecfg); > + }; > + my $err = $@; > + if ($err) { > + PVE::LXC::destroy_disks($storecfg, $vollist); > + # The pending-changes code collects errors but keeps on looping through further > + # pending changes, so unroll the change in $conf as well if destroy_disks() > + # didn't die(). > + $conf->{pending}->{$opt} = $original_value; > + die $err; > } > - $conf->{pending}->{$opt} = $class->print_ct_mountpoint($mp); > } > + } else { > + die "skip\n" if $running && defined($old); # TODO: "changing" mount points? > + $rescan_volume->($storecfg, $mp) if $mp->{type} eq 'volume'; > + if ($running) { > + PVE::LXC::mountpoint_hotplug($vmid, $conf, $opt, $mp, $storecfg); > + } > + $conf->{pending}->{$opt} = $class->print_ct_mountpoint($mp); > } > > if (defined($old)) { > -- > 2.30.2