my $storage_cfg = cfs_read_file("storage.cfg");
+ die "can't remove CT $vmid - protection mode enabled\n"
+ if ($conf->{protection} == 1);
+
die "unable to remove CT $vmid - used in HA resources\n"
if PVE::HA::Config::vm_is_ha_managed($vmid);
enum => ['shell', 'console', 'tty'],
default => 'tty',
},
+ protection => {
+ optional => 1,
+ type => 'boolean',
+ description => "Sets the protection flag of the container. This will prevent the remove operation.",
+ default => 0,
+ },
};
my $valid_lxc_conf_keys = {
next if !$running;
my $netid = $1;
PVE::Network::veth_delete("veth${vmid}i$netid");
+ } elsif ($opt eq 'protection') {
+ delete $conf->{$opt};
} elsif ($opt =~ m/^mp(\d+)$/) {
delete $conf->{$opt};
push @nohotplug, $opt;
} else {
update_net($vmid, $conf, $opt, $net, $netid, $rootdir);
}
+ } elsif ($opt eq 'protection') {
+ $conf->{$opt} = $value ? 1 : 0;
} elsif ($opt =~ m/^mp(\d+)$/) {
$conf->{$opt} = $value;
push @$new_disks, $opt;