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:
Ewan Mellor committed 2006-12-28 15:26:19 +00:00
1 parent e5e25973c2
commit 4bbdd5d689
3 files changed
+23 -17

No files matched your search

+12 -11
View File
@@ -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 = {}
+1 -1
View File
@@ -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)
#
+10 -5
View File
@@ -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),
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.