[pve-devel] [PATCH storage 02/11] plugin: volume snapshot info: also return virtual size
Fiona Ebner
f.ebner at proxmox.com
Tue Dec 16 14:02:13 CET 2025
For LVM storages using 'snapshot-as-volume-chain', it's necessary to
check that the size for the LV of the target snapshot volume is large
enough before doing a commit operation. Returning the virtual size of
the volume at the time the snapshot was taken in the result of
volume_snapshot_info() makes this easy to check.
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
src/PVE/Storage/LVMPlugin.pm | 1 +
src/PVE/Storage/Plugin.pm | 3 +++
2 files changed, 4 insertions(+)
diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index 102cf22..aa472f5 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -909,6 +909,7 @@ sub volume_snapshot_info {
$info->{$snapname}->{file} = $snapfile;
$info->{$snapname}->{volname} = "$snapvolname";
$info->{$snapname}->{volid} = "$storeid:$snapvolname";
+ $info->{$snapname}->{'virtual-size'} = $snap->{'virtual-size'};
my $parentfile = $snap->{'backing-filename'};
if ($parentfile) {
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 5122495..260c259 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -1834,6 +1834,8 @@ Required values are:
=item C<volid>: The volume ID of the external snapshot volume.
+=item C<virtual-size>: The virtual size of the volume recorded by the snapshot.
+
=item C<child>: The name of the child snapshot in the volume chain. Not set if there is no child.
=item C<parent>: The name of the parent snapshot in the volume chain. Not set if there is no parent.
@@ -1913,6 +1915,7 @@ sub volume_snapshot_info {
$info->{$snapname}->{file} = $snapfile;
$info->{$snapname}->{volname} = "$snapvolname";
$info->{$snapname}->{volid} = "$storeid:$snapvolname";
+ $info->{$snapname}->{'virtual-size'} = $snap->{'virtual-size'};
$info->{$snapname}->{ext} = 1;
my $parentfile = $snap->{'backing-filename'};
--
2.47.3
More information about the pve-devel
mailing list