On July 1, 2020 11:56 am, Oguz Bektas wrote:
> if a user tries to add a mountpoint mpX which is waiting for a pending
> delete, hotplugging a new mountpoint with name mpX before the
> previous one is detached should not be allowed.
> 
> do a simple check to see if the given mpX is already in the pending delete 
> section.
> 
> Signed-off-by: Oguz Bektas <o.bek...@proxmox.com>
> ---
> 
> v1->v2:
> * use exact matching

this is still not exact matching. split the list, look for an exact 
match

> * change full stop to comma
> * s/mountpoint/mount point/

you did not address my question on why you die, instead of just blocking 
hotplugging..

> 
> 
>  src/PVE/LXC/Config.pm | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
> index 0a28380..f582eb8 100644
> --- a/src/PVE/LXC/Config.pm
> +++ b/src/PVE/LXC/Config.pm
> @@ -974,6 +974,9 @@ sub update_pct_config {
>       my $value = $param->{$opt};
>       if ($opt =~ m/^mp(\d+)$/ || $opt eq 'rootfs') {
>           $class->check_protection($conf, "can't update CT $vmid drive 
> '$opt'");
> +         if ($conf->{pending}->{delete} =~ m/$opt\b/) {
> +             die "${opt} is in pending delete queue, please choose another 
> mount point ID\n";
> +         }
>           my $mp = $class->parse_volume($opt, $value);
>           $check_content_type->($mp) if ($mp->{type} eq 'volume');
>       } elsif ($opt eq 'hookscript') {
> -- 
> 2.20.1
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to