← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1276367] [NEW] Unnecessary return statement in ovs_lib

 

Public bug reported:

[openstack-dev] [neutron] unnecessary return statement in ovs_lib
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.


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

** Affects: neutron
     Importance: Undecided
     Assignee: Mohammad Banikazemi (mb-s)
         Status: In Progress

** Changed in: neutron
       Status: New => In Progress

** Changed in: neutron
     Assignee: (unassigned) => Mohammad Banikazemi (mb-s)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1276367

Title:
  Unnecessary return statement in ovs_lib

Status in OpenStack Neutron (virtual network service):
  In Progress

Bug description:
  [openstack-dev] [neutron] unnecessary return statement in ovs_lib
  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.

  
  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

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1276367/+subscriptions


Follow ups

References