diff options
Diffstat (limited to 'ovn')
-rw-r--r-- | ovn/controller/ovn-controller.8.xml | 5 | ||||
-rw-r--r-- | ovn/controller/ovn-controller.c | 17 |
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); +} |