my $vollist = [];
eval {
my $orig_mp_param; # only used if $restore
- my $orig_conf;
if ($restore) {
die "can't overwrite running container\n" if PVE::LXC::check_running($vmid);
if ($is_root && $archive ne '-') {
+ my $orig_conf;
($orig_conf, $orig_mp_param) = PVE::LXC::Create::recover_config($archive);
# When we're root call 'restore_configuration' with ristricted=0,
# causing it to restore the raw lxc entries, among which there may be
}
if ($storage_only_mode) {
if ($restore) {
- if (!defined $orig_mp_param) {
+ if (!defined($orig_mp_param)) {
(undef, $orig_mp_param) = PVE::LXC::Create::recover_config($archive);
}
$mp_param = $orig_mp_param;
PVE::LXC::Config->write_config($vmid, $conf);
if ($format eq 'raw') {
- my $path = PVE::Storage::path($storage_cfg, $volid, undef);
+ my $path = PVE::Storage::map_volume($storage_cfg, $volid) // PVE::Storage::path($storage_cfg, $volid);
if ($running) {
$mp->{mp} = '/';
PVE::Tools::run_command(['resize2fs', $path]);
};
warn "Failed to update the container's filesystem: $@\n" if $@;
+
+ PVE::Storage::unmap_volume($storage_cfg, $volid);
}
}
};