mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
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>
This commit is contained in:
1 parent
e5e25973c2
commit
4bbdd5d689
3 files changed
+23
-17
No files matched your search
@@ -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 = {}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -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),
|
||||
|
||||