v2 changes:

- protection mode removal prevention

- disk removal prevention
---
 src/PVE/LXC.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index ebf5d23..4cb7809 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -179,7 +179,7 @@ my $confdesc = {
     protection => {
        optional => 1,
        type => 'boolean',
-       description => "Sets the protection flag of the container. This will 
prevent the remove operation.",
+       description => "Sets the protection flag of the container. This will 
prevent the container or container's disk remove operation.",
        default => 0,
     },
 };
@@ -1108,13 +1108,18 @@ sub update_pct_config {
                my $netid = $1;
                PVE::Network::veth_delete("veth${vmid}i$netid");
            } elsif ($opt eq 'protection') {
+               die "can't delete CT $vmid protection option - protection mode 
enabled\n"
+                   if ($conf->{protection} == 1);
                delete $conf->{$opt};
            } elsif ($opt =~ m/^mp(\d+)$/) {
+               die "can't remove CT $vmid storage - protection mode enabled\n"
+                    if ($conf->{protection} == 1);
                delete $conf->{$opt};
                push @nohotplug, $opt;
                next if $running;
            } elsif ($opt eq 'rootfs') {
-               die "implement me"
+               die "can't remove CT $vmid storage - protection mode enabled\n"
+                   if ($conf->{protection} == 1);
            } else {
                die "implement me"
            }
-- 
2.1.4


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

Reply via email to