For LVM storages using 'snapshot-as-volume-chain', it's necessary to ensure that the size for the LV of the target snapshot volume is large enough before doing a commit operation. Note that the change here also affects file-based storages; previously resize would happen as part of the commit operation automatically for them. This fixes the online case.
Signed-off-by: Fiona Ebner <[email protected]> --- src/PVE/QemuServer.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm index d634251b..6ecb0bc4 100644 --- a/src/PVE/QemuServer.pm +++ b/src/PVE/QemuServer.pm @@ -4442,6 +4442,15 @@ sub qemu_volume_snapshot_delete { # improve-me: if firstsnap > child : commit, if firstsnap < child do a stream. if (!$parentsnap) { print "delete first snapshot $snap\n"; + + my $snap_size = $snapshots->{$snap}->{'virtual-size'}; + my $child_size = $snapshots->{$childsnap}->{'virtual-size'}; + if (defined($child_size) && defined($snap_size) && $child_size > $snap_size) { + print + "resize '$snap' ($snap_size bytes) to match '$childsnap' ($child_size bytes)\n"; + PVE::Storage::volume_resize($storecfg, $volid, $child_size, $running, $snap); + } + PVE::QemuServer::Blockdev::blockdev_commit( $storecfg, $vmid, -- 2.47.3 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
