commit 5eeeefea4255ba773543787e8dd9a08d9af0335d
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Mon May 12 15:43:32 2014 +0200
InterfaceManager: use conf["name"] when Device not initialized
When using NetworkManager we don't create devices until we have created
connection objects for all the configured interfaces. The corresponding
Device objects therefore weren't initialized which caused crashes when
creating connection objects of devices that were higher in the
hierarchy. This patch fixes that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Slave/InterfaceManager.py | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index 547662d..43c53eb 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -176,6 +176,7 @@ class InterfaceManager(object):
class Device(object):
def __init__(self, if_manager):
+ self._initialized = False
self._configured = False
self._if_index = None
@@ -198,6 +199,8 @@ class Device(object):
self._ip = None #TODO
self._master = nl_msg.get_attr("IFLA_MASTER")
+ self._initialized = True
+
def update_netlink(self, nl_msg):
if self._if_index == nl_msg['index']:
self._hwaddr = normalize_hwaddr(nl_msg.get_attr("IFLA_ADDRESS"))
@@ -217,6 +220,8 @@ class Device(object):
if self._conf_dict:
self._conf_dict["name"] = self._name
+ self._initialized = True
+
#return an update message that will be sent to the controller
return {"type": "if_update",
"devname": self._name,
@@ -248,6 +253,9 @@ class Device(object):
self._conf_dict = conf
self._conf = NetConfigDevice(conf, self._if_manager)
+ if not self._initialized:
+ self._name = conf["name"]
+
def get_configuration(self):
return self._conf
Show replies by date