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 B90968AD62 for ; Mon, 8 Aug 2022 14:37:18 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A37202438F for ; Mon, 8 Aug 2022 14:36:48 +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 for ; Mon, 8 Aug 2022 14:36:46 +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 A76B843186 for ; Mon, 8 Aug 2022 14:36:46 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Mon, 8 Aug 2022 14:36:42 +0200 Message-Id: <20220808123642.2412163-1-f.ebner@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.045 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 - Subject: [pve-devel] [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: Mon, 08 Aug 2022 12:37:18 -0000 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