From: Ondrej Lichtner olichtne@redhat.com
Since the controller now recieves updates about interface hwaddrs from the slave, we need to remember the original hwaddr of dynamically created devices, because it's the only one we can use for deleting the interface later.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst/Controller/Machine.py | 10 +++++++++- lnst/Controller/NetTestController.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py index 22d1f0b..fdd400a 100644 --- a/lnst/Controller/Machine.py +++ b/lnst/Controller/Machine.py @@ -484,6 +484,13 @@ class VirtualInterface(Interface): def __init__(self, machine, if_id, if_type): super(VirtualInterface, self).__init__(machine, if_id, if_type)
+ def get_orig_hwaddr(self): + if not self._orig_hwaddr: + msg = "Hardware address is not available for interface '%s'" \ + % self.get_id() + raise MachineError(msg) + return self._orig_hwaddr + def initialize(self): domain_ctl = self._machine.get_domain_ctl()
@@ -513,6 +520,7 @@ class VirtualInterface(Interface): logging.info("Creating interface %s (%s) on machine %s", self.get_id(), self._hwaddr, self._machine.get_id())
+ self._orig_hwaddr = self._hwaddr domain_ctl.attach_interface(self._hwaddr, br_name)
@@ -533,7 +541,7 @@ class VirtualInterface(Interface):
def cleanup(self): domain_ctl = self._machine.get_domain_ctl() - domain_ctl.detach_interface(self._hwaddr) + domain_ctl.detach_interface(self._orig_hwaddr)
def is_ready(self): ifaces = self._machine._rpc_call('get_devices_by_hwaddr', self._hwaddr) diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py index fd7692d..c2d7d65 100644 --- a/lnst/Controller/NetTestController.py +++ b/lnst/Controller/NetTestController.py @@ -426,7 +426,7 @@ class NetTestController: machine["interfaces"] = []
for i in m._interfaces: - hwaddr = i.get_hwaddr() + hwaddr = i.get_orig_hwaddr()
machine["interfaces"].append(hwaddr)
lnst-developers@lists.fedorahosted.org