ia64/xen-unstable

changeset 9953:98f00a4ee0b4

Instead of just having the bootloader config sxp replace anything else,
merge with given values. This will allow a bootloader to not have to
specify everything which is useful for bootloaders other than pygrub.

Signed-off-by: Jeremy Katz <katzj@redhat.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri May 05 14:09:07 2006 +0100 (2006-05-05)
parents 0c586a81d941
children 7fd7f276bb38
files tools/python/xen/xend/XendBootloader.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/create.py
line diff
     1.1 --- a/tools/python/xen/xend/XendBootloader.py	Fri May 05 14:05:31 2006 +0100
     1.2 +++ b/tools/python/xen/xend/XendBootloader.py	Fri May 05 14:09:07 2006 +0100
     1.3 @@ -19,7 +19,7 @@ import sxp
     1.4  from XendLogging import log
     1.5  from XendError import VmError
     1.6  
     1.7 -def bootloader(blexec, disk, quiet = 0, blargs = None):
     1.8 +def bootloader(blexec, disk, quiet = 0, blargs = None, imgcfg = None):
     1.9      """Run the boot loader executable on the given disk and return a
    1.10      config image.
    1.11      @param blexec  Binary to use as the boot loader
    1.12 @@ -86,4 +86,10 @@ def bootloader(blexec, disk, quiet = 0, 
    1.13      pin = sxp.Parser()
    1.14      pin.input(ret)
    1.15      pin.input_eof()
    1.16 -    return pin.val
    1.17 +    blcfg = pin.val
    1.18 +
    1.19 +    if imgcfg is None:
    1.20 +        return blcfg
    1.21 +    else:
    1.22 +        c = sxp.merge(blcfg, imgcfg)
    1.23 +        return c
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri May 05 14:05:31 2006 +0100
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri May 05 14:09:07 2006 +0100
     2.3 @@ -1633,7 +1633,8 @@ class XendDomainInfo:
     2.4                  continue
     2.5              fn = blkdev_uname_to_file(disk)
     2.6              blcfg = bootloader(self.info['bootloader'], fn, 1,
     2.7 -                               self.info['bootloader_args'])
     2.8 +                               self.info['bootloader_args'],
     2.9 +                               self.info['image'])
    2.10              break
    2.11          if blcfg is None:
    2.12              msg = "Had a bootloader specified, but can't find disk"
     3.1 --- a/tools/python/xen/xm/create.py	Fri May 05 14:05:31 2006 +0100
     3.2 +++ b/tools/python/xen/xm/create.py	Fri May 05 14:09:07 2006 +0100
     3.3 @@ -448,8 +448,11 @@ def strip(pre, s):
     3.4  def configure_image(vals):
     3.5      """Create the image config.
     3.6      """
     3.7 +    if not vals.builder:
     3.8 +        return None
     3.9      config_image = [ vals.builder ]
    3.10 -    config_image.append([ 'kernel', os.path.abspath(vals.kernel) ])
    3.11 +    if vals.kernel:
    3.12 +        config_image.append([ 'kernel', os.path.abspath(vals.kernel) ])
    3.13      if vals.ramdisk:
    3.14          config_image.append([ 'ramdisk', os.path.abspath(vals.ramdisk) ])
    3.15      if vals.cmdline_ip:
    3.16 @@ -616,7 +619,7 @@ def configure_hvm(config_image, vals):
    3.17          if (vals.__dict__[a]):
    3.18              config_image.append([a, vals.__dict__[a]])
    3.19  
    3.20 -def run_bootloader(vals):
    3.21 +def run_bootloader(vals, config_image):
    3.22      if not os.access(vals.bootloader, os.X_OK):
    3.23          err("Bootloader isn't executable")
    3.24      if len(vals.disk) < 1:
    3.25 @@ -630,7 +633,7 @@ def run_bootloader(vals):
    3.26          vals.bootargs = "--entry=%s" %(vals.bootentry,)
    3.27  
    3.28      return bootloader(vals.bootloader, file, not vals.console_autoconnect,
    3.29 -                      vals.bootargs)
    3.30 +                      vals.bootargs, config_image)
    3.31  
    3.32  def make_config(vals):
    3.33      """Create the domain configuration.
    3.34 @@ -662,13 +665,12 @@ def make_config(vals):
    3.35      if vals.tpmif:
    3.36          config.append(['backend', ['tpmif']])
    3.37  
    3.38 +    config_image = configure_image(vals)
    3.39      if vals.bootloader:
    3.40 -        config_image = run_bootloader(vals)
    3.41 +        config_image = run_bootloader(vals, config_image)
    3.42          config.append(['bootloader', vals.bootloader])
    3.43          if vals.bootargs:
    3.44              config.append(['bootloader_args'], vals.bootargs)
    3.45 -    else:
    3.46 -        config_image = configure_image(vals)
    3.47      config.append(['image', config_image])
    3.48  
    3.49      config_devs = []