xen/blktools-bimodal.diff

72 lines
2.6 KiB
Diff

bimodal: blk tools
Add one more option to the disk configuration, so one can specify the
protocol the frontend speaks in the config file. This is needed for
old frontends which don't advertise the protocol they are speaking
themself.
I'm not that happy with this approach, but it works for now and I'm
kida lost in the stack of python classes doing domain and device
handling ...
Signed-off-by: Gerd Hoffmann <kraxel@suse.de>
---
tools/python/xen/xend/server/blkif.py | 3 +++
tools/python/xen/xm/create.py | 7 ++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
Index: build-64-release304-13133/tools/python/xen/xend/server/blkif.py
===================================================================
--- build-64-release304-13133.orig/tools/python/xen/xend/server/blkif.py
+++ build-64-release304-13133/tools/python/xen/xend/server/blkif.py
@@ -38,6 +38,7 @@ class BlkifController(DevController):
"""@see DevController.getDeviceDetails"""
uname = config.get('uname', '')
dev = config.get('dev', '')
+ protocol = config.get('protocol')
if 'ioemu:' in dev:
(_, dev) = string.split(dev, ':', 1)
@@ -85,6 +86,8 @@ class BlkifController(DevController):
front = { 'virtual-device' : "%i" % devid,
'device-type' : dev_type
}
+ if protocol:
+ front.update({ 'protocol' : protocol });
return (devid, back, front)
Index: build-64-release304-13133/tools/python/xen/xm/create.py
===================================================================
--- build-64-release304-13133.orig/tools/python/xen/xm/create.py
+++ build-64-release304-13133/tools/python/xen/xm/create.py
@@ -531,7 +531,7 @@ def configure_image(vals):
def configure_disks(config_devs, vals):
"""Create the config for disks (virtual block devices).
"""
- for (uname, dev, mode, backend) in vals.disk:
+ for (uname, dev, mode, backend, protocol) in vals.disk:
if uname.startswith('tap:'):
cls = 'tap'
else:
@@ -543,6 +543,8 @@ def configure_disks(config_devs, vals):
['mode', mode ] ]
if backend:
config_vbd.append(['backend', backend])
+ if protocol:
+ config_vbd.append(['protocol', protocol])
config_devs.append(['device', config_vbd])
def configure_pci(config_devs, vals):
@@ -787,7 +789,10 @@ def preprocess_disk(vals):
n = len(d)
if n == 3:
d.append(None)
+ d.append(None)
elif n == 4:
+ d.append(None)
+ elif n == 5:
pass
else:
err('Invalid disk specifier: ' + v)