diff mbox

[ovs-dev,RFC,v2,11/19] keepalive: Add support to query keepalive status.

Message ID 1497286187-69287-12-git-send-email-bhanuprakash.bodireddy@intel.com
State Superseded
Headers show

Commit Message

Bodireddy, Bhanuprakash June 12, 2017, 4:49 p.m. UTC
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@intel.com>
---
 lib/keepalive.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff mbox

Patch

diff --git a/lib/keepalive.c b/lib/keepalive.c
index 3786d47..974d17a 100644
--- a/lib/keepalive.c
+++ b/lib/keepalive.c
@@ -354,6 +354,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",
+                  is_ka_enabled() ? "Enabled" : "Disabled");
+
+    unixctl_command_reply(conn, ds_cstr(&ds));
+    ds_destroy(&ds);
+}
+
 static int
 ka_init__(void)
 {
@@ -397,6 +410,8 @@  ka_init(const struct smap *ovs_other_config)
 
         unixctl_command_register("keepalive/pmd-health-show", "", 0, 0,
                                   ka_unixctl_pmd_health_show, ka_shm);
+        unixctl_command_register("keepalive/status", "", 0, 0,
+                                      ka_unixctl_status, NULL);
 
         ovsthread_once_done(&once_enable);
     }