From f18199e580a41b281cde60106c353e25a2dffd94 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 31 Jul 2012 11:01:02 +0200 Subject: [PATCH] volume_size_info: make it work with raw devices --- PVE/Storage.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 60cc53d..39d77c6 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -117,11 +117,16 @@ sub file_size_info { sub volume_size_info { my ($cfg, $volid, $timeout) = @_; - my ($storeid, $volname) = parse_volume_id($volid); - - my $scfg = storage_config($cfg, $storeid); - my $plugin = PVE::Storage::Plugin->lookup($scfg->{type}); - return $plugin->volume_size_info($scfg, $storeid, $volname, $timeout); + my ($storeid, $volname) = parse_volume_id($volid, 1); + if ($storeid) { + my $scfg = storage_config($cfg, $storeid); + my $plugin = PVE::Storage::Plugin->lookup($scfg->{type}); + return $plugin->volume_size_info($scfg, $storeid, $volname, $timeout); + } elsif ($volid =~ m|^(/.+)$| && -e $volid) { + return file_size_info($volid, $timeout); + } else { + return 0; + } } sub get_image_dir {