5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-01-11 05:18:01 +03:00

rbd : volume_size_info

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
Alexandre Derumier 2012-08-05 10:16:47 +02:00 committed by Dietmar Maurer
parent c732d5dbac
commit c95c307373

View File

@ -249,7 +249,21 @@ sub deactivate_volume {
sub volume_size_info {
my ($class, $scfg, $storeid, $volname, $timeout) = @_;
return undef;
my $cmd = &$rbd_cmd($scfg, $storeid, 'info', $volname);
my $size = undef;
my $parser = sub {
my $line = shift;
if ($line =~ m/size (\d+) MB in (\d+) objects/) {
$size = $1;
}
};
run_command($cmd, errmsg => "rbd error", errfunc => sub {}, outfunc => $parser);
$size = $size*1024*1024 if $size;
return $size;
}
1;