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. This fixes the offline case.

Signed-off-by: Fiona Ebner <[email protected]>
---
 src/PVE/Storage/LVMPlugin.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index 0200666..65e0ffa 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -1205,6 +1205,14 @@ sub volume_snapshot_delete {
     # the snapshot to child
     if (!$parentsnap) {
         print "$volname: deleting snapshot '$snap' by commiting snapshot 
'$childsnap'\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";
+            $class->volume_resize($scfg, $storeid, $volname, $child_size, 
$running, $snap);
+        }
+
         print "running 'qemu-img commit $childpath'\n";
         #can't use -d here, as it's an lvm volume
         $cmd = ['/usr/bin/qemu-img', 'commit', $childpath];
-- 
2.47.3



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to