[ovs-dev] [PATCH] ovs-vsctl: Log changes to configuration file to syslog.

reid at nicira.com reid at nicira.com
Fri Oct 16 01:43:13 UTC 2009


Looks good, two minor Google python-style preferences noted below.
  -Reid

On Thu, 15 Oct 2009 12:27:57 -0700, Ben Pfaff <blp at nicira.com> wrote:
> This feature, which has been in ovs-cfg-mod for some time as the "-c"
> option, makes it much easier to see what changes ovs-vsctl actually makes
> to ovs-vswitchd.conf.
> 
> diff --git a/utilities/ovs-vsctl.in b/utilities/ovs-vsctl.in
> index 675f9dd..cc5c0be 100755
> --- a/utilities/ovs-vsctl.in
> +++ b/utilities/ovs-vsctl.in
> +# Returns a list of all the configuration lines that are in 'a' but
> +# not in 'b'.
> +def cfg_subtract(a, b):
> +    difference = []
> +    for key in a:
> +        for value in a[key]:
> +            if key not in b or value not in b[key]:
> +                difference += ["%s=%s" % (key, value)]
> +    return difference
I think there is a slight preference to use the append equivalent:
difference.append("%s=%s" % (key, value))

> +    if SYSLOG:
> +        syslog.openlog("ovs-vsctl")
> +        log("Called as " + ' '.join(sys.argv[1:]))
Slight preference for:  log("Called as %s" % ' '.join(sys.argv[1:]))






More information about the dev mailing list