[pve-devel] [PATCH storage v2 2/3] esxi: fix return value of volume_size_info for vmx volumes

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Dec 10 13:17:56 CET 2024


in case of an array context, it should also return the format, else a caller
might assume it failed.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
v2: fix return value ordering, thanks Fiona!

 src/PVE/Storage/ESXiPlugin.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Storage/ESXiPlugin.pm b/src/PVE/Storage/ESXiPlugin.pm
index 37f9e75..70735f9 100644
--- a/src/PVE/Storage/ESXiPlugin.pm
+++ b/src/PVE/Storage/ESXiPlugin.pm
@@ -535,7 +535,9 @@ sub volume_resize {
 sub volume_size_info {
     my ($class, $scfg, $storeid, $volname, $timeout) = @_;
 
-    return 0 if $volname =~ /\.vmx$/;
+    if ($volname =~ /\.vmx$/) {
+	return wantarray ? (0, 'vmx') : 0 ;
+    }
 
     my $filename = $class->path($scfg, $volname, $storeid, undef);
     return PVE::Storage::Plugin::file_size_info($filename, $timeout, 'auto-detect');
-- 
2.39.5





More information about the pve-devel mailing list