ia64/xen-unstable

changeset 9926:40cd49c88d69

Instead of knowing explicitly about the pygrub entry option, allow
passing arbitrary options to the bootloader and deprecate the bootentry
option.

Signed-off-by: Jeremy Katz <katzj@redhat.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed May 03 11:02:30 2006 +0100 (2006-05-03)
parents 42a70a529753
children 915d5af5dc18
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	Wed May 03 11:00:57 2006 +0100
     1.2 +++ b/tools/python/xen/xend/XendBootloader.py	Wed May 03 11:02:30 2006 +0100
     1.3 @@ -19,13 +19,13 @@ import sxp
     1.4  from XendLogging import log
     1.5  from XendError import VmError
     1.6  
     1.7 -def bootloader(blexec, disk, quiet = 0, entry = None):
     1.8 +def bootloader(blexec, disk, quiet = 0, blargs = 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      @param disk Disk to run the boot loader on.
    1.13      @param quiet Run in non-interactive mode, just booting the default.
    1.14 -    @param entry Default entry to boot."""
    1.15 +    @param blargs Arguments to pass to the bootloader."""
    1.16      
    1.17      if not os.access(blexec, os.X_OK):
    1.18          msg = "Bootloader isn't executable"
    1.19 @@ -48,8 +48,8 @@ def bootloader(blexec, disk, quiet = 0, 
    1.20          if quiet:
    1.21              args.append("-q")
    1.22          args.append("--output=%s" %(fifo,))
    1.23 -        if entry is not None:
    1.24 -            args.append("--entry=%s" %(entry,))
    1.25 +        if blargs is not None:
    1.26 +            args.extend(blargs.split())
    1.27          args.append(disk)
    1.28  
    1.29          try:
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Wed May 03 11:00:57 2006 +0100
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Wed May 03 11:02:30 2006 +0100
     2.3 @@ -132,6 +132,7 @@ ROUNDTRIPPING_CONFIG_ENTRIES = [
     2.4      ('memory',     int),
     2.5      ('maxmem',     int),
     2.6      ('bootloader', str),
     2.7 +    ('bootloader_args', str),
     2.8      ('features', str),
     2.9      ]
    2.10  
    2.11 @@ -571,6 +572,7 @@ class XendDomainInfo:
    2.12              defaultInfo('memory',       lambda: 0)
    2.13              defaultInfo('maxmem',       lambda: 0)
    2.14              defaultInfo('bootloader',   lambda: None)
    2.15 +            defaultInfo('bootloader_args', lambda: None)            
    2.16              defaultInfo('backend',      lambda: [])
    2.17              defaultInfo('device',       lambda: [])
    2.18              defaultInfo('image',        lambda: None)
    2.19 @@ -1630,7 +1632,8 @@ class XendDomainInfo:
    2.20              if disk is None:
    2.21                  continue
    2.22              fn = blkdev_uname_to_file(disk)
    2.23 -            blcfg = bootloader(self.info['bootloader'], fn, 1)
    2.24 +            blcfg = bootloader(self.info['bootloader'], fn, 1,
    2.25 +                               self.info['bootloader_args'])
    2.26              break
    2.27          if blcfg is None:
    2.28              msg = "Had a bootloader specified, but can't find disk"
     3.1 --- a/tools/python/xen/xm/create.py	Wed May 03 11:00:57 2006 +0100
     3.2 +++ b/tools/python/xen/xm/create.py	Wed May 03 11:02:30 2006 +0100
     3.3 @@ -122,9 +122,13 @@ gopts.var('bootloader', val='FILE',
     3.4            fn=set_value, default=None,
     3.5            use="Path to bootloader.")
     3.6  
     3.7 +gopts.var('bootargs', val='NAME',
     3.8 +          fn=set_value, default=None,
     3.9 +          use="Arguments to pass to boot loader")
    3.10 +
    3.11  gopts.var('bootentry', val='NAME',
    3.12            fn=set_value, default=None,
    3.13 -          use="Entry to boot via boot loader")
    3.14 +          use="DEPRECATED.  Entry to boot via boot loader.  Use bootargs.")
    3.15  
    3.16  gopts.var('kernel', val='FILE',
    3.17            fn=set_value, default=None,
    3.18 @@ -620,8 +624,13 @@ def run_bootloader(vals):
    3.19      (uname, dev, mode, backend) = vals.disk[0]
    3.20      file = blkif.blkdev_uname_to_file(uname)
    3.21  
    3.22 +    if vals.bootentry:
    3.23 +        warn("The bootentry option is deprecated.  Use bootargs and pass "
    3.24 +             "--entry= directly.")
    3.25 +        vals.bootargs = "--entry=%s" %(vals.bootentry,)
    3.26 +
    3.27      return bootloader(vals.bootloader, file, not vals.console_autoconnect,
    3.28 -                      vals.bootentry)
    3.29 +                      vals.bootargs)
    3.30  
    3.31  def make_config(vals):
    3.32      """Create the domain configuration.
    3.33 @@ -654,8 +663,10 @@ def make_config(vals):
    3.34          config.append(['backend', ['tpmif']])
    3.35  
    3.36      if vals.bootloader:
    3.37 +        config_image = run_bootloader(vals)
    3.38          config.append(['bootloader', vals.bootloader])
    3.39 -        config_image = run_bootloader(vals)
    3.40 +        if vals.bootargs:
    3.41 +            config.append(['bootloader_args'], vals.bootargs)
    3.42      else:
    3.43          config_image = configure_image(vals)
    3.44      config.append(['image', config_image])