ia64/xen-unstable

changeset 13208:5c268a24e44b

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@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Dec 28 15:26:19 2006 +0000 (2006-12-28)
parents 51ea6202c4f2
children 3f24490932cd
files tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/image.py
line diff
     1.1 --- a/tools/python/xen/xend/XendConfig.py	Thu Dec 28 15:23:31 2006 +0000
     1.2 +++ b/tools/python/xen/xend/XendConfig.py	Thu Dec 28 15:26:19 2006 +0000
     1.3 @@ -1099,21 +1099,13 @@ class XendConfig(dict):
     1.4  
     1.5          return image
     1.6  
     1.7 -    def update_with_image_sxp(self, image_sxp):
     1.8 +    def update_with_image_sxp(self, image_sxp, bootloader = False):
     1.9          # Convert Legacy "image" config to Xen API PV_*
    1.10          # configuration
    1.11          log.debug("update_with_image_sxp(%s)" % scrub_password(image_sxp))
    1.12  
    1.13 -        self['PV_kernel'] = sxp.child_value(image_sxp, 'kernel','')
    1.14 -        self['PV_ramdisk'] = sxp.child_value(image_sxp, 'ramdisk','')
    1.15 -        if not self['PV_bootloader'] \
    1.16 -               and sxp.child_value(image_sxp, 'kernel', ''):
    1.17 -            # We've set PV_kernel using the call above, so now we need to set
    1.18 -            # PV_bootloader as well, otherwise we're going to do the wrong
    1.19 -            # thing on reboot.
    1.20 -            self['PV_bootloader'] = 'pygrub'
    1.21          kernel_args = sxp.child_value(image_sxp, 'args', '')
    1.22 -        
    1.23 +
    1.24          # attempt to extract extra arguments from SXP config
    1.25          arg_ip = sxp.child_value(image_sxp, 'ip')
    1.26          if arg_ip and not re.search(r'ip=[^ ]+', kernel_args):
    1.27 @@ -1121,7 +1113,16 @@ class XendConfig(dict):
    1.28          arg_root = sxp.child_value(image_sxp, 'root')
    1.29          if arg_root and not re.search(r'root=', kernel_args):
    1.30              kernel_args += ' root=%s' % arg_root
    1.31 -        self['PV_args'] = kernel_args
    1.32 +
    1.33 +        if bootloader:
    1.34 +            self['_temp_using_bootloader'] = '1'
    1.35 +            self['_temp_kernel'] = sxp.child_value(image_sxp, 'kernel','')
    1.36 +            self['_temp_ramdisk'] = sxp.child_value(image_sxp, 'ramdisk','')
    1.37 +            self['_temp_args'] = kernel_args
    1.38 +        else:
    1.39 +            self['PV_kernel'] = sxp.child_value(image_sxp, 'kernel','')
    1.40 +            self['PV_ramdisk'] = sxp.child_value(image_sxp, 'ramdisk','')
    1.41 +            self['PV_args'] = kernel_args
    1.42  
    1.43          # Store image SXP in python dictionary format
    1.44          image = {}
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Dec 28 15:23:31 2006 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Dec 28 15:26:19 2006 +0000
     2.3 @@ -1616,7 +1616,7 @@ class XendDomainInfo:
     2.4                  log.error(msg)
     2.5                  raise VmError(msg)
     2.6          
     2.7 -            self.info.update_with_image_sxp(blcfg)
     2.8 +            self.info.update_with_image_sxp(blcfg, True)
     2.9  
    2.10  
    2.11      # 
     3.1 --- a/tools/python/xen/xend/image.py	Thu Dec 28 15:23:31 2006 +0000
     3.2 +++ b/tools/python/xen/xend/image.py	Thu Dec 28 15:26:19 2006 +0000
     3.3 @@ -68,7 +68,7 @@ class ImageHandler:
     3.4      def __init__(self, vm, vmConfig, imageConfig, deviceConfig):
     3.5          self.vm = vm
     3.6  
     3.7 -        self.bootloader = None
     3.8 +        self.bootloader = False
     3.9          self.kernel = None
    3.10          self.ramdisk = None
    3.11          self.cmdline = None
    3.12 @@ -77,10 +77,15 @@ class ImageHandler:
    3.13  
    3.14      def configure(self, vmConfig, imageConfig, _):
    3.15          """Config actions common to all unix-like domains."""
    3.16 -        self.bootloader = vmConfig['PV_bootloader']
    3.17 -        self.kernel = vmConfig['PV_kernel']
    3.18 -        self.cmdline = vmConfig['PV_args']
    3.19 -        self.ramdisk = vmConfig['PV_ramdisk']
    3.20 +        if '_temp_using_bootloader' in vmConfig:
    3.21 +            self.bootloader = True
    3.22 +            self.kernel = vmConfig['_temp_kernel']
    3.23 +            self.cmdline = vmConfig['_temp_args']
    3.24 +            self.ramdisk = vmConfig['_temp_ramdisk']
    3.25 +        else:
    3.26 +            self.kernel = vmConfig['PV_kernel']
    3.27 +            self.cmdline = vmConfig['PV_args']
    3.28 +            self.ramdisk = vmConfig['PV_ramdisk']
    3.29          self.vm.storeVm(("image/ostype", self.ostype),
    3.30                          ("image/kernel", self.kernel),
    3.31                          ("image/cmdline", self.cmdline),