We use this in two places, in the cleanup path of the create/restore
API path and indirectly through PVE::LXC::destroy_lxc_container, once
again in the restore code path of the create API call, to cleanup a
CT before overwriting it with a backup if the force flag ist set. The
second time in the destroy CT API call, both times a hard error in a
erroneous cleanup is wanted.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
};
if (my $err = $@) {
PVE::LXC::destroy_disks($storage_cfg, $vollist);
- PVE::LXC::destroy_config($vmid);
+ eval { PVE::LXC::destroy_config($vmid) };
+ warn $@ if $@;
die $err;
}
PVE::AccessControl::add_vm_to_pool($vmid, $pool) if $pool;
sub destroy_config {
my ($vmid) = @_;
- unlink PVE::LXC::Config->config_file($vmid, $nodename);
+ my $config_fn = PVE::LXC::Config->config_file($vmid, $nodename);
+ unlink $config_fn or die "failed to remove config file: $!\n";
}
# container status helpers