[pve-devel] [PATCH v2 container] fix #2820: block adding new volume with same id if it's pending delete
Oguz Bektas
o.bektas at proxmox.com
Wed Jul 1 11:56:36 CEST 2020
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.bektas at proxmox.com>
---
v1->v2:
* use exact matching
* change full stop to comma
* s/mountpoint/mount point/
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
More information about the pve-devel
mailing list