mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-06 22:34:35 +00:00
fix #1040: warn early about moving a snapshotted disk
die if "delete source disk" is enabled, because a disk that is referenced by snapshots must not be deleted.
This commit is contained in:
parent
5bf7f0f1a8
commit
9dbf9b5417
@ -2525,6 +2525,11 @@ __PACKAGE__->register_method({
|
|||||||
die "you can't move on the same storage with same format\n" if $oldstoreid eq $storeid &&
|
die "you can't move on the same storage with same format\n" if $oldstoreid eq $storeid &&
|
||||||
(!$format || !$oldfmt || $oldfmt eq $format);
|
(!$format || !$oldfmt || $oldfmt eq $format);
|
||||||
|
|
||||||
|
# this only checks snapshots because $disk is passed!
|
||||||
|
my $snapshotted = PVE::QemuServer::is_volume_in_use($storecfg, $conf, $disk, $old_volid);
|
||||||
|
die "you can't move a disk with snapshots and delete the source\n"
|
||||||
|
if $snapshotted && $param->{delete};
|
||||||
|
|
||||||
PVE::Cluster::log_msg('info', $authuser, "move disk VM $vmid: move --disk $disk --storage $storeid");
|
PVE::Cluster::log_msg('info', $authuser, "move disk VM $vmid: move --disk $disk --storage $storeid");
|
||||||
|
|
||||||
my $running = PVE::QemuServer::check_running($vmid);
|
my $running = PVE::QemuServer::check_running($vmid);
|
||||||
@ -2538,6 +2543,9 @@ __PACKAGE__->register_method({
|
|||||||
eval {
|
eval {
|
||||||
local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = sub { die "interrupted by signal\n"; };
|
local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = sub { die "interrupted by signal\n"; };
|
||||||
|
|
||||||
|
warn "moving disk with snapshots, snapshots will not be moved!\n"
|
||||||
|
if $snapshotted;
|
||||||
|
|
||||||
my $newdrive = PVE::QemuServer::clone_disk($storecfg, $vmid, $running, $disk, $drive, undef,
|
my $newdrive = PVE::QemuServer::clone_disk($storecfg, $vmid, $running, $disk, $drive, undef,
|
||||||
$vmid, $storeid, $format, 1, $newvollist);
|
$vmid, $storeid, $format, 1, $newvollist);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user