Change in vdsm[master]: net: configuredPorts should handle empty nets.

ibarkan at redhat.com ibarkan at redhat.com
Mon Jun 15 08:31:36 UTC 2015


Ido Barkan has uploaded a new change for review.

Change subject: net: configuredPorts should handle empty nets.
......................................................................

net: configuredPorts should handle empty nets.

This happens during testRestoreNetworksOnlyRestoreUnchangedDevices
which simulates boot.

Change-Id: I72d929f413fd98db46b58ada8e1353436f6cf06a
Signed-off-by: Ido Barkan <ibarkan at redhat.com>
---
M lib/vdsm/netconfpersistence.py
M vdsm/network/api.py
2 files changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/56/42356/1

diff --git a/lib/vdsm/netconfpersistence.py b/lib/vdsm/netconfpersistence.py
index 340de9d..ec47e55 100644
--- a/lib/vdsm/netconfpersistence.py
+++ b/lib/vdsm/netconfpersistence.py
@@ -432,6 +432,9 @@
 
 def configuredPorts(nets, bridge):
     """Return the configured ports for the bridge"""
+    if bridge not in nets:
+        return []
+
     network = nets[bridge]
     nic = network.get('nic')
     bond = network.get('bonding')
diff --git a/vdsm/network/api.py b/vdsm/network/api.py
index 40a7b85..935a748 100755
--- a/vdsm/network/api.py
+++ b/vdsm/network/api.py
@@ -386,7 +386,7 @@
         try:
             nets = configurator.runningConfig.networks
         except AttributeError:
-            nets = None  # ifcfg does not need net definitions
+            nets = {}  # ifcfg does not need net definitions
         _netinfo.networks[network]['ports'] = persistence.configuredPorts(
             nets, network)
     elif not os.path.exists('/sys/class/net/' + netAttr['iface']):


-- 
To view, visit https://gerrit.ovirt.org/42356
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I72d929f413fd98db46b58ada8e1353436f6cf06a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan at redhat.com>


More information about the vdsm-patches mailing list