[pve-devel] [PATCH pve-manager 1/2] pvestatd : broadcast sdn transportzone status

Alexandre Derumier aderumier at odiso.com
Tue Jun 25 00:04:18 CEST 2019


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/Service/pvestatd.pm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm
index e138b2e8..bad1b73d 100755
--- a/PVE/Service/pvestatd.pm
+++ b/PVE/Service/pvestatd.pm
@@ -37,6 +37,12 @@ PVE::Status::Plugin->init();
 
 use base qw(PVE::Daemon);
 
+my $have_sdn;
+eval {
+    require PVE::API2::Network::SDN;
+    $have_sdn = 1;
+};
+
 my $opt_debug;
 my $restart_request;
 
@@ -457,6 +463,16 @@ sub update_ceph_version {
     }
 }
 
+sub update_sdn_status {
+
+    if($have_sdn) {
+	my ($transport_status, $vnet_status) = PVE::Network::SDN::status();
+
+	my $status = $transport_status ? encode_json($transport_status) : undef;
+	PVE::Cluster::broadcast_node_kv("sdn", $status);
+    }
+}
+
 sub update_status {
 
     # update worker list. This is not really required and
@@ -524,6 +540,12 @@ sub update_status {
     $err = $@;
     syslog('err', "error getting ceph services: $err") if $err;
 
+    eval {
+	update_sdn_status();
+    };
+    $err = $@;
+    syslog('err', "sdn status update error: $err") if $err;
+
 }
 
 my $next_update = 0;
-- 
2.20.1




More information about the pve-devel mailing list