direct-io.hg

view tools/python/xen/xend/server/blkif.py @ 6963:1bea937e53cc

The vmx guest loading is broken from 6925 because of the new
DevController code.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Sep 20 16:13:01 2005 +0000 (2005-09-20)
parents 3133e64d0462
children 55fc0ecc19c3
line source
1 #============================================================================
2 # This library is free software; you can redistribute it and/or
3 # modify it under the terms of version 2.1 of the GNU Lesser General Public
4 # License as published by the Free Software Foundation.
5 #
6 # This library is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 # Lesser General Public License for more details.
10 #
11 # You should have received a copy of the GNU Lesser General Public
12 # License along with this library; if not, write to the Free Software
13 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14 #============================================================================
15 # Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
16 # Copyright (C) 2005 XenSource Ltd
17 #============================================================================
20 import re
21 import string
23 from xen.util import blkif
24 from xen.xend import sxp
26 from xen.xend.server.DevController import DevController
29 class BlkifController(DevController):
30 """Block device interface controller. Handles all block devices
31 for a domain.
32 """
34 def __init__(self, vm):
35 """Create a block device controller.
36 """
37 DevController.__init__(self, vm)
40 def getDeviceDetails(self, config):
41 """@see DevController.getDeviceDetails"""
43 typedev = sxp.child_value(config, 'dev')
44 if re.match('^ioemu:', typedev):
45 return (0,{},{})
47 devid = blkif.blkdev_name_to_number(sxp.child_value(config, 'dev'))
49 (typ, params) = string.split(sxp.child_value(config, 'uname'), ':', 1)
50 back = { 'type' : typ,
51 'params' : params
52 }
54 if 'r' == sxp.child_value(config, 'mode', 'r'):
55 back['read-only'] = "" # existence indicates read-only
57 front = { 'virtual-device' : "%i" % devid }
59 return (devid, back, front)