[pve-devel] [PATCH] vzdump : check if volid exist with volume_size_info

Alexandre Derumier aderumier at odiso.com
Sun Feb 17 11:01:39 CET 2013


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/VZDump/QemuServer.pm |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
index ad85cc2..69130d7 100644
--- a/PVE/VZDump/QemuServer.pm
+++ b/PVE/VZDump/QemuServer.pm
@@ -94,9 +94,13 @@ sub prepare {
 
 	next if !$path;
 
-	die "no such volume '$volid'\n" if ! -e $path;
+	my $format = undef;
+	my $size = undef;
 
-	my ($size, $format) = PVE::Storage::Plugin::file_size_info($path);
+	eval{
+	    ($size, $format) = PVE::Storage::volume_size_info($self->{storecfg}, $volid, 5);
+	};
+	die "no such volume '$volid'\n" if $@;
 
 	my $diskinfo = { path => $path , volid => $volid, storeid => $storeid, 
 			 format => $format, virtdev => $ds, qmdevice => "drive-$ds" };
-- 
1.7.10.4




More information about the pve-devel mailing list