summaryrefslogtreecommitdiff
path: root/ovn
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>2018-07-31 17:35:00 +0200
committerBen Pfaff <blp@ovn.org>2018-07-31 12:49:19 -0700
commit82b261b9efdb7af4c2146178db10e901a9580f30 (patch)
tree3fd58d59f4081e1af8ef196a1a0358cd2fee2650 /ovn
parentd2f441997b23dca303f59524a53865497e613620 (diff)
downloadopenvswitch-82b261b9efdb7af4c2146178db10e901a9580f30.tar.gz
Introduce ovs-appctl command to monitor HVs sb connection status
Add 'connection-status' command to ovs-appctl utility in order to check if a given chassis is currently connected to SB db Acked-by: Mark Michelson <mmichels@redhat.com> Co-authored-by: aginwala <aginwala@ebay.com> Signed-off-by: aginwala <aginwala@ebay.com> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ovn')
-rw-r--r--ovn/controller/ovn-controller.8.xml5
-rw-r--r--ovn/controller/ovn-controller.c17
2 files changed, 22 insertions, 0 deletions
diff --git a/ovn/controller/ovn-controller.8.xml b/ovn/controller/ovn-controller.8.xml
index 2e4e53d6b..8035638b3 100644
--- a/ovn/controller/ovn-controller.8.xml
+++ b/ovn/controller/ovn-controller.8.xml
@@ -398,6 +398,11 @@
0x800</code>.
</p>
</dd>
+
+ <dt><code>connection-status</code></dt>
+ <dd>
+ Show OVN SBDB connection status for the chassis.
+ </dd>
</dl>
</p>
diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c
index 470e02ae8..81d330683 100644
--- a/ovn/controller/ovn-controller.c
+++ b/ovn/controller/ovn-controller.c
@@ -68,6 +68,7 @@ static unixctl_cb_func ct_zone_list;
static unixctl_cb_func meter_table_list;
static unixctl_cb_func group_table_list;
static unixctl_cb_func inject_pkt;
+static unixctl_cb_func ovn_controller_conn_show;
#define DEFAULT_BRIDGE_NAME "br-int"
#define DEFAULT_PROBE_INTERVAL_MSEC 5000
@@ -594,6 +595,9 @@ main(int argc, char *argv[])
ovsdb_idl_create(ovnsb_remote, &sbrec_idl_class, true, true));
ovsdb_idl_set_leader_only(ovnsb_idl_loop.idl, false);
+ unixctl_command_register("connection-status", "", 0, 0,
+ ovn_controller_conn_show, ovnsb_idl_loop.idl);
+
struct ovsdb_idl_index *sbrec_chassis_by_name
= chassis_index_create(ovnsb_idl_loop.idl);
struct ovsdb_idl_index *sbrec_multicast_group_by_name_datapath
@@ -1122,3 +1126,16 @@ update_probe_interval(const struct ovsrec_open_vswitch_table *ovs_table,
ovsdb_idl_set_probe_interval(ovnsb_idl, interval);
}
+
+static void
+ovn_controller_conn_show(struct unixctl_conn *conn, int argc OVS_UNUSED,
+ const char *argv[] OVS_UNUSED, void *idl_)
+{
+ const char *result = "not connected";
+ const struct ovsdb_idl *idl = idl_;
+
+ if (ovsdb_idl_is_connected(idl)) {
+ result = "connected";
+ }
+ unixctl_command_reply(conn, result);
+}