[pve-devel] [PATCH container] Add unused volume when mp is modified

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Feb 16 11:21:35 CET 2016


Add an unusedX entry for the old value when a mpY entry is
updated. This is already done on mp deletion.
---
 src/PVE/LXC.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index a737fc0..84aba83 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1352,6 +1352,12 @@ sub update_pct_config {
         } elsif ($opt =~ m/^mp(\d+)$/) {
 	    next if $hotplug_error->($opt);
 	    check_protection($conf, "can't update CT $vmid drive '$opt'");
+	    if (defined($conf->{$opt})) {
+		my $mountpoint = parse_ct_mountpoint($conf->{$opt});
+		if ($mountpoint->{type} eq 'volume') {
+		    add_unused_volume($conf, $mountpoint->{volume})
+		}
+	    }
 	    $conf->{$opt} = $value;
 	    $new_disks = 1;
         } elsif ($opt eq 'rootfs') {
-- 
2.1.4





More information about the pve-devel mailing list