[pve-devel] [PATCH pve-storage 2/3] rbd : add volume_blocksize_info
Alexandre Derumier
aderumier at odiso.com
Fri Jun 29 16:40:12 CEST 2018
---
PVE/Storage/RBDPlugin.pm | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index 15cbe67..0fda921 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -245,6 +245,7 @@ sub rbd_volume_info {
my $format = undef;
my $protected = undef;
my $features = undef;
+ my $objectsize = undef;
my $parser = sub {
my $line = shift;
@@ -259,13 +260,15 @@ sub rbd_volume_info {
$protected = 1 if $1 eq "True";
} elsif ($line =~ m/features:\s(.+)/) {
$features = $1;
+ } elsif ($line =~ m/order (\d+) \((\d+) (k|M|G|T)B objects\)/) {
+ $objectsize = $2 * $rbd_unittobytes->{$3} if ($3);
}
};
run_rbd_command($cmd, errmsg => "rbd error", errfunc => sub {}, outfunc => $parser);
- return ($size, $parent, $format, $protected, $features);
+ return ($size, $parent, $format, $protected, $features, $objectsize);
}
# Configuration
@@ -621,6 +624,14 @@ sub volume_size_info {
return $size;
}
+sub volume_blocksize_info {
+ my ($class, $scfg, $storeid, $volname, $timeout) = @_;
+
+ my ($vtype, $name, $vmid) = $class->parse_volname($volname);
+ my (undef, undef, undef, undef, undef, $blocksize) = rbd_volume_info($scfg, $storeid, $name);
+ return $blocksize;
+}
+
sub volume_resize {
my ($class, $scfg, $storeid, $volname, $size, $running) = @_;
--
2.11.0
More information about the pve-devel
mailing list