aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-08-13 09:06:20 +0000
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-08-13 09:06:20 +0000
commit2591bbb102f16f02b75abd74adde94fa1b43274a (patch)
tree194fc34f7385f04a42bb2dd49f77f8355df4c9b7
parentf24303ce78b18f84088051fabf408d65f53cd718 (diff)
downloadxen-2591bbb102f16f02b75abd74adde94fa1b43274a.tar.gz
xen-2591bbb102f16f02b75abd74adde94fa1b43274a.tar.bz2
xen-2591bbb102f16f02b75abd74adde94fa1b43274a.zip
xm block-create doesn't work. It seems like this command hasn't even
been tested (perhaps since the un-Twisting?). This particular problem was that one function was being called with self instead of the right argument and another function's return value was being used when it didn't actually return anything. This patch also improves the error handling a bit by making sure we don't thrown an exception on a log statement with a None value. In general, one should always use the % formatter instead of concatination for strings in Python (even though this is not what this patch does). Signed-off-by: Anthony Liguori
-rw-r--r--tools/python/xen/xend/XendDomainInfo.py4
-rwxr-xr-xtools/python/xen/xend/server/controller.py6
2 files changed, 6 insertions, 4 deletions
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py
index 4e01041342..029021f13e 100644
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -138,7 +138,7 @@ def dom_get(dom):
if domlist and dom == domlist[0]['dom']:
return domlist[0]
return None
-
+
class XendDomainInfo:
"""Virtual machine object."""
@@ -754,7 +754,7 @@ class XendDomainInfo:
@param dev_config: device configuration
"""
dev_type = sxp.name(dev_config)
- dev = self.createDevice(self, dev_config, change=True)
+ dev = self.createDevice(dev_type, dev_config, change=True)
self.config.append(['device', dev.getConfig()])
return dev.sxpr()
diff --git a/tools/python/xen/xend/server/controller.py b/tools/python/xen/xend/server/controller.py
index f399503d7f..a1446c3093 100755
--- a/tools/python/xen/xend/server/controller.py
+++ b/tools/python/xen/xend/server/controller.py
@@ -142,7 +142,7 @@ class DevControllerTable:
def createDevController(self, type, vm, recreate=False):
cls = self.getDevControllerClass(type)
if not cls:
- raise XendError("unknown device type: " + type)
+ raise XendError("unknown device type: " + str(type))
return cls.createDevController(vm, recreate=recreate)
def getDevControllerTable():
@@ -283,6 +283,8 @@ class DevController:
dev.attach(recreate=recreate, change=change)
dev.exportToDB()
+ return dev
+
def configureDevice(self, id, config, change=False):
"""Reconfigure an existing device.
May be defined in subclass."""
@@ -325,7 +327,7 @@ class DevController:
def getDevice(self, id, error=False):
dev = self.devices.get(id)
if error and not dev:
- raise XendError("invalid device id: " + id)
+ raise XendError("invalid device id: " + str(id))
return dev
def getDeviceIds(self):