ia64/xen-unstable

changeset 17635:0a8fc1a62796

xend: Add syntax check for block devices

If we define wrong values to a disk parameter in domain configuration
files, we get an error message or a guest OS panic.

1. If we define a wrong disk type, xm create command error occurs
about 100 seconds later.
e.g. disk=['xyz:/xen/root-vm1.img,hda1,w']

2. If we forget a disk type, a guest OS panic occurs.
e.g. disk=['/xen/root-vm1.img,hda1,w']

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon May 12 11:19:09 2008 +0100 (2008-05-12)
parents 0f18d5454c7b
children f8ce6e3d86c7
files tools/python/xen/xend/server/blkif.py
line diff
     1.1 --- a/tools/python/xen/xend/server/blkif.py	Mon May 12 11:16:43 2008 +0100
     1.2 +++ b/tools/python/xen/xend/server/blkif.py	Mon May 12 11:19:09 2008 +0100
     1.3 @@ -56,8 +56,12 @@ class BlkifController(DevController):
     1.4          else:
     1.5              try:
     1.6                  (typ, params) = string.split(uname, ':', 1)
     1.7 +                if typ not in ('phy', 'file'):
     1.8 +                    raise VmError(
     1.9 +                        'Block device must have "phy" or "file" specified to type')
    1.10              except ValueError:
    1.11 -                (typ, params) = ("", "")
    1.12 +                raise VmError(
    1.13 +                    'Block device must have physical details specified')
    1.14  
    1.15          mode = config.get('mode', 'r')
    1.16          if mode not in ('r', 'w', 'w!'):