]> git.proxmox.com Git - pve-container.git/blobdiff - src/PVE/API2/LXC.pm
CT protection mode
[pve-container.git] / src / PVE / API2 / LXC.pm
index e1f57da3db3025590306264a1d1a1dfefebb3280..085a69683792b2eda65f4b32f4419973f7c8d779 100644 (file)
@@ -172,6 +172,9 @@ __PACKAGE__->register_method({
 
        if (!($same_container_exists && $restore && $force)) {
            PVE::Cluster::check_vmid_unused($vmid);
+       } else {
+           my $conf = PVE::LXC::load_config($vmid);
+           PVE::LXC::check_protection($conf, "unable to restore CT $vmid");
        }
 
        my $password = extract_param($param, 'password');
@@ -463,8 +466,7 @@ __PACKAGE__->register_method({
 
        my $storage_cfg = cfs_read_file("storage.cfg");
 
-       die  "can't remove CT $vmid - protection mode enabled\n"
-           if $conf->{protection};
+       PVE::LXC::check_protection($conf, "can't remove CT $vmid");
 
        die "unable to remove CT $vmid - used in HA resources\n"
            if PVE::HA::Config::vm_is_ha_managed($vmid);