volume_size_info: make it work with raw devices

This commit is contained in:
Dietmar Maurer
2012-07-31 11:01:02 +02:00
parent 573778eaf7
commit f18199e580

View File

@ -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 {