xend: bootable flag of VBD not always of type int

1. Calling VDB.set_bootable(True) results in string 'True' in managed
   config file. After xend restart, conversion int(bootable) in
   server/blkif.py fails.
2. selection of bootable disks in XendDomainInfo.py requires
   type(bootable) == int not str, otherwise all disks are taken as
   bootable.

This patch converts the bootable flag always to int.

Signed-off-by: Lutz Dube <Lutz.Dube@ts.fujitsu.com>
This commit is contained in:
Keir Fraser committed 2009-10-21 09:23:10 +01:00
1 parent ba0d6cfc6b
commit 6d1d7ac48c
2 files changed
+13 -4

No files matched your search

+1 -1
View File
@@ -2091,7 +2091,7 @@ class XendAPI(object):
bootable = bool(bootable)
xd = XendDomain.instance()
vm = xd.get_vm_with_dev_uuid('vbd', vbd_ref)
vm.set_dev_property('vbd', vbd_ref, 'bootable', bootable)
vm.set_dev_property('vbd', vbd_ref, 'bootable', int(bootable))
xd.managed_config_save(vm)
return xen_api_success_void()
+12 -3
View File
@@ -1429,9 +1429,14 @@ class XendConfig(dict):
if param not in target:
target[param] = []
if dev_uuid not in target[param]:
if dev_type == 'vbd' and 'bootable' not in dev_info:
# Compat hack -- mark first disk bootable
dev_info['bootable'] = int(not target[param])
if dev_type == 'vbd':
if 'bootable' not in dev_info:
# Compat hack -- mark first disk bootable
dev_info['bootable'] = int(not target[param])
else:
# ensure type of bootable is int (on xend restart
# it's of type str)
dev_info['bootable'] = int(dev_info['bootable'])
target[param].append(dev_uuid)
elif dev_type == 'tap' or dev_type == 'tap2':
if 'vbd_refs' not in target:
@@ -1440,6 +1445,10 @@ class XendConfig(dict):
if 'bootable' not in dev_info:
# Compat hack -- mark first disk bootable
dev_info['bootable'] = int(not target['vbd_refs'])
else:
# ensure type of bootable is int (on xend restart it's
# of type str)
dev_info['bootable'] = int(dev_info['bootable'])
target['vbd_refs'].append(dev_uuid)
elif dev_type == 'vfb':
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.