[ovs-dev] [PATCH v2 1/2] ovs-appctl: Add logging options.

Ben Pfaff blp at nicira.com
Mon Aug 4 19:57:29 UTC 2014


On Fri, Aug 01, 2014 at 11:25:35AM -0700, Ansis Atteka wrote:
> On Thu, Jul 31, 2014 at 3:11 PM, Ben Pfaff <blp at nicira.com> wrote:
> > Normally I would also add documentation for the logging options to the
> > ovs-appctl manpage, but I am concerned that in this case it would actually
> > make the manpage confusing, because one of the main purposes of ovs-appctl
> > is to modify the log levels of *other* programs, and these options only
> > modify the log level of ovs-appctl itself, which is rarely useful.
> >
> > The following commit will start using these logging options in a test.
> >
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > ---
> >  utilities/ovs-appctl.c | 12 ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/utilities/ovs-appctl.c b/utilities/ovs-appctl.c
> > index a6fbebd..03738c5 100644
> > --- a/utilities/ovs-appctl.c
> > +++ b/utilities/ovs-appctl.c
> > @@ -1,5 +1,5 @@
> >  /*
> > - * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
> > + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2014 Nicira, Inc.
> >   *
> >   * Licensed under the Apache License, Version 2.0 (the "License");
> >   * you may not use this file except in compliance with the License.
> > @@ -31,6 +31,7 @@
> >  #include "timeval.h"
> >  #include "unixctl.h"
> >  #include "util.h"
> > +#include "vlog.h"
> >
> >  static void usage(void);
> >  static const char *parse_command_line(int argc, char *argv[]);
> > @@ -108,14 +109,19 @@ Other options:\n\
> >  static const char *
> >  parse_command_line(int argc, char *argv[])
> >  {
> > +    enum {
> > +        VLOG_OPTION_ENUMS
> > +    };
> >      static const struct option long_options[] = {
> >          {"target", required_argument, NULL, 't'},
> >          {"execute", no_argument, NULL, 'e'},
> >          {"help", no_argument, NULL, 'h'},
> >          {"version", no_argument, NULL, 'V'},
> >          {"timeout", required_argument, NULL, 'T'},
> > +        VLOG_LONG_OPTIONS,
> >          {NULL, 0, NULL, 0},
> >      };
> > +    char *short_options = long_options_to_short_options(long_options);
> >      const char *target;
> >      int e_options;
> >
> > @@ -124,7 +130,7 @@ parse_command_line(int argc, char *argv[])
> >      for (;;) {
> >          int option;
> >
> > -        option = getopt_long(argc, argv, "+t:hVe", long_options, NULL);
> > +        option = getopt_long(argc, argv, short_options, long_options, NULL);
> >          if (option == -1) {
> >              break;
> >          }
> > @@ -158,6 +164,8 @@ parse_command_line(int argc, char *argv[])
> >              ovs_print_version(0, 0);
> >              exit(EXIT_SUCCESS);
> >
> > +        VLOG_OPTION_HANDLERS
> > +
> >          case '?':
> >              exit(EXIT_FAILURE);
> >
> > --
> > 1.9.1
> >
> 
> Test #5 is failing with this patch.
> 
> ./bfd.at:233: ovs-appctl ofproto/trace ovs-dummy
> 'tunnel(tun_id=0x1,src=2.2.2.2,dst=2.2.2.1,tos=0x0,ttl=64,flags(key)),in_port(1),skb_mark(0/0),eth(src=00:11:22:33:44:55,dst=00:23:20:00:00:01),eth_type(0x0
> 800),ipv4(src=169.254.1.0/0.0.0.0,dst=169.254.1.1/0.0.0.0,proto=17/0xff,tos=0/0,ttl=255/0,frag=no/0xff),udp(src=49152/0,dst=3784/0xffff)'
> -generate
> 
> +ovs-appctl: invalid option -- 'g'
> 
> I guess this has to do something with long and short command line
> argument forms.

OK, that's embarrassing.

I sent out a v3.  This time, I ran all the tests.



More information about the dev mailing list