ia64/xen-unstable

changeset 7799:bffbe58801d0

The various changes to move to using info instead of passing the config
sxpr everywhere broke the use of a boot loader for booting with. The
attached fixes things up so that
a) use of a bootloader ==> kernel not specified in the config file
b) don't cleanup bootloader files until after the domain has booted
c) rerun bootloader on reboot

Signed-off-by: Jeremy Katz <katzj@redhat.com>
author emellor@leeni.uk.xensource.com
date Sat Nov 12 18:59:56 2005 +0100 (2005-11-12)
parents 4f247dc79d0a
children 5aad7e145e50 504111fd562a
files tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/image.py tools/python/xen/xm/create.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Sat Nov 12 18:52:16 2005 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Sat Nov 12 18:59:56 2005 +0100
     1.3 @@ -1049,9 +1049,6 @@ class XendDomainInfo:
     1.4                                    self.info['image'],
     1.5                                    self.info['device'])
     1.6  
     1.7 -        if self.info['bootloader']:
     1.8 -            self.image.handleBootloading()
     1.9 -
    1.10          xc.domain_setcpuweight(self.domid, self.info['cpu_weight'])
    1.11  
    1.12          m = self.image.getDomainMemory(self.info['memory'] * 1024)
    1.13 @@ -1074,6 +1071,9 @@ class XendDomainInfo:
    1.14  
    1.15          self.createDevices()
    1.16  
    1.17 +        if self.info['bootloader']:
    1.18 +            self.image.cleanupBootloading()
    1.19 +
    1.20          self.info['start_time'] = time.time()
    1.21  
    1.22  
    1.23 @@ -1238,6 +1238,7 @@ class XendDomainInfo:
    1.24          False if it is to be destroyed.
    1.25          """
    1.26  
    1.27 +        self.configure_bootloader()
    1.28          config = self.sxpr()
    1.29  
    1.30          if self.readVm(RESTART_IN_PROGRESS):
    1.31 @@ -1340,8 +1341,9 @@ class XendDomainInfo:
    1.32          # FIXME: this assumes the disk is the first device and
    1.33          # that we're booting from the first disk
    1.34          blcfg = None
    1.35 +        config = self.sxpr()
    1.36          # FIXME: this assumes that we want to use the first disk
    1.37 -        dev = sxp.child_value(self.config, "device")
    1.38 +        dev = sxp.child_value(config, "device")
    1.39          if dev:
    1.40              disk = sxp.child_value(dev, "uname")
    1.41              fn = blkdev_uname_to_file(disk)
    1.42 @@ -1351,7 +1353,7 @@ class XendDomainInfo:
    1.43              msg = "Had a bootloader specified, but can't find disk"
    1.44              log.error(msg)
    1.45              raise VmError(msg)
    1.46 -        self.config = sxp.merge(['vm', ['image', blcfg]], self.config)
    1.47 +        self.info['image'] = sxp.to_string(blcfg)
    1.48  
    1.49  
    1.50      def send_sysrq(self, key):
     2.1 --- a/tools/python/xen/xend/image.py	Sat Nov 12 18:52:16 2005 +0100
     2.2 +++ b/tools/python/xen/xend/image.py	Sat Nov 12 18:59:56 2005 +0100
     2.3 @@ -95,7 +95,7 @@ class ImageHandler:
     2.4                          ("image/ramdisk", self.ramdisk))
     2.5  
     2.6  
     2.7 -    def handleBootloading(self):
     2.8 +    def cleanupBootloading(self):
     2.9          self.unlink(self.kernel)
    2.10          self.unlink(self.ramdisk)
    2.11  
     3.1 --- a/tools/python/xen/xm/create.py	Sat Nov 12 18:52:16 2005 +0100
     3.2 +++ b/tools/python/xen/xm/create.py	Sat Nov 12 18:59:56 2005 +0100
     3.3 @@ -565,7 +565,7 @@ def run_bootloader(vals):
     3.4      file = blkif.blkdev_uname_to_file(uname)
     3.5  
     3.6      return bootloader(vals.bootloader, file, not vals.console_autoconnect,
     3.7 -                      vals.vcpus, vals.blentry)
     3.8 +                      vals.vcpus, vals.bootentry)
     3.9  
    3.10  def make_config(vals):
    3.11      """Create the domain configuration.
    3.12 @@ -781,7 +781,7 @@ def preprocess_vnc(vals):
    3.13          vals.extra = vnc + ' ' + vals.extra
    3.14      
    3.15  def preprocess(vals):
    3.16 -    if not vals.kernel:
    3.17 +    if not vals.kernel and not vals.bootloader:
    3.18          err("No kernel specified")
    3.19      preprocess_disk(vals)
    3.20      preprocess_pci(vals)