[ovs-dev] [PATCH 2/3] ovs-appctl: Add "version" command to print version of running daemons.
Justin Pettit
jpettit at nicira.com
Thu Aug 4 08:50:13 UTC 2011
When debugging a running system, we occasionally see a mismatch of
different versions because someone forgets to restart one or more
daemons. Often times, it would be useful to know what's running as
opposed to what's on the current runpath.
---
ChangeLog | 3 ++-
lib/unixctl.c | 9 +++++++++
utilities/ovs-appctl.c | 3 ++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bc87147..6dab0b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
Post-v1.2.0
------------------------
-
+ - ovs-appctl:
+ - New "version" command to determine version of running daemon
v1.2.0 - 03 Aug 2011
------------------------
diff --git a/lib/unixctl.c b/lib/unixctl.c
index c333c54..2a0a9b5 100644
--- a/lib/unixctl.c
+++ b/lib/unixctl.c
@@ -107,6 +107,14 @@ unixctl_help(struct unixctl_conn *conn, const char *args OVS_UNUSED,
ds_destroy(&ds);
}
+static void
+unixctl_version(struct unixctl_conn *conn, const char *args OVS_UNUSED,
+ void *aux OVS_UNUSED)
+{
+ /* Return 'program_version' defined in "lib/util.[ch]". */
+ unixctl_command_reply(conn, 200, program_version);
+}
+
void
unixctl_command_register(const char *name, unixctl_cb_func *cb, void *aux)
{
@@ -206,6 +214,7 @@ unixctl_server_create(const char *path, struct unixctl_server **serverp)
}
unixctl_command_register("help", unixctl_help, NULL);
+ unixctl_command_register("version", unixctl_version, NULL);
server = xmalloc(sizeof *server);
list_init(&server->conns);
diff --git a/utilities/ovs-appctl.c b/utilities/ovs-appctl.c
index 4e0fa31..fcf11f7 100644
--- a/utilities/ovs-appctl.c
+++ b/utilities/ovs-appctl.c
@@ -88,6 +88,7 @@ Targets:\n\
-t, --target=TARGET pidfile or socket to contact\n\
Common commands:\n\
help List commands supported by the target\n\
+ version Print version of the target\n\
vlog/list List current logging levels\n\
vlog/set MODULE[:FACILITY[:LEVEL]]\n\
Set MODULE and FACILITY log level to LEVEL\n\
@@ -97,7 +98,7 @@ Common commands:\n\
vlog/reopen Make the program reopen its log file\n\
Other options:\n\
-h, --help Print this helpful information\n\
- -V, --version Display version information\n",
+ -V, --version Display ovs-appctl version information\n",
program_name, program_name);
exit(EXIT_SUCCESS);
}
--
1.7.1
More information about the dev
mailing list