summaryrefslogtreecommitdiff
path: root/ovn
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2018-05-17 14:04:25 -0700
committerBen Pfaff <blp@ovn.org>2018-05-25 14:25:54 -0700
commit15f6255fdd0df369909ab8e524d0d174537b2a65 (patch)
tree192513485b10e932fa5ec63e56ea4ef3f0875128 /ovn
parent2128f9b4d2a4ab0f969c3e02f1ad22abae1a581a (diff)
downloadopenvswitch-15f6255fdd0df369909ab8e524d0d174537b2a65.tar.gz
ovs-vsctl, ovn-nbctl, ovn-sbctl, vtep-ctl: Parse options before logging.
These utilities logged the command very early, before parsing the options or the command. This meant that logging options (like --log-file or -vsyslog:off) weren't considered for the purpose of logging the command. This fixes the problem. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
Diffstat (limited to 'ovn')
-rw-r--r--ovn/utilities/ovn-nbctl.c9
-rw-r--r--ovn/utilities/ovn-sbctl.c8
2 files changed, 6 insertions, 11 deletions
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index 6f133772d..10ead0fc5 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -97,7 +97,6 @@ main(int argc, char *argv[])
struct shash local_options;
unsigned int seqno;
size_t n_commands;
- char *args;
set_program_name(argv[0]);
fatal_ignore_sigpipe();
@@ -106,16 +105,14 @@ main(int argc, char *argv[])
nbctl_cmd_init();
- /* Log our arguments. This is often valuable for debugging systems. */
- args = process_escape_args(argv);
- VLOG(ctl_might_write_to_db(argv) ? VLL_INFO : VLL_DBG,
- "Called as %s", args);
-
/* Parse command line. */
+ char *args = process_escape_args(argv);
shash_init(&local_options);
parse_options(argc, argv, &local_options);
commands = ctl_parse_commands(argc - optind, argv + optind, &local_options,
&n_commands);
+ VLOG(ctl_might_write_to_db(commands, n_commands) ? VLL_INFO : VLL_DBG,
+ "Called as %s", args);
if (timeout) {
time_alarm(timeout);
diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c
index 957611944..cfbe57313 100644
--- a/ovn/utilities/ovn-sbctl.c
+++ b/ovn/utilities/ovn-sbctl.c
@@ -100,7 +100,6 @@ main(int argc, char *argv[])
struct shash local_options;
unsigned int seqno;
size_t n_commands;
- char *args;
set_program_name(argv[0]);
fatal_ignore_sigpipe();
@@ -109,15 +108,14 @@ main(int argc, char *argv[])
sbctl_cmd_init();
- /* Log our arguments. This is often valuable for debugging systems. */
- args = process_escape_args(argv);
- VLOG(ctl_might_write_to_db(argv) ? VLL_INFO : VLL_DBG, "Called as %s", args);
-
/* Parse command line. */
+ char *args = process_escape_args(argv);
shash_init(&local_options);
parse_options(argc, argv, &local_options);
commands = ctl_parse_commands(argc - optind, argv + optind, &local_options,
&n_commands);
+ VLOG(ctl_might_write_to_db(commands, n_commands) ? VLL_INFO : VLL_DBG,
+ "Called as %s", args);
if (timeout) {
time_alarm(timeout);