From: Ondrej Lichtner olichtne@redhat.com
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@redhat.com --- lnst/Slave/InterfaceManager.py | 8 ++++++++ 1 file changed, 8 insertions(+)
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