[ovs-dev] [RFC PATCH 13/21] keepalive: Add support to query keepalive status.

Bhanuprakash Bodireddy bhanuprakash.bodireddy at intel.com
Wed Jun 7 16:15:09 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 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lib/keepalive.c b/lib/keepalive.c
index 3048527..d74b4ab 100644
--- a/lib/keepalive.c
+++ b/lib/keepalive.c
@@ -338,6 +338,19 @@ ka_unixctl_pmd_health_show(struct unixctl_conn *conn, int argc OVS_UNUSED,
     unixctl_command_reply(conn, ds_cstr(&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)
 {
@@ -379,6 +392,10 @@ ka_init(const struct smap *ovs_other_config)
             } else {
                 VLOG_ERR("keepalive_shm_create() failed.");
             }
+
+            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