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

[Xen-changelog] [xen-unstable] Do not update the PV_ variables with the values outputted by the bootloader --



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1167319579 0
# Node ID 5c268a24e44bddc1c21a8a47598b78c076f99178
# Parent  51ea6202c4f28dca1528f82f4e4e7e45f611bb19
Do not update the PV_ variables with the values outputted by the bootloader --
this gets us into all sorts of trouble when Xend is restarted and then the
domain is rebooted, because we expect to be able to handle the PV_kernel == ''
case by defaulting to pygrub.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendConfig.py     |   23 ++++++++++++-----------
 tools/python/xen/xend/XendDomainInfo.py |    2 +-
 tools/python/xen/xend/image.py          |   15 ++++++++++-----
 3 files changed, 23 insertions(+), 17 deletions(-)

diff -r 51ea6202c4f2 -r 5c268a24e44b tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Thu Dec 28 15:23:31 2006 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Thu Dec 28 15:26:19 2006 +0000
@@ -1099,21 +1099,13 @@ class XendConfig(dict):
 
         return image
 
-    def update_with_image_sxp(self, image_sxp):
+    def update_with_image_sxp(self, image_sxp, bootloader = False):
         # Convert Legacy "image" config to Xen API PV_*
         # configuration
         log.debug("update_with_image_sxp(%s)" % scrub_password(image_sxp))
 
-        self['PV_kernel'] = sxp.child_value(image_sxp, 'kernel','')
-        self['PV_ramdisk'] = sxp.child_value(image_sxp, 'ramdisk','')
-        if not self['PV_bootloader'] \
-               and sxp.child_value(image_sxp, 'kernel', ''):
-            # We've set PV_kernel using the call above, so now we need to set
-            # PV_bootloader as well, otherwise we're going to do the wrong
-            # thing on reboot.
-            self['PV_bootloader'] = 'pygrub'
         kernel_args = sxp.child_value(image_sxp, 'args', '')
-        
+
         # attempt to extract extra arguments from SXP config
         arg_ip = sxp.child_value(image_sxp, 'ip')
         if arg_ip and not re.search(r'ip=[^ ]+', kernel_args):
@@ -1121,7 +1113,16 @@ class XendConfig(dict):
         arg_root = sxp.child_value(image_sxp, 'root')
         if arg_root and not re.search(r'root=', kernel_args):
             kernel_args += ' root=%s' % arg_root
-        self['PV_args'] = kernel_args
+
+        if bootloader:
+            self['_temp_using_bootloader'] = '1'
+            self['_temp_kernel'] = sxp.child_value(image_sxp, 'kernel','')
+            self['_temp_ramdisk'] = sxp.child_value(image_sxp, 'ramdisk','')
+            self['_temp_args'] = kernel_args
+        else:
+            self['PV_kernel'] = sxp.child_value(image_sxp, 'kernel','')
+            self['PV_ramdisk'] = sxp.child_value(image_sxp, 'ramdisk','')
+            self['PV_args'] = kernel_args
 
         # Store image SXP in python dictionary format
         image = {}
diff -r 51ea6202c4f2 -r 5c268a24e44b tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Dec 28 15:23:31 2006 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Dec 28 15:26:19 2006 +0000
@@ -1616,7 +1616,7 @@ class XendDomainInfo:
                 log.error(msg)
                 raise VmError(msg)
         
-            self.info.update_with_image_sxp(blcfg)
+            self.info.update_with_image_sxp(blcfg, True)
 
 
     # 
diff -r 51ea6202c4f2 -r 5c268a24e44b tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Thu Dec 28 15:23:31 2006 +0000
+++ b/tools/python/xen/xend/image.py    Thu Dec 28 15:26:19 2006 +0000
@@ -68,7 +68,7 @@ class ImageHandler:
     def __init__(self, vm, vmConfig, imageConfig, deviceConfig):
         self.vm = vm
 
-        self.bootloader = None
+        self.bootloader = False
         self.kernel = None
         self.ramdisk = None
         self.cmdline = None
@@ -77,10 +77,15 @@ class ImageHandler:
 
     def configure(self, vmConfig, imageConfig, _):
         """Config actions common to all unix-like domains."""
-        self.bootloader = vmConfig['PV_bootloader']
-        self.kernel = vmConfig['PV_kernel']
-        self.cmdline = vmConfig['PV_args']
-        self.ramdisk = vmConfig['PV_ramdisk']
+        if '_temp_using_bootloader' in vmConfig:
+            self.bootloader = True
+            self.kernel = vmConfig['_temp_kernel']
+            self.cmdline = vmConfig['_temp_args']
+            self.ramdisk = vmConfig['_temp_ramdisk']
+        else:
+            self.kernel = vmConfig['PV_kernel']
+            self.cmdline = vmConfig['PV_args']
+            self.ramdisk = vmConfig['PV_ramdisk']
         self.vm.storeVm(("image/ostype", self.ostype),
                         ("image/kernel", self.kernel),
                         ("image/cmdline", self.cmdline),

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