From: Anthony Liguori <aliguori@us.ibm.com>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH] Fix xm block-create
Date: Fri, 12 Aug 2005 14:33:21 -0500 [thread overview]
Message-ID: <42FCF981.3060100@us.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 657 bytes --]
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).
Regards,
Anthony Liguori
Signed-off-by: Anthony Liguori
[-- Attachment #2: xend_block_create.diff --]
[-- Type: text/x-patch, Size: 2913 bytes --]
# HG changeset patch
# User Anthony Liguori <aliguori@us.ibm.com>
# 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@us.ibm.com>
# 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)
dev.exportToDB()
+ 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@us.ibm.com>
# 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):
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2005-08-12 19:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42FCF981.3060100@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.