all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH container] apply pending mountpoint: also hotplug non-volume mount points
@ 2022-08-08 12:36 Fiona Ebner
  2022-08-12  7:14 ` [pve-devel] applied: " Wolfgang Bumiller
  0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2022-08-08 12:36 UTC (permalink / raw)
  To: pve-devel

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 <f.ebner@proxmox.com>
---

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH container] apply pending mountpoint: also hotplug non-volume mount points
  2022-08-08 12:36 [pve-devel] [PATCH container] apply pending mountpoint: also hotplug non-volume mount points Fiona Ebner
@ 2022-08-12  7:14 ` Wolfgang Bumiller
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Bumiller @ 2022-08-12  7:14 UTC (permalink / raw)
  To: Fiona Ebner; +Cc: pve-devel

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 <f.ebner@proxmox.com>
> ---
> 
> 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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-12  7:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-08 12:36 [pve-devel] [PATCH container] apply pending mountpoint: also hotplug non-volume mount points Fiona Ebner
2022-08-12  7:14 ` [pve-devel] applied: " Wolfgang Bumiller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal