This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] [PATCH] Fix xm block-create

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Fix xm block-create
From: Anthony Liguori <aliguori@xxxxxxxxxx>
Date: Fri, 12 Aug 2005 14:33:21 -0500
Delivery-date: Fri, 12 Aug 2005 19:32:05 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)
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).


Anthony Liguori

Signed-off-by: Anthony Liguori
# HG changeset patch
# User Anthony Liguori <aliguori@xxxxxxxxxx>
# Node ID 17e1b03d6932fa4eb827d61fd7cb32c04213e421
# Parent  1c0812b8fbf5e3415b45cb2bb068610e28f9b7df
Make sure to pass in dev_type instead of self as this is what the function
actually expects.

diff -r 1c0812b8fbf5 -r 17e1b03d6932 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Fri Aug 12 19:32:44 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Aug 12 19:34:09 2005
@@ -138,7 +138,7 @@
     if domlist and dom == domlist[0]['dom']:
         return domlist[0]
     return None
 class XendDomainInfo:
     """Virtual machine object."""
@@ -747,7 +747,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()
# HG changeset patch
# User Anthony Liguori <aliguori@xxxxxxxxxx>
# Node ID 1c0812b8fbf5e3415b45cb2bb068610e28f9b7df
# Parent  faec6bf5081bc6d6632901fd771876fadfd6ae46
Have DeviceController::createDevice return the actual device as this is 
expected in the DomainInfo::create_device code.

diff -r faec6bf5081b -r 1c0812b8fbf5 tools/python/xen/xend/server/controller.py
--- a/tools/python/xen/xend/server/controller.py        Fri Aug 12 16:35:39 2005
+++ b/tools/python/xen/xend/server/controller.py        Fri Aug 12 19:32:44 2005
@@ -283,6 +283,8 @@
         dev.attach(recreate=recreate, change=change)
+        return dev
     def configureDevice(self, id, config, change=False):
         """Reconfigure an existing device.
         May be defined in subclass."""
# HG changeset patch
# User Anthony Liguori <aliguori@xxxxxxxxxx>
# Node ID faec6bf5081bc6d6632901fd771876fadfd6ae46
# Parent  8937fe723eef24375a0eae488443e1c5948c1a7a
Make sure to explictly cast to avoid Internal Server Errors

diff -r 8937fe723eef -r faec6bf5081b tools/python/xen/xend/server/controller.py
--- a/tools/python/xen/xend/server/controller.py        Wed Aug 10 22:08:12 2005
+++ b/tools/python/xen/xend/server/controller.py        Fri Aug 12 16:35:39 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():
@@ -325,7 +325,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-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Fix xm block-create, Anthony Liguori <=