aboutsummaryrefslogtreecommitdiffstats
path: root/tools/python
diff options
context:
space:
mode:
authorPhilipp Hahn <hahn@univention.de>2011-12-01 18:30:29 +0000
committerPhilipp Hahn <hahn@univention.de>2011-12-01 18:30:29 +0000
commitf065c8c4aa02961b845123c3c07bc79976dfe4b5 (patch)
tree3f06406cbcad9155ae06b8f257f3a147de645b9e /tools/python
parentf00d216182450961589c08c6996c00fe1ab0d127 (diff)
downloadxen-f065c8c4aa02961b845123c3c07bc79976dfe4b5.tar.gz
xen-f065c8c4aa02961b845123c3c07bc79976dfe4b5.tar.bz2
xen-f065c8c4aa02961b845123c3c07bc79976dfe4b5.zip
xend: insufficient quoting in tapdisk
insufficient quoting between "tap-ctl list" and xend/server/BlktapController.py BlktapController splits the output into lines using \n, then each line at each space, and finally each of these 'words' at the '=', which fails if the filename contains spaces. As a quick work-around, the attached patch fixes the problem for me. That is, until tap-ctl changes it's output format. A more permanent solution would be to add proper quoting / escaping to tap-ctl and un-quoting / de-escaping to BlktapController.py Signed-off-by: Philipp Hahn <hahn@univention.de> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/python')
-rw-r--r--tools/python/xen/xend/server/BlktapController.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/python/xen/xend/server/BlktapController.py b/tools/python/xen/xend/server/BlktapController.py
index 7d4e5a88d5..51647e2d92 100644
--- a/tools/python/xen/xend/server/BlktapController.py
+++ b/tools/python/xen/xend/server/BlktapController.py
@@ -249,11 +249,12 @@ class TapdiskController(object):
_list = TapdiskController.exc('list')
if not _list: return []
- for line in _list.split('\n'):
+ for line in _list.splitlines():
tapdisk = TapdiskController.Tapdisk()
- for pair in line.split():
- key, value = pair.split('=')
+ # Since 'tap-ctl list' does not escape blanks in the path, hard-code the current format using 4 pairs to prevent splitting the path
+ for pair in line.split(None, 4):
+ key, value = pair.split('=', 1)
if key == 'pid':
tapdisk.pid = value
elif key == 'minor':
@@ -264,7 +265,7 @@ class TapdiskController(object):
elif key == 'state':
tapdisk.state = value
elif key == 'args' and value.find(':') != -1:
- tapdisk.dtype, tapdisk.image = value.split(':')
+ tapdisk.dtype, tapdisk.image = value.split(':', 1)
tapdisks.append(tapdisk)