mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
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>
This commit is contained in:
1 parent
543cb6d751
commit
499681128c
1 file changed
+5
-1
@@ -56,8 +56,12 @@ class BlkifController(DevController):
|
||||
else:
|
||||
try:
|
||||
(typ, params) = string.split(uname, ':', 1)
|
||||
if typ not in ('phy', 'file'):
|
||||
raise VmError(
|
||||
'Block device must have "phy" or "file" specified to type')
|
||||
except ValueError:
|
||||
(typ, params) = ("", "")
|
||||
raise VmError(
|
||||
'Block device must have physical details specified')
|
||||
|
||||
mode = config.get('mode', 'r')
|
||||
if mode not in ('r', 'w', 'w!'):
|
||||
|
||||