Antoni Segura Puimedon has uploaded a new change for review.

Change subject: Fix inefficiency in getBridgelessNetworks
......................................................................

Fix inefficiency in getBridgelessNetworks

This commit makes getBridgelessNetworks use the Netinfo instance
networks instead of generating its own. Additionally, it is put in
the style and vicinity of the most semantically similar method of
the class, to improve the module's readability.

Change-Id: I68b5ecf415d4ab49a56019d8875dde57ca29d1fc
Signed-off-by: Antoni S. Puimedon <[email protected]>
---
M vdsm/netinfo.py
1 file changed, 11 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/11071/1

diff --git a/vdsm/netinfo.py b/vdsm/netinfo.py
index 4749708..43a2781 100644
--- a/vdsm/netinfo.py
+++ b/vdsm/netinfo.py
@@ -439,6 +439,17 @@
         return chain(self.getBridgelessNetworksForIface(iface),
                      self.getBridgedNetworksForIface(iface))
 
+    def getBridgelessNetworks(self):
+        """
+        Get list of bridgeless networks
+
+        :returns: list of network names
+        :rtype: List
+        """
+        for network, netdict in self.networks.iteritems():
+            if not netdict['bridged']:
+                yield network
+
     def getBridgelessNetworksForIface(self, iface):
         """ Return all bridgeless networks attached to nic/bond """
         for network, netdict in self.networks.iteritems():
@@ -494,13 +505,3 @@
                 lnics.append(port)
 
         return lnics, vlan, bonding
-
-    def getBridgelessNetworks(self):
-        """
-        Get list of birdgeless networks
-
-        :returns: list of networks name
-        :rtype: List
-        """
-        return [netname for (netname, net) in networks().iteritems()
-                if not 'bridge' in net]


--
To view, visit http://gerrit.ovirt.org/11071
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I68b5ecf415d4ab49a56019d8875dde57ca29d1fc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to