Fix blktap to work with a bootloader
PATCH 1/1 Fix blktap to work with a bootloader
If a Xen guest has a bootloader configured, then it will fail to start on a blktap image. The problem is blkdev_uname_to_file, which cannot parse the "tap:aio:$filename" image strings: it tries to split the string apart at ":" and assign the result to a 2-tuple, and this results in a python error if the split results in three or more strings.
The fix is to split only at the first ":", and then to split again if we detect "tap:" as the image type.
tools/python/xen/util/blkif.py +3 -1
@@ -64,9 +64,11 @@ def blkdev_uname_to_file(uname): """Take a blkdev uname and return the corresponding filename.""" fn = None if uname.find(":") != -1: - (typ, fn) = uname.split(":") + (typ, fn) = uname.split(":", 1) if typ == "phy" and not fn.startswith("/"): fn = "/dev/%s" %(fn,) + if typ == "tap": + (typ, fn) = fn.split(":", 1) return fn def mount_mode(name):
Andrew Warfield
AppliedApplied, thanks!
a.
Quoted 31 lines · Stephen C. Tweedie
If a Xen guest has a bootloader configured, then it will fail to start on a blktap image. The problem is
blkdev_uname_to_file, which cannot parse the "tap:aio:$filename" image strings: it tries to split the string apart at ":" and assign the result to a 2-tuple, and this results in a python error if the split results in three or more strings.The fix is to split only at the first ":", and then to split again if we detect "tap:" as the image type.
Signed-off-by Stephen Tweedie <[email protected]>diff -r
94df5bd84195-raeba3dd98fbbtools/python/xen/util/blkif.pytools/python/xen/util/blkif.py Thu Sep 28 18:05:08 2006 +0100 renamed from tools/python/xen/util/blkif.py Thu Sep 28 17:09:09 2006 +0100 +3
-1@@ -64,9 +64,11 @@ def blkdev_uname_to_file(uname): """Take a blkdev uname and return the corresponding filename.""" fn = None if uname.find(":") != -1: - (typ, fn) = uname.split(":") + (typ, fn) = uname.split(":", 1) if typ == "phy" and not fn.startswith("/"): fn = "/dev/%s" %(fn,) + if typ == "tap": + (typ, fn) = fn.split(":", 1) return fn def mount_mode(name):
Hi all,
Quoted 2 lines · Stephen C. Tweedie
The fix is to split only at the first ":", and then to split again if we detect "tap:" as the image type.
Whoops, xen is still broken ---
tools/python/xen/util/blkif.py def blkdev_uname_to_file(uname): · line 70
Quoted 12 lines
Signed-off-by Stephen Tweedie <[email protected]>tools/python/xen/util/blkif.py +3
-1@@ -64,9 +64,11 @@ def blkdev_uname_to_file(uname): if uname.find(":") != -1: - (typ, fn) = uname.split(":") + (typ, fn) = uname.split(":", 1) if typ == "phy" and not fn.startswith("/"): fn = "/dev/%s" %(fn,) + if typ == "tap": + (typ, fn) = fn.split(":", 1) return fn
was what I posted, but only the second two new lines actually got committed to the xenbits repository.
Without the first split(":", 1) change, we'll split at _all_ the ":"s in the uname, and if there are more than one, then the assignment to the (typ,fn) 2-tuple will fail.
Can this please be fixed properly? It's just a 3-character commit that's left. :-)
btw, is the process of merging patches from email being done completely manually? git certainly has really good pull-from-email scripts that avoid this sort of oversight, but I'm not sure hg is quite so well equipped.
Cheers,
Stephen
Quoted 4 lines · Stephen C. Tweedie
btw, is the process of merging patches from email being done completely manually? git certainly has really good pull-from-email scripts that avoid this sort of oversight, but I'm not sure hg is quite so well equipped.
Usually patches are applied as a whole unit using 'patch', even if they have to be manually extracted from the email. Looks like Andy might have done this one by hand and got it wrong!
-- Keir
Quoted 10 lines · Keir Fraser
Quoted 4 lines · Stephen C. Tweedie
btw, is the process of merging patches from email being done completely manually? git certainly has really good pull-from-email scripts that avoid this sort of oversight, but I'm not sure hg is quite so well equipped.
Usually patches are applied as a whole unit using 'patch', even if they have to be manually extracted from the email. Looks like Andy might have done this one by hand and got it wrong!
On that note, _please_ can people submit patches
1. as attachments,
2. with a text/plain MIME type, and preferably
3. using hg export with a decent comment and a Signed-off-by: line in place.
It makes life a lot easier!
If your mailer doesn't do text/plain attachments properly, and for some reason you still want to use such a broken heap of four-ex, then the next best thing is plain-text inline in the message (because most people can't review patches very easily if your mailer has sent it as an octet-stream).
Thanks,
Ewan.
Ewan Mellor wrote: [Tue Oct 10 2006, 11:26:53AM EDT]
Quoted 7 lines
On that note, _please_ can people submit patches
1. as attachments,
2. with a text/plain MIME type, and preferably
3. using hg export with a decent comment and a Signed-off-by: line in place.It makes life a lot easier!
if this is what you'd like, it might be helpful if you'd provide a patch to mercurial's patchbomb extension (i.e. hg email) to work in this manner. Presently it does inline only.
Aron
Quoted 7 lines · Aron Griffis
Quoted 7 lines
On that note, _please_ can people submit patches
1. as attachments,
2. with a text/plain MIME type, and preferably
3. using hg export with a decent comment and a Signed-off-by: line in
place.
Quoted 5 lines
Quoted 1 line
It makes life a lot easier!
if this is what you'd like, it might be helpful if you'd provide a patch to mercurial's patchbomb extension (i.e. hg email) to work in this manner. Presently it does inline only.
Inline is fine so long as your email client doesn't mangle the patch.
-- Keir