[ovs-dev] [RFC PATCH v3 11/18] keepalive: Add support to query keepalive status.

Bhanuprakash Bodireddy bhanuprakash.bodireddy at intel.com
Sun Jun 18 19:24:24 UTC 2017


This commit adds support to query if keepalive status is
enabled/disabled.

  $ ovs-appctl keepalive/status
    keepAlive Status: Enabled

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy at intel.com>
---
 lib/keepalive.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/keepalive.c b/lib/keepalive.c
index a4b8d01..6edb440 100644
--- a/lib/keepalive.c
+++ b/lib/keepalive.c
@@ -420,6 +420,19 @@ out:
     ds_destroy(&ds);
 }
 
+static void
+ka_unixctl_status(struct unixctl_conn *conn, int argc OVS_UNUSED,
+                  const char *argv[] OVS_UNUSED, void *aux OVS_UNUSED)
+{
+    struct ds ds = DS_EMPTY_INITIALIZER;
+
+    ds_put_format(&ds, "keepAlive Status: %s",
+                  ka_is_enabled() ? "Enabled" : "Disabled");
+
+    unixctl_command_reply(conn, ds_cstr(&ds));
+    ds_destroy(&ds);
+}
+
 static int
 ka_init__(void)
 {
@@ -466,6 +479,8 @@ ka_init(const struct smap *ovs_other_config)
 
         unixctl_command_register("keepalive/pmd-health-show", "", 0, 0,
                                   ka_unixctl_pmd_health_show, ka_info);
+        unixctl_command_register("keepalive/status", "", 0, 0,
+                                      ka_unixctl_status, NULL);
 
         ovsthread_once_done(&once_enable);
     }
-- 
2.4.11



More information about the dev mailing list