[pve-devel] [PATCH manager v2 1/3] add bluestore information to osd api call

Dominik Csapak d.csapak at proxmox.com
Fri Aug 4 16:28:49 CEST 2017


this adds information about bluestore (which devices and if
bluestore/filestore) to show in the gui

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v1:
none
 PVE/API2/Ceph.pm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 929604d2..601f852e 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -92,6 +92,13 @@ __PACKAGE__->register_method ({
 
 	my $usagehash = &$get_osd_usage($rados);
 
+	my $osdmetadata_tmp = $rados->mon_command({ prefix => 'osd metadata' });
+
+	my $osdmetadata = {};
+	foreach my $osd (@$osdmetadata_tmp) {
+	    $osdmetadata->{$osd->{id}} = $osd;
+	}
+
 	my $nodes = {};
 	my $newnodes = {};
 	foreach my $e (@{$res->{nodes}}) {
@@ -121,6 +128,18 @@ __PACKAGE__->register_method ({
 		}
 	    }
 
+	    my $osdmd = $osdmetadata->{$e->{id}};
+	    if ($e->{type} eq 'osd' && $osdmd) {
+		if ($osdmd->{bluefs}) {
+		    $new->{osdtype} = 'bluestore';
+		    $new->{blfsdev} = $osdmd->{bluestore_bdev_dev_node};
+		    $new->{dbdev} = $osdmd->{bluefs_db_dev_node};
+		    $new->{waldev} = $osdmd->{bluefs_wal_dev_node};
+		} else {
+		    $new->{osdtype} = 'filestore';
+		}
+	    }
+
 	    $newnodes->{$e->{id}} = $new;
 	}
 
-- 
2.11.0





More information about the pve-devel mailing list