commit f0579e1a04a420b1294dd6dc8cd3bc84722d12e8 Author: Ondrej Lichtner olichtne@redhat.com Date: Mon Sep 29 16:08:26 2014 +0200
Machine: deconfiguration fixes
Interface configuration starts with mapping the interface id to a kernel interface index. This mapping was previously only globally cleared by the slave when new configuration started. This patch makes the controller unmap interfaces one by one in the correct order.
One other minor change - restoring the use_nm option now happens before calling the "bye" method and not is not called in the "finally" block since the connection might not be functional anymore.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com Signed-off-by: Jiri Pirko jiri@resnulli.us
lnst/Controller/Machine.py | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-) --- diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py index 33d1795..b1b4ecf 100644 --- a/lnst/Controller/Machine.py +++ b/lnst/Controller/Machine.py @@ -223,6 +223,7 @@ class Machine(object):
self.del_namespaces()
+ self.restore_nm_option() self._rpc_call("bye") except: #cleanup is only meaningful on dynamic interfaces, and should @@ -234,7 +235,6 @@ class Machine(object): iface.cleanup() raise finally: - self.restore_nm_option() self._msg_dispatcher.disconnect_slave(self.get_id())
self._configured = False @@ -629,7 +629,7 @@ class Interface(object): self.down()
def cleanup(self): - pass + self._machine._rpc_call("unmap_if", self._id)
def configure(self): if self._configured: @@ -657,7 +657,8 @@ class Interface(object): if self._netns != None: self._machine._rpc_call_to_netns(self._netns, "deconfigure_interface", self.get_id()) - self._machine._rpc_call_to("return_if_netns", self.get_id()) + self._machine._rpc_call_to_netns(self._netns, + "return_if_netns", self.get_id()) else: self._machine._rpc_call("deconfigure_interface", self.get_id()) self._configured = False @@ -689,6 +690,9 @@ class LoopbackInterface(Interface): def initialize(self): pass
+ def cleanup(self): + pass + def configure(self): self._hwaddr = '00:00:00:00:00:00' if self._netns: @@ -735,8 +739,11 @@ class LoopbackInterface(Interface): if self._netns != None: self._machine._rpc_call_to_netns(self._netns, "deconfigure_interface", self.get_id()) + self._machine._rpc_call_to_netns(self._netns, + "unmap_if", self.get_id()) else: self._machine._rpc_call("deconfigure_interface", self.get_id()) + self._machine._rpc_call("unmap_if", self.get_id()) self._configured = False
class VirtualInterface(Interface): @@ -815,6 +822,7 @@ class VirtualInterface(Interface): super(VirtualInterface, self).initialize()
def cleanup(self): + self._machine._rpc_call("unmap_if", self._id) domain_ctl = self._machine.get_domain_ctl() domain_ctl.detach_interface(self._orig_hwaddr)
@@ -835,6 +843,9 @@ class SoftInterface(Interface): def initialize(self): pass
+ def cleanup(self): + pass + def configure(self): if self._configured: return @@ -879,8 +890,11 @@ class SoftInterface(Interface): if self._netns != None: self._machine._rpc_call_to_netns(self._netns, "deconfigure_interface", self.get_id()) + self._machine._rpc_call_to_netns(self._netns, + "unmap_if", self.get_id()) else: self._machine._rpc_call("deconfigure_interface", self.get_id()) + self._machine._rpc_call("unmap_if", self.get_id()) self._configured = False
class UnusedInterface(Interface):
lnst-developers@lists.fedorahosted.org