ia64/xen-unstable

changeset 7047:1f948a831fdc

Neaten the configuration parsing code. Add a self parameter to
configureBootloading.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Fri Sep 23 16:53:57 2005 +0100 (2005-09-23)
parents b2c9acd6fdfc
children ab1c362ba0d1
files tools/python/xen/xend/image.py
line diff
     1.1 --- a/tools/python/xen/xend/image.py	Fri Sep 23 16:50:02 2005 +0100
     1.2 +++ b/tools/python/xen/xend/image.py	Fri Sep 23 16:53:57 2005 +0100
     1.3 @@ -111,18 +111,21 @@ class ImageHandler:
     1.4      def configure(self, imageConfig, _):
     1.5          """Config actions common to all unix-like domains."""
     1.6  
     1.7 -        self.kernel = sxp.child_value(imageConfig, "kernel")
     1.8 +        def get_cfg(name, default = None):
     1.9 +            return sxp.child_value(imageConfig, name, default)
    1.10 +
    1.11 +        self.kernel = get_cfg("kernel")
    1.12          self.cmdline = ""
    1.13 -        ip = sxp.child_value(imageConfig, "ip", None)
    1.14 +        ip = get_cfg("ip")
    1.15          if ip:
    1.16              self.cmdline += " ip=" + ip
    1.17 -        root = sxp.child_value(imageConfig, "root")
    1.18 +        root = get_cfg("root")
    1.19          if root:
    1.20              self.cmdline += " root=" + root
    1.21 -        args = sxp.child_value(imageConfig, "args")
    1.22 +        args = get_cfg("args")
    1.23          if args:
    1.24              self.cmdline += " " + args
    1.25 -        self.ramdisk = sxp.child_value(imageConfig, "ramdisk", '')
    1.26 +        self.ramdisk = get_cfg("ramdisk", '')
    1.27          
    1.28          self.vm.storeVm(("image/ostype", self.ostype),
    1.29                          ("image/kernel", self.kernel),
    1.30 @@ -130,7 +133,7 @@ class ImageHandler:
    1.31                          ("image/ramdisk", self.ramdisk))
    1.32  
    1.33  
    1.34 -    def handleBootloading():
    1.35 +    def handleBootloading(self):
    1.36          self.unlink(self.kernel)
    1.37          self.unlink(self.ramdisk)
    1.38