[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-3.4-testing] xend: bootable flag of VBD not always of type int



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1256289889 -3600
# Node ID f7e9ac1ef92bdc30ebf20753ef1e83e2e517aad8
# Parent  2beca5f48ffed21c4b56cabd34707e09b4c31068
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@xxxxxxxxxxxxxx>
xen-unstable changeset:   20350:3bbe9ab2202b
xen-unstable date:        Wed Oct 21 09:23:10 2009 +0100
---
 tools/python/xen/xend/XendAPI.py    |    2 +-
 tools/python/xen/xend/XendConfig.py |   15 ++++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff -r 2beca5f48ffe -r f7e9ac1ef92b tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Fri Oct 23 10:24:19 2009 +0100
+++ b/tools/python/xen/xend/XendAPI.py  Fri Oct 23 10:24:49 2009 +0100
@@ -1968,7 +1968,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()
 
diff -r 2beca5f48ffe -r f7e9ac1ef92b tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Fri Oct 23 10:24:19 2009 +0100
+++ b/tools/python/xen/xend/XendConfig.py       Fri Oct 23 10:24:49 2009 +0100
@@ -1380,9 +1380,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':
                 if 'vbd_refs' not in target:
@@ -1391,6 +1396,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':

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.