followup code cleanup for: broadcast ceph service data to cluster

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2019-05-27 15:41:37 +02:00
parent fea391967a
commit a78fd21f7f

View File

@ -451,6 +451,7 @@ sub rotate_authkeys {
sub update_ceph_services { sub update_ceph_services {
my $services = PVE::Ceph::Services::get_local_services(); my $services = PVE::Ceph::Services::get_local_services();
for my $type (keys %$services) { for my $type (keys %$services) {
my $data = encode_json($services->{$type}); my $data = encode_json($services->{$type});
PVE::Cluster::broadcast_node_kv("ceph-$type", $data); PVE::Cluster::broadcast_node_kv("ceph-$type", $data);
@ -459,6 +460,7 @@ sub update_ceph_services {
sub update_ceph_version { sub update_ceph_version {
my ($version) = PVE::Ceph::Tools::get_local_version(1); my ($version) = PVE::Ceph::Tools::get_local_version(1);
if ($version) { if ($version) {
PVE::Cluster::broadcast_node_kv("ceph-version", $version); PVE::Cluster::broadcast_node_kv("ceph-version", $version);
} }
@ -523,10 +525,10 @@ sub update_status {
syslog('err', "authkey rotation error: $err") if $err; syslog('err', "authkey rotation error: $err") if $err;
eval { eval {
if (PVE::Ceph::Tools::check_ceph_inited(1)) { return if !PVE::Ceph::Tools::check_ceph_inited(1); # "return" from eval
update_ceph_services(); update_ceph_services();
update_ceph_version(); update_ceph_version();
}
}; };
$err = $@; $err = $@;
syslog('err', "error getting ceph services: $err") if $err; syslog('err', "error getting ceph services: $err") if $err;