[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] xm block-create doesn't work. It seems like this command hasn't even



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID f056b0cc171e2dade56b40ca9e464f9103849b38
# Parent  100837b7abecfa1bc336dd57d775d60090f747ad
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

diff -r 100837b7abec -r f056b0cc171e tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Fri Aug 12 17:52:47 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Sat Aug 13 09:06:20 2005
@@ -138,7 +138,7 @@
     if domlist and dom == domlist[0]['dom']:
         return domlist[0]
     return None
-    
+
 class XendDomainInfo:
     """Virtual machine object."""
 
@@ -754,7 +754,7 @@
         @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 -r 100837b7abec -r f056b0cc171e tools/python/xen/xend/server/controller.py
--- a/tools/python/xen/xend/server/controller.py        Fri Aug 12 17:52:47 2005
+++ b/tools/python/xen/xend/server/controller.py        Sat Aug 13 09:06:20 2005
@@ -142,7 +142,7 @@
     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 @@
         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 @@
     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):

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.