add two new api calls in /cluster/ceph status: the same as /nodes/NODE/ceph/status, but accessible without nodename, which we don't need, as in the hyperconverged case, all nodes have the ceph.conf which contains the info on how to connect to the monitors
metadata: combines data from the cluster filesystem about the services, as well as the 'ceph YYY metadata' info we get from ceph. with this info we can convieniently display which services exists, which are running and which versions they have Signed-off-by: Dominik Csapak <d.csa...@proxmox.com> --- PVE/API2/Cluster.pm | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm index cbd7d3de..b6312168 100644 --- a/PVE/API2/Cluster.pm +++ b/PVE/API2/Cluster.pm @@ -596,4 +596,68 @@ __PACKAGE__->register_method({ die "unable to get any free VMID\n"; }}); +__PACKAGE__->register_method ({ + name => 'ceph_metadata', + path => 'ceph/metadata', + method => 'GET', + description => "Get ceph metadata.", + protected => 1, + permissions => { + check => ['perm', '/', [ 'Sys.Audit', 'Datastore.Audit' ], any => 1], + }, + parameters => { + additionalProperties => 0, + properties => {}, + }, + returns => { type => 'object' }, + code => sub { + my ($param) = @_; + + PVE::Ceph::Tools::check_ceph_inited(); + + my $rados = PVE::RADOS->new(); + + my $res = {}; + for my $type ( qw(mon mgr mds) ) { + $res->{$type} = PVE::Cluster::get_data("ceph-$type"); + + my $services = $rados->mon_command({ prefix => "$type metadata" }); + for my $service ( @$services ) { + my $host = $res->{$type}->{$service->{hostname}}; + for my $f ( qw(hostname ceph_version ceph_version_short addr addrs) ) { + $host->{$service->{name}}->{$f} = $service->{$f} if $service->{$f}; + } + } + } + + $res->{osd} = $rados->mon_command({ prefix => "osd metadata" }); + + return $res; + }}); + +__PACKAGE__->register_method ({ + name => 'cephstatus', + path => 'ceph/status', + method => 'GET', + description => "Get ceph status.", + protected => 1, + permissions => { + check => ['perm', '/', [ 'Sys.Audit', 'Datastore.Audit' ], any => 1], + }, + parameters => { + additionalProperties => 0, + properties => { }, + }, + returns => { type => 'object' }, + code => sub { + my ($param) = @_; + + PVE::Ceph::Tools::check_ceph_inited(); + + my $rados = PVE::RADOS->new(); + my $status = $rados->mon_command({ prefix => 'status' }); + $status->{health} = $rados->mon_command({ prefix => 'health', detail => 'detail' }); + return $status; + }}); + 1; -- 2.11.0 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel