mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-07 21:34:21 +00:00
move_disk : don't delete disk if used in a previous snasphot v2
and set it as unused Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
parent
2d82ca7966
commit
5b0bd20dd5
@ -2406,9 +2406,17 @@ __PACKAGE__->register_method({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($param->{delete}) {
|
if ($param->{delete}) {
|
||||||
|
my $used_paths = PVE::QemuServer::get_used_paths($vmid, $storecfg, $conf, 1, 1);
|
||||||
|
my $path = PVE::Storage::path($storecfg, $old_volid);
|
||||||
|
if ($used_paths->{$path}){
|
||||||
|
warn "volume $old_volid have snapshots. Can't delete it";
|
||||||
|
PVE::QemuServer::add_unused_volume($conf, $old_volid);
|
||||||
|
PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
|
||||||
|
} else {
|
||||||
eval { PVE::Storage::vdisk_free($storecfg, $old_volid); };
|
eval { PVE::Storage::vdisk_free($storecfg, $old_volid); };
|
||||||
warn $@ if $@;
|
warn $@ if $@;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return $rpcenv->fork_worker('qmmove', $vmid, $authuser, $realcmd);
|
return $rpcenv->fork_worker('qmmove', $vmid, $authuser, $realcmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user