commit feb59055c8102614c0dcdbe9006220e845782e1f
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Aug 16 09:54:44 2013 +0200
Machine: fix minor bugs
This commit fixes several Exception messages that were formatted with
variables, but there were no formatting escape sequences in them which
caused crashes.
Also the initialize method of class Interface uses the result of the
get_devices_by_hwaddr slave method to properly set the interface
devname.
Finally I had to add a sleep call after the interface deconfiguration
call because sometimes dynamically added devices (through libvirt) would
change their MAC address based on their master bond device, and wouldn't
have enough time to change back before deleting them.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/Machine.py | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index 88a4c21..f773bdb 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -351,7 +351,7 @@ class Interface(object):
def get_hwaddr(self):
if not self._hwaddr:
- msg = "Hardware address is not available for interface ''"
\
+ msg = "Hardware address is not available for interface
'%s'" \
% self.get_id()
raise MachineError(msg)
return self._hwaddr
@@ -361,7 +361,7 @@ class Interface(object):
def get_devname(self):
if not self._devname:
- msg = "Device name is not available for interface ''" \
+ msg = "Device name is not available for interface '%s'" \
% self.get_id()
raise MachineError(msg)
return self._devname
@@ -371,7 +371,7 @@ class Interface(object):
def get_network(self):
if not self._network:
- msg = "Network segment is not available for interface ''"
\
+ msg = "Network segment is not available for interface '%s'"
\
% self.get_id()
raise MachineError(msg)
return self._network
@@ -409,7 +409,7 @@ class Interface(object):
phys_devs = self._machine._rpc_call("get_devices_by_hwaddr",
self._hwaddr)
if len(phys_devs) == 1:
- pass
+ self.set_devname(phys_devs[0]["name"])
elif len(phys_devs) < 1:
msg = "Device %s not found on machine %s" \
% (self.get_id(), self._machine.get_id())
@@ -451,6 +451,7 @@ class Interface(object):
self._machine._rpc_call("deconfigure_interface", self.get_id())
self._configured = False
+ sleep(1)
class StaticInterface(Interface):
""" Static interface
Show replies by thread