[openstack-dev] [neutron] unnecessary return statement in ovs_lib

Mohammad Banikazemi mb at us.ibm.com
Thu Jan 16 02:48:46 UTC 2014



Came across the following issue while looking at ovs_lib [1]:

The BaseOVS class has the add_bridge() method which after creating an OVS
bridge, returns an OVSBridge object. BaseOVS class is only used by
OVSBridge defined in the same file. OVSBridge has a create() method that
calls the add_bridge() nethod mentioned earlier but do not use the return
value. (See the methods add_bridge and create below.)

What seems odd is the return statement at the end of add_bridge() which is
not used anywhere and doesn't make much sense as far as I can see but I may
be missing something. The OVSBase is never directly used anywhere in
Neutron directory. Of course the return does not do any harm beyond
creating an unused object but it looks to me that it should be removed
unless there is a good reason (or a potential future use case) for it.

Should we remove the return statement?

-Mohammad



class BaseOVS(object):
        ...
    def add_bridge(self, bridge_name):
        self.run_vsctl(["--", "--may-exist", "add-br", bridge_name])
        return OVSBridge(bridge_name, self.root_helper)



class OVSBridge(BaseOVS):
        ...
    def create(self):
        self.add_bridge(self.br_name)



[1]
https://github.com/openstack/neutron/blob/master/neutron/agent/linux/ovs_lib.py
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140115/813442db/attachment.html>


More information about the OpenStack-dev mailing list