[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [XEND] Change blkif to use the new style configuration
# HG changeset patch # User Alastair Tse <atse@xxxxxxxxxxxxx> # Node ID 16946dcbf14be9b2e12240292300fd2cfb427135 # Parent 9a932b5c7947cb1512e3f3a1fe65a5541e56e425 [XEND] Change blkif to use the new style configuration Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx> --- tools/python/xen/xend/server/blkif.py | 54 +++++++++++++++++----------------- 1 files changed, 28 insertions(+), 26 deletions(-) diff -r 9a932b5c7947 -r 16946dcbf14b tools/python/xen/xend/server/blkif.py --- a/tools/python/xen/xend/server/blkif.py Thu Oct 05 17:29:19 2006 +0100 +++ b/tools/python/xen/xend/server/blkif.py Thu Oct 05 17:29:19 2006 +0100 @@ -16,7 +16,6 @@ # Copyright (C) 2005, 2006 XenSource Inc. #============================================================================ - import re import string @@ -24,9 +23,7 @@ from xen.util import security from xen.util import security from xen.xend import sxp from xen.xend.XendError import VmError - from xen.xend.server.DevController import DevController - class BlkifController(DevController): """Block device interface controller. Handles all block devices @@ -38,12 +35,10 @@ class BlkifController(DevController): """ DevController.__init__(self, vm) - def getDeviceDetails(self, config): """@see DevController.getDeviceDetails""" - uname = sxp.child_value(config, 'uname') - - dev = sxp.child_value(config, 'dev') + uname = sxp.child_value(config, 'uname', '') + dev = sxp.child_value(config, 'dev', '') if 'ioemu:' in dev: (_, dev) = string.split(dev, ':', 1) @@ -74,6 +69,10 @@ class BlkifController(DevController): 'mode' : mode } + uuid = sxp.child_value(config, 'uuid') + if uuid: + back['uuid'] = uuid + if security.on(): (label, ssidref, policy) = security.get_res_security_details(uname) back.update({'acm_label' : label, @@ -105,27 +104,30 @@ class BlkifController(DevController): (self.deviceClass, devid, config)) - def configuration(self, devid): - """@see DevController.configuration""" + def getDeviceConfiguration(self, devid): + """Returns the configuration of a device. - result = DevController.configuration(self, devid) + @note: Similar to L{configuration} except it returns a dict. + @return: dict + """ + config = DevController.getDeviceConfiguration(self, devid) + devinfo = self.readBackend(devid, 'dev', 'type', 'params', 'mode', + 'uuid') + dev, typ, params, mode, uuid = devinfo + + if dev: + dev_type = self.readFrontend(devid, 'device-type') + if dev_type: + dev += ':' + dev_type + config['dev'] = dev + if typ and params: + config['uname'] = typ +':' + params + if mode: + config['mode'] = mode + if uuid: + config['uuid'] = uuid - (dev, typ, params, mode) = self.readBackend(devid, - 'dev', 'type', 'params', - 'mode') - - if dev: - (dev_type) = self.readFrontend(devid, 'device-type') - if dev_type: - dev += ":" + dev_type - result.append(['dev', dev]) - if typ and params: - result.append(['uname', typ + ":" + params]) - if mode: - result.append(['mode', mode]) - - return result - + return config def destroyDevice(self, devid): """@see DevController.destroyDevice""" _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |