[ovs-discuss] [PATCH] xenserver: Retrieve vSwitch version from binary in xsconsole

Ben Pfaff blp at nicira.com
Tue Jul 28 22:02:10 UTC 2009

Justin Pettit <jpettit at nicira.com> writes:

> +        if len(output) == 0:
> +            return "<unknown>"
> +        for l in output:
> +            if self.processname not in l:
> +                continue
> +            else:
> +                return l.split()[-1]
> +        return "<unknown>"

Isn't this just a long way of writing the following?

  for l in output:
    if self.processname in l:
      return l.split()[-1]
  return "<unknown>"

Also l and 1 look very similar, so l isn't a very good variable

(I realize that there is a lot of very similar code in the same

Once we change this code, there is no longer any code in Open
vSwitch or in NOX that uses the vSwitchVersion setting.  Does
that mean that we can drop the code from %post and %postun in
vswitch-xen.spec that sets it?  It tends to cause hangs on
install and uninstall.

More information about the discuss mailing list