api: volume info: do not fail for zero-sized subvolumes

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@proxmox.com>
Link: https://lore.proxmox.com/20250303092445.13873-5-f.ebner@proxmox.com
This commit is contained in:
Fiona Ebner
2025-03-03 10:24:44 +01:00
committed by Thomas Lamprecht
parent d97d7ff676
commit 0426aa3165

View File

@ -322,7 +322,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,