[pve-devel] applied: [PATCH container] apply pending mountpoint: also hotplug non-volume mount points

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Aug 12 09:14:07 CEST 2022


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 at 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





More information about the pve-devel mailing list