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

[Xen-changelog] [xen-unstable] xend: Remember bootable flag for vbds in xenstore



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1228826745 0
# Node ID c0c113ab0be528f56aec2854c544535a4245853e
# Parent  b1b9cf7a2d36706e7dbbed275327095a293a3b33
xend: Remember bootable flag for vbds in xenstore

When xend is restarted, bootable flags of all disk devices are lost
and then the first disk is marked as bootable by a "compatibility
hack". When a guest domain is created with a mixture of several vbd
and tap devices, the compatibility hack may fail to choose the right
bootable device. Thus preventing the guest to be restarted. This patch
fixes this behavior by remembering bootable flag for each disk device
in xenstore database.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 tools/python/xen/xend/XendConfig.py   |    8 ++++----
 tools/python/xen/xend/server/blkif.py |   13 ++++++++++---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff -r b1b9cf7a2d36 -r c0c113ab0be5 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Tue Dec 09 12:44:32 2008 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Tue Dec 09 12:45:45 2008 +0000
@@ -1289,7 +1289,6 @@ class XendConfig(dict):
                     pass
 
             if dev_type == 'vbd':
-                dev_info['bootable'] = 0
                 if dev_info.get('dev', '').startswith('ioemu:'):
                     dev_info['driver'] = 'ioemu'
                 else:
@@ -1325,7 +1324,7 @@ class XendConfig(dict):
                 if param not in target:
                     target[param] = []
                 if dev_uuid not in target[param]:
-                    if dev_type == 'vbd':
+                    if dev_type == 'vbd' and 'bootable' not in dev_info:
                         # Compat hack -- mark first disk bootable
                         dev_info['bootable'] = int(not target[param])
                     target[param].append(dev_uuid)
@@ -1333,8 +1332,9 @@ class XendConfig(dict):
                 if 'vbd_refs' not in target:
                     target['vbd_refs'] = []
                 if dev_uuid not in target['vbd_refs']:
-                    # Compat hack -- mark first disk bootable
-                    dev_info['bootable'] = int(not target['vbd_refs'])
+                    if 'bootable' not in dev_info:
+                        # Compat hack -- mark first disk bootable
+                        dev_info['bootable'] = int(not target['vbd_refs'])
                     target['vbd_refs'].append(dev_uuid)
                     
             elif dev_type == 'vfb':
diff -r b1b9cf7a2d36 -r c0c113ab0be5 tools/python/xen/xend/server/blkif.py
--- a/tools/python/xen/xend/server/blkif.py     Tue Dec 09 12:44:32 2008 +0000
+++ b/tools/python/xen/xend/server/blkif.py     Tue Dec 09 12:45:45 2008 +0000
@@ -78,6 +78,10 @@ class BlkifController(DevController):
         if uuid:
             back['uuid'] = uuid
 
+        bootable = config.get('bootable', None)
+        if bootable != None:
+            back['bootable'] = str(bootable)
+
         if security.on() == xsconstants.XS_POLICY_USE:
             self.do_access_control(config, uname)
 
@@ -143,11 +147,12 @@ class BlkifController(DevController):
         config = DevController.getDeviceConfiguration(self, devid, transaction)
         if transaction is None:
             devinfo = self.readBackend(devid, 'dev', 'type', 'params', 'mode',
-                                       'uuid')
+                                       'uuid', 'bootable')
         else:
             devinfo = self.readBackendTxn(transaction, devid,
-                                          'dev', 'type', 'params', 'mode', 
'uuid')
-        dev, typ, params, mode, uuid = devinfo
+                                          'dev', 'type', 'params', 'mode', 
'uuid',
+                                          'bootable')
+        dev, typ, params, mode, uuid, bootable = devinfo
         
         if dev:
             if transaction is None:
@@ -165,6 +170,8 @@ class BlkifController(DevController):
             config['mode'] = mode
         if uuid:
             config['uuid'] = uuid
+        if bootable != None:
+            config['bootable'] = int(bootable)
 
         proto = self.readFrontend(devid, 'protocol')
         if proto:

_______________________________________________
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®.