[pve-devel] [PATCH container] fix #2820: block adding new volume with same id if it's pending delete

Oguz Bektas o.bektas at proxmox.com
Tue Jun 30 15:56:44 CEST 2020


do a simple check to see if our $opt is already in the delete section.

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 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..237e2e5 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/) {
+		die "${opt} is in pending delete queue. please select another mountpoint 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