mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-15 00:24:03 +00:00
api: ceph/metadata: add structured node versions
include the version as string and as parts, as we do the split already. Also include the build commit, so if we re-release a ceph version, we can differ here too. Use node as key, to make the new entry a bit more general, could be easily expanded with other infos, if required. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
3248590d53
commit
1aaca6fde7
@ -3,6 +3,8 @@ package PVE::API2::Cluster::Ceph;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use JSON;
|
||||
|
||||
use PVE::Ceph::Services;
|
||||
use PVE::Ceph::Tools;
|
||||
use PVE::Cluster;
|
||||
@ -68,9 +70,16 @@ __PACKAGE__->register_method ({
|
||||
my $rados = PVE::RADOS->new();
|
||||
|
||||
my $res = {
|
||||
# FIXME: remove with 7.0 depreacated by structured 'versions'
|
||||
version => PVE::Cluster::get_node_kv("ceph-version"),
|
||||
};
|
||||
|
||||
if (defined(my $vers = PVE::Cluster::get_node_kv("ceph-versions"))) {
|
||||
$res->{node} = {
|
||||
map { eval { $_ => decode_json($vers->{$_}) } } keys %$vers
|
||||
};
|
||||
}
|
||||
|
||||
for my $type ( qw(mon mgr mds) ) {
|
||||
my $typedata = PVE::Ceph::Services::get_cluster_service($type);
|
||||
my $data = {};
|
||||
|
@ -416,9 +416,23 @@ sub update_ceph_metadata {
|
||||
|
||||
PVE::Ceph::Services::broadcast_ceph_services();
|
||||
|
||||
my ($version) = PVE::Ceph::Tools::get_local_version(1);
|
||||
my ($version, $buildcommit, $vers_parts) = PVE::Ceph::Tools::get_local_version(1);
|
||||
|
||||
|
||||
my $local_last_version = PVE::Cluster::get_node_kv('ceph-versions');
|
||||
|
||||
if ($version) {
|
||||
# FIXME: remove with 7.0 - for backward compat only
|
||||
PVE::Cluster::broadcast_node_kv("ceph-version", $version);
|
||||
|
||||
my $node_versions = {
|
||||
version => {
|
||||
str => $version,
|
||||
parts => $vers_parts,
|
||||
},
|
||||
buildcommit => $buildcommit,
|
||||
};
|
||||
PVE::Cluster::broadcast_node_kv("ceph-versions", encode_json($node_versions));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user