From: Dan Smith <danms@us.ibm.com>
To: Xen Developers <xen-devel@lists.xensource.com>
Subject: [PATCH] Fix block-detach of non-existent device
Date: Tue, 04 Oct 2005 15:07:54 -0700 [thread overview]
Message-ID: <87k6gtx7et.fsf@us.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 316 bytes --]
The attached patch prevents Xend from blowing up when a user tries to
detach a non-existent block device.
I also added a check in xm to make sure that a numeric id is supplied,
instead of a device name.
This will cause xm-test 04_block-destroy_nonattached_neg to pass.
Signed-off-by: Dan Smith <danms@us.ibm.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: block_detach.patch --]
[-- Type: text/x-patch, Size: 1437 bytes --]
diff -r ec84b119e4ed tools/python/xen/xend/server/DevController.py
--- a/tools/python/xen/xend/server/DevController.py Tue Oct 4 14:02:51 2005
+++ b/tools/python/xen/xend/server/DevController.py Tue Oct 4 13:12:38 2005
@@ -78,8 +78,12 @@
backpath = xstransact.Read(frontpath, "backend")
xstransact.Remove(frontpath)
- xstransact.Remove(backpath)
-
+
+ if backpath:
+ xstransact.Remove(backpath)
+ else:
+ raise VmError("Device not connected")
+
def configurations(self):
return map(lambda x: self.configuration(int(x)),
diff -r ec84b119e4ed tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py Tue Oct 4 14:02:51 2005
+++ b/tools/python/xen/xm/main.py Tue Oct 4 13:12:38 2005
@@ -165,6 +165,9 @@
error = str(ex)
if error == "Not found" and dom != None:
err("Domain '%s' not found when running 'xm %s'" % (dom, cmd))
+ sys.exit(1)
+ elif error == "Exception: Device not connected":
+ err("Device not connected")
sys.exit(1)
else:
raise ex
@@ -532,7 +535,12 @@
arg_check(args,2,"block-detach")
dom = args[0]
- dev = args[1]
+
+ try:
+ dev = int(args[1])
+ except ValueError, e:
+ err("Invalid device id: %s" % args[1])
+ sys.exit(1)
from xen.xend.XendClient import server
server.xend_domain_device_destroy(dom, 'vbd', dev)
[-- Attachment #3: Type: text/plain, Size: 88 bytes --]
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms@us.ibm.com
[-- Attachment #4: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2005-10-04 22:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-04 22:07 Dan Smith [this message]
2005-10-04 23:13 ` [PATCH] Fix block-detach of non-existent device Ewan Mellor
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=87k6gtx7et.fsf@us.ibm.com \
--to=danms@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.