[pve-devel] [PATCH storage] set filesize to undef on error during qemu-img info

Tim Marx t.marx at proxmox.com
Thu Sep 12 12:26:48 CEST 2019


Signed-off-by: Tim Marx <t.marx at proxmox.com>
---
 PVE/Storage/Plugin.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index 39622f3..08cb260 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -738,9 +738,18 @@ sub file_size_info {
 	}
     };
 
+    my $error_function = sub {
+	my $line = shift;
+	$size = undef;
+	$used = undef;
+
+	warn $line;
+    };
+
     my $cmd = ['/usr/bin/qemu-img', 'info', $filename];
     eval {
-	run_command($cmd, timeout => $timeout, outfunc => $parse_qemu_img_info );
+	run_command($cmd, timeout => $timeout, outfunc => $parse_qemu_img_info,
+	errfunc => $error_function);
     };
     warn $@ if $@;
 
-- 
2.20.1




More information about the pve-devel mailing list