[pve-devel] [PATCH storage 4/6] api: volume info: do not fail for zero-sized subvolumes

Fiona Ebner f.ebner at proxmox.com
Fri Feb 28 15:50:20 CET 2025


The special case of size being zero is supported if the volume is of
format 'subvol' is a special use case supported in Proxmox VE.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 src/PVE/API2/Storage/Content.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/Storage/Content.pm b/src/PVE/API2/Storage/Content.pm
index fe0ad4a..fbd371c 100644
--- a/src/PVE/API2/Storage/Content.pm
+++ b/src/PVE/API2/Storage/Content.pm
@@ -324,7 +324,9 @@ __PACKAGE__->register_method ({
 
 	my $path = PVE::Storage::path($cfg, $volid);
 	my ($size, $format, $used, $parent) =  PVE::Storage::volume_size_info($cfg, $volid);
-	die "volume_size_info on '$volid' failed\n" if !($format && $size);
+	die "volume_size_info on '$volid' failed - no format\n" if !$format;
+	die "volume_size_info on '$volid' failed - no size\n" if !defined($size);
+	die "volume '$volid' has size zero\n" if !$size && $format ne 'subvol';
 
 	my $entry = {
 	    path => $path,
-- 
2.39.5





More information about the pve-devel mailing list