commit 08adb51f85c9d5ca011869cf9d8971708d05f63d Author: Ondrej Lichtner olichtne@redhat.com Date: Wed Aug 22 15:19:16 2012 +0200
Ticket #4: phys_id from int to string
Physical id of devices is no longer converted to integer, and is used as a string. Because of this a few formatted strings had to be changed to expect strings and not integers.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com
NetTest/NetTestController.py | 8 ++++---- NetTest/NetTestParse.py | 6 +++--- netconfig.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) --- diff --git a/NetTest/NetTestController.py b/NetTest/NetTestController.py index 2ff6a8a..9985523 100644 --- a/NetTest/NetTestController.py +++ b/NetTest/NetTestController.py @@ -131,7 +131,7 @@ class NetTestController: br_name = brctl.get_name() brctl.init()
- logging.info("Creating netdevice %d (%s) on machine %s", + logging.info("Creating netdevice %s (%s) on machine %s", dev_id, dev["hwaddr"], machine_id)
domain_ctl = info["virt_domain_ctl"] @@ -142,7 +142,7 @@ class NetTestController:
if not ready: msg = "Netdevice initialization failed." \ - "Unable to create device %d (%s) on machine %s" \ + "Unable to create device %s (%s) on machine %s" \ % (dev_id, dev["hwaddr"], machine_id) raise NetTestError(msg)
@@ -154,7 +154,7 @@ class NetTestController: if len(phys_devs) == 1: pass elif len(phys_devs) < 1: - msg = "Device %d not found on machine %s" \ + msg = "Device %s not found on machine %s" \ % (dev_id, machine_id) raise NetTestError(msg) elif len(phys_devs) > 1: @@ -271,7 +271,7 @@ class NetTestController: if "created_devices" not in info: continue for dev_id, dev in reversed(info["created_devices"]): - logging.info("Removing netdevice %d (%s) from machine %s", + logging.info("Removing netdevice %s (%s) from machine %s", dev_id, dev["hwaddr"], machine_id) domain_ctl = info["virt_domain_ctl"] domain_ctl.detach_interface(dev["hwaddr"]) diff --git a/NetTest/NetTestParse.py b/NetTest/NetTestParse.py index b69eea3..58e7b29 100644 --- a/NetTest/NetTestParse.py +++ b/NetTest/NetTestParse.py @@ -160,7 +160,7 @@ class NetMachineConfigParse(RecipeParser):
def _netdevice(self, node, params): machine = self._machine - phys_id = self._get_attribute(node, "phys_id", int) + phys_id = self._get_attribute(node, "phys_id")
dev = machine["netdevices"][phys_id] = {} dev["create"] = params["create"] @@ -248,7 +248,7 @@ class NetConfigParse(RecipeParser): devices = self._devices
if dev["type"] == "eth": - phys_id = self._get_attribute(node, "phys_id", int) + phys_id = self._get_attribute(node, "phys_id") self._check_phys_id(node, phys_id, netconfig) dev["phys_id"] = phys_id
@@ -271,7 +271,7 @@ class NetConfigParse(RecipeParser): if not "phys_id" in config[key]: continue if config[key]["phys_id"] == dev_pid: - msg = "same phys_id "%d" used more than once" % dev_pid + msg = "same phys_id "%s" used more than once" % dev_pid raise XmlProcessingError(msg, node)
def _addresses(self, node, params): diff --git a/netconfig.py b/netconfig.py index 9551ac6..c0baf97 100755 --- a/netconfig.py +++ b/netconfig.py @@ -91,7 +91,7 @@ def netmachineconfig_to_xml(machine_data):
devices = "" for phys_id, netdev in machine_data["netdevices"].iteritems(): - pid = "phys_id="%d" " % phys_id + pid = "phys_id="%s" " % phys_id dev_type = "" name = "" hwaddr = ""
lnst-developers@lists.fedorahosted.org