[ovs-dev] [python vlog 5/6] vlog: Take advantage of relaxed "-v" syntax through the tree.

Ethan Jackson ethan at nicira.com
Mon May 14 18:19:58 UTC 2012


Looks good, thanks.

Ethan

On Tue, May 1, 2012 at 2:28 PM, Ben Pfaff <blp at nicira.com> wrote:
> The vlog manpage implies that writing ANY explicitly is obsolete, but
> examples elsewhere in the documentation and code still tend to add it.
> This removes them.
>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
>  lib/vlog.man                                       |    2 +-
>  tests/interface-reconfigure.at                     |    4 ++--
>  tests/ofproto.at                                   |   12 ++++++------
>  tests/ovs-monitor-ipsec.at                         |    2 +-
>  tests/ovs-vsctl.at                                 |   14 +++++++-------
>  tests/ovs-xapi-sync.at                             |    2 +-
>  tests/vlog.at                                      |    5 ++---
>  utilities/ovs-ctl.in                               |    8 ++++----
>  vswitchd/ovs-brcompatd.c                           |    2 +-
>  .../etc_xapi.d_plugins_openvswitch-cfg-update      |    6 +++---
>  xenserver/openvswitch-xen.spec.in                  |    4 ++--
>  ...ensource_libexec_InterfaceReconfigureVswitch.py |    4 ++--
>  ..._lib_xsconsole_plugins-base_XSFeatureVSwitch.py |    4 ++--
>  13 files changed, 34 insertions(+), 35 deletions(-)
>
> diff --git a/lib/vlog.man b/lib/vlog.man
> index 0017449..39edaee 100644
> --- a/lib/vlog.man
> +++ b/lib/vlog.man
> @@ -43,7 +43,7 @@ a word but has no effect.
>  .IP "\fB\-v\fR"
>  .IQ "\fB\-\-verbose\fR"
>  Sets the maximum logging verbosity level, equivalent to
> -\fB\-\-verbose=ANY:ANY:dbg\fR.
> +\fB\-\-verbose=dbg\fR.
>  .
>  .\" Python vlog doesn't implement -vPATTERN so only document it if
>  .\" \*(PY is empty:
> diff --git a/tests/interface-reconfigure.at b/tests/interface-reconfigure.at
> index 3658882..59507ff 100644
> --- a/tests/interface-reconfigure.at
> +++ b/tests/interface-reconfigure.at
> @@ -709,7 +709,7 @@ configure_datapath: bridge      - xenbr2
>  configure_datapath: physical    - [u'eth2']
>  configure_datapath: extra ports - []
>  configure_datapath: extra bonds - []
> -/usr/bin/ovs-vsctl --timeout=5 -vANY:console:off get-fail-mode xenbr2
> +/usr/bin/ovs-vsctl --timeout=5 -vconsole:off get-fail-mode xenbr2
>  Applying changes to /etc/sysconfig/network-scripts/route-xenbr2 configuration
>  Applying changes to /etc/sysconfig/network configuration
>  Applying changes to /etc/sysconfig/network-scripts/ifcfg-xenbr2 configuration
> @@ -724,7 +724,7 @@ Applying changes to /etc/sysconfig/network-scripts/ifcfg-xenbr2 configuration
>     set Bridge xenbr2 fail_mode=secure
>     remove Bridge xenbr2 other_config disable-in-band
>     br-set-external-id xenbr2 xs-network-uuids d08c8749-0c8f-9e8d-ce25-fd364661ee99
> -/usr/bin/ovs-vsctl --timeout=5 -vANY:console:off get interface eth2 ofport
> +/usr/bin/ovs-vsctl --timeout=5 -vconsole:off get interface eth2 ofport
>  /usr/bin/ovs-ofctl add-flow xenbr2 idle_timeout=0,priority=0,in_port=5,arp,nw_proto=1,actions=local
>  /usr/bin/ovs-ofctl add-flow xenbr2 idle_timeout=0,priority=0,in_port=local,arp,dl_src=00:15:17:a0:29:80,actions=5
>  /usr/bin/ovs-ofctl add-flow xenbr2 idle_timeout=0,priority=0,in_port=5,dl_dst=00:15:17:a0:29:80,actions=local
> diff --git a/tests/ofproto.at b/tests/ofproto.at
> index 0f0fd1f..488cc4e 100644
> --- a/tests/ofproto.at
> +++ b/tests/ofproto.at
> @@ -2,13 +2,13 @@ AT_BANNER([ofproto])
>
>  AT_SETUP([ofproto - echo request])
>  OVS_VSWITCHD_START
> -AT_CHECK([ovs-ofctl -vANY:ANY:WARN probe br0])
> +AT_CHECK([ovs-ofctl -vwarn probe br0])
>  OVS_VSWITCHD_STOP
>  AT_CLEANUP
>
>  AT_SETUP([ofproto - feature request, config request])
>  OVS_VSWITCHD_START
> -AT_CHECK([ovs-ofctl -vANY:ANY:WARN show br0], [0], [stdout])
> +AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
>  AT_CHECK([STRIP_XIDS stdout], [0], [dnl
>  OFPT_FEATURES_REPLY: dpid:fedcba9876543210
>  n_tables:255, n_buffers:256
> @@ -27,7 +27,7 @@ dnl This is really bare-bones.
>  dnl It at least checks request and reply serialization and deserialization.
>  AT_SETUP([ofproto - port stats])
>  OVS_VSWITCHD_START
> -AT_CHECK([ovs-ofctl -vANY:ANY:WARN dump-ports br0], [0], [stdout])
> +AT_CHECK([ovs-ofctl -vwarn dump-ports br0], [0], [stdout])
>  AT_CHECK([STRIP_XIDS stdout], [0], [dnl
>  OFPST_PORT reply: 1 ports
>   port 65534: rx pkts=0, bytes=0, drop=0, errs=0, frame=0, over=0, crc=0
> @@ -40,7 +40,7 @@ dnl This is really bare-bones.
>  dnl It at least checks request and reply serialization and deserialization.
>  AT_SETUP([ofproto - queue stats])
>  OVS_VSWITCHD_START
> -AT_CHECK([ovs-ofctl -vANY:ANY:WARN queue-stats br0], [0], [stdout])
> +AT_CHECK([ovs-ofctl -vwarn queue-stats br0], [0], [stdout])
>  AT_CHECK([STRIP_XIDS stdout], [0], [dnl
>  OFPST_QUEUE reply: 0 queues
>  ])
> @@ -57,8 +57,8 @@ for command_config_state in \
>  do
>     set $command_config_state
>     command=$[1] config=`echo $[2] | sed 's/,/ /g'` state=$[3]
> -    AT_CHECK([ovs-ofctl -vANY:ANY:WARN mod-port br0 br0 $command])
> -    AT_CHECK([ovs-ofctl -vANY:ANY:WARN show br0], [0], [stdout])
> +    AT_CHECK([ovs-ofctl -vwarn mod-port br0 br0 $command])
> +    AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
>     AT_CHECK_UNQUOTED([STRIP_XIDS stdout], [0], [dnl
>  OFPT_FEATURES_REPLY: dpid:fedcba9876543210
>  n_tables:255, n_buffers:256
> diff --git a/tests/ovs-monitor-ipsec.at b/tests/ovs-monitor-ipsec.at
> index befa8b7..e9d6389 100644
> --- a/tests/ovs-monitor-ipsec.at
> +++ b/tests/ovs-monitor-ipsec.at
> @@ -32,7 +32,7 @@ chmod +x usr/sbin/setkey
>  touch etc/racoon/certs/ovs-stale.pem
>
>  ovs_vsctl () {
> -    ovs-vsctl --timeout=5 --no-wait -vreconnect:ANY:emer --db=unix:socket "$@"
> +    ovs-vsctl --timeout=5 --no-wait -vreconnect:emer --db=unix:socket "$@"
>  }
>  trim () {  # Removes blank lines and lines starting with # from input.
>     sed -e '/^#/d' -e '/^[       ]*$/d' "$@"
> diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at
> index 584ee79..0d99213 100644
> --- a/tests/ovs-vsctl.at
> +++ b/tests/ovs-vsctl.at
> @@ -15,17 +15,17 @@ dnl RUN_OVS_VSCTL(COMMAND, ...)
>  dnl
>  dnl Executes each ovs-vsctl COMMAND.
>  m4_define([RUN_OVS_VSCTL],
> -  [m4_foreach([command], [$@], [ovs-vsctl --timeout=5 --no-wait -vreconnect:ANY:emer --db=unix:socket -- command
> +  [m4_foreach([command], [$@], [ovs-vsctl --timeout=5 --no-wait -vreconnect:emer --db=unix:socket -- command
>  ])])
>  m4_define([RUN_OVS_VSCTL_ONELINE],
> -  [m4_foreach([command], [$@], [ovs-vsctl --timeout=5 --no-wait -vreconnect:ANY:emer --db=unix:socket --oneline -- command
> +  [m4_foreach([command], [$@], [ovs-vsctl --timeout=5 --no-wait -vreconnect:emer --db=unix:socket --oneline -- command
>  ])])
>
>  dnl RUN_OVS_VSCTL_TOGETHER(COMMAND, ...)
>  dnl
>  dnl Executes each ovs-vsctl COMMAND in a single run of ovs-vsctl.
>  m4_define([RUN_OVS_VSCTL_TOGETHER],
> -  [ovs-vsctl --timeout=5 --no-wait -vreconnect:ANY:emer --db=unix:socket --oneline dnl
> +  [ovs-vsctl --timeout=5 --no-wait -vreconnect:emer --db=unix:socket --oneline dnl
>  m4_foreach([command], [$@], [ -- command])])
>
>  dnl CHECK_BRIDGES([BRIDGE, PARENT, VLAN], ...)
> @@ -769,7 +769,7 @@ AT_CHECK(
>
>  ])
>  m4_define([VSCTL_CHECK_FIND],
> -  [AT_CHECK([ovs-vsctl --bare --timeout=5 --no-wait -vreconnect:ANY:emer --db=unix:socket -- --columns=name find bridge '$1' | sort | xargs echo], [0], [$2
> +  [AT_CHECK([ovs-vsctl --bare --timeout=5 --no-wait -vreconnect:emer --db=unix:socket -- --columns=name find bridge '$1' | sort | xargs echo], [0], [$2
>  ])])
>
>  # Arithmetic relational operators without keys.
> @@ -985,19 +985,19 @@ AT_SETUP([unreferenced record warnings])
>  AT_KEYWORDS([ovs-vsctl])
>  OVS_VSCTL_SETUP
>  AT_CHECK(
> -  [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --timeout=5 --no-wait -vreconnect:ANY:emer --db=unix:socket \
> +  [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --timeout=5 --no-wait -vreconnect:emer --db=unix:socket \
>      -- create Bridge name=br0 | $srcdir/uuidfilt.pl],
>   [0], [<0>
>  ], [vsctl|WARN|applying "create" command to table Bridge without --id option will have no effect
>  ], [OVS_VSCTL_CLEANUP])
>  AT_CHECK(
> -  [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --timeout=5 --no-wait -vreconnect:ANY:emer --db=unix:socket \
> +  [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --timeout=5 --no-wait -vreconnect:emer --db=unix:socket \
>      -- --id=@br0 create Bridge name=br0 | $srcdir/uuidfilt.pl],
>   [0], [<0>
>  ], [vsctl|WARN|row id "@br0" was created but no reference to it was inserted, so it will not actually appear in the database
>  ], [OVS_VSCTL_CLEANUP])
>  AT_CHECK(
> -  [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --timeout=5 --no-wait -vreconnect:ANY:emer --db=unix:socket \
> +  [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --timeout=5 --no-wait -vreconnect:emer --db=unix:socket \
>      -- --id=@eth0_iface create Interface name=eth0 \
>      -- --id=@eth0 create Port name=eth0 interfaces=@eth0_iface \
>      -- --id=@m0 create Mirror name=m0 output_port=@eth0 \
> diff --git a/tests/ovs-xapi-sync.at b/tests/ovs-xapi-sync.at
> index c57bbc9..5fa61ec 100644
> --- a/tests/ovs-xapi-sync.at
> +++ b/tests/ovs-xapi-sync.at
> @@ -21,7 +21,7 @@ mkdir var var/run
>  touch var/run/xapi_init_complete.cookie
>
>  ovs_vsctl () {
> -    ovs-vsctl --timeout=5 --no-wait -vreconnect:ANY:emer --db=unix:socket "$@"
> +    ovs-vsctl --timeout=5 --no-wait -vreconnect:emer --db=unix:socket "$@"
>  }
>
>  # Start ovsdb-server.
> diff --git a/tests/vlog.at b/tests/vlog.at
> index 61cef2a..27ec79e 100644
> --- a/tests/vlog.at
> +++ b/tests/vlog.at
> @@ -2,11 +2,10 @@ AT_BANNER([vlog])
>
>  AT_SETUP([vlog - Python])
>  AT_SKIP_IF([test $HAVE_PYTHON = no])
> -AT_CHECK([$PYTHON $srcdir/test-vlog.py --log-file log_file \
> --v ANY:ANY:dbg module_1:ANY:info module_2:ANY:warn ANY:syslog:off \
> -2>stderr_log])
>  AT_CAPTURE_FILE([log_file])
>  AT_CAPTURE_FILE([stderr_log])
> +AT_CHECK([$PYTHON $srcdir/test-vlog.py --log-file log_file \
> +-v dbg module_1:info module_2:warn syslog:off 2>stderr_log])
>
>  AT_CHECK([diff log_file stderr_log])
>
> diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
> index ed55834..abb06d3 100755
> --- a/utilities/ovs-ctl.in
> +++ b/utilities/ovs-ctl.in
> @@ -73,7 +73,7 @@ ovs_vsctl () {
>  }
>
>  ovsdb_tool () {
> -    ovsdb-tool -vANY:console:off "$@"
> +    ovsdb-tool -vconsole:off "$@"
>  }
>
>  create_db () {
> @@ -182,7 +182,7 @@ start () {
>
>        # Start ovsdb-server.
>        set ovsdb-server "$DB_FILE"
> -       set "$@" -vANY:CONSOLE:EMER -vANY:SYSLOG:ERR -vANY:FILE:INFO
> +       set "$@" -vconsole:emer -vsyslog:err -vfile:info
>        set "$@" --remote=punix:"$DB_SOCK"
>        set "$@" --remote=db:Open_vSwitch,manager_options
>        set "$@" --private-key=db:SSL,private_key
> @@ -211,7 +211,7 @@ start () {
>
>        # Start ovs-vswitchd.
>        set ovs-vswitchd unix:"$DB_SOCK"
> -       set "$@" -vANY:CONSOLE:EMER -vANY:SYSLOG:ERR -vANY:FILE:INFO
> +       set "$@" -vconsole:emer -vsyslog:err -vfile:info
>        if test X"$MLOCKALL" != Xno; then
>            set "$@" --mlockall
>        fi
> @@ -222,7 +222,7 @@ start () {
>        log_success_msg "ovs-brcompatd is already running"
>     elif test X"$BRCOMPAT" = Xyes; then
>         set ovs-brcompatd
> -       set "$@" -vANY:CONSOLE:EMER -vANY:SYSLOG:ERR -vANY:FILE:INFO
> +       set "$@" -vconsole:emer -vsyslog:err -vfile:info
>        start_daemon "$OVS_BRCOMPATD_PRIORITY" "$@"
>     fi
>  }
> diff --git a/vswitchd/ovs-brcompatd.c b/vswitchd/ovs-brcompatd.c
> index 8b1ad5d..859426f 100644
> --- a/vswitchd/ovs-brcompatd.c
> +++ b/vswitchd/ovs-brcompatd.c
> @@ -76,7 +76,7 @@ static char *appctl_program;
>  static char *vsctl_program;
>
>  /* Options that we should generally pass to ovs-vsctl. */
> -#define VSCTL_OPTIONS "--timeout=5", "-vANY:console:WARN"
> +#define VSCTL_OPTIONS "--timeout=5", "-vconsole:warn"
>
>  /* Netlink socket to bridge compatibility kernel module. */
>  static struct nl_sock *brc_sock;
> diff --git a/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update b/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update
> index ef4d11a..1392a90 100755
> --- a/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update
> +++ b/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update
> @@ -4,7 +4,7 @@
>  # ovs-vswitchd configuration that are managed in the xapi database when
>  # integrated with Citrix management tools.
>
> -# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc.
> +# Copyright (C) 2009, 2010, 2011, 2012 Nicira Networks, Inc.
>  #
>  # Licensed under the Apache License, Version 2.0 (the "License");
>  # you may not use this file except in compliance with the License.
> @@ -213,7 +213,7 @@ def setControllerCfg(controller):
>                    "--", "set-manager", 'ssl:' + controller + ':6632'])
>
>  def vswitchCfgQuery(action_args):
> -    cmd = [vsctl, "--timeout=5", "-vANY:console:off"] + action_args
> +    cmd = [vsctl, "--timeout=5", "-vconsole:off"] + action_args
>     output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()
>     if len(output) == 0 or output[0] == None:
>         output = ""
> @@ -222,7 +222,7 @@ def vswitchCfgQuery(action_args):
>     return output
>
>  def vswitchCfgMod(action_args):
> -    cmd = [vsctl, "--timeout=5", "-vANY:console:off"] + action_args
> +    cmd = [vsctl, "--timeout=5", "-vconsole:off"] + action_args
>     exitcode = subprocess.call(cmd)
>     if exitcode != 0:
>         raise XenAPIPlugin.Failure("VSWITCH_CONFIG_MOD_FAILURE",
> diff --git a/xenserver/openvswitch-xen.spec.in b/xenserver/openvswitch-xen.spec.in
> index 1e8d764..6ea3f2d 100644
> --- a/xenserver/openvswitch-xen.spec.in
> +++ b/xenserver/openvswitch-xen.spec.in
> @@ -232,11 +232,11 @@ if test ! -e /etc/openvswitch/conf.db; then
>     install -d -m 755 -o root -g root /etc/openvswitch
>
>     # Create ovs-vswitchd config database
> -    ovsdb-tool -vANY:console:off create /etc/openvswitch/conf.db \
> +    ovsdb-tool -vconsole:off create /etc/openvswitch/conf.db \
>             /usr/share/openvswitch/vswitch.ovsschema
>
>     # Create initial table in config database
> -    ovsdb-tool -vANY:console:off transact /etc/openvswitch/conf.db \
> +    ovsdb-tool -vconsole:off transact /etc/openvswitch/conf.db \
>             '[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' \
>             > /dev/null
>  fi
> diff --git a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
> index 31e9b51..804aef0 100644
> --- a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
> +++ b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
> @@ -1,4 +1,4 @@
> -# Copyright (c) 2008,2009,2011 Citrix Systems, Inc.
> +# Copyright (c) 2008,2009,2011,2012 Citrix Systems, Inc.
>  # Copyright (c) 2009,2010,2011 Nicira Networks.
>  #
>  # This program is free software; you can redistribute it and/or modify
> @@ -721,7 +721,7 @@ class DatapathVswitch(Datapath):
>
>  def vswitchCfgQuery(action_args):
>     cmd = ['%s/usr/bin/ovs-vsctl' % root_prefix(),
> -        '--timeout=5', '-vANY:console:off'] + action_args
> +        '--timeout=5', '-vconsole:off'] + action_args
>     output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()
>     if len(output) == 0 or output[0] == None:
>         output = ""
> diff --git a/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py b/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py
> index 93532c8..3825171 100644
> --- a/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py
> +++ b/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py
> @@ -1,4 +1,4 @@
> -# Copyright (c) 2007-2011 Citrix Systems Inc.
> +# Copyright (c) 2007-2012 Citrix Systems Inc.
>  # Copyright (c) 2009,2010,2011 Nicira Networks.
>  #
>  # This program is free software; you can redistribute it and/or modify
> @@ -86,7 +86,7 @@ class VSwitchConfig:
>     @staticmethod
>     def Get(action):
>         try:
> -            arg = [vsctl, "--timeout=30", "-vANY:console:off"] + action.split()
> +            arg = [vsctl, "--timeout=30", "-vconsole:off"] + action.split()
>             output = ShellPipe(arg).Stdout()
>         except StandardError, e:
>             XSLogError("config retrieval error: " + str(e))
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list