[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Instead of just having the bootloader config sxp replace anything else,



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 98f00a4ee0b45cb1bbf62bc8aabe99a2df23d815
# Parent  0c586a81d941ab0a18aecca87cffe1500a9185c5
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@xxxxxxxxxx>
---
 tools/python/xen/xend/XendBootloader.py |   10 ++++++++--
 tools/python/xen/xend/XendDomainInfo.py |    3 ++-
 tools/python/xen/xm/create.py           |   14 ++++++++------
 3 files changed, 18 insertions(+), 9 deletions(-)

diff -r 0c586a81d941 -r 98f00a4ee0b4 tools/python/xen/xend/XendBootloader.py
--- a/tools/python/xen/xend/XendBootloader.py   Fri May 05 14:05:31 2006 +0100
+++ b/tools/python/xen/xend/XendBootloader.py   Fri May 05 14:09:07 2006 +0100
@@ -19,7 +19,7 @@ from XendLogging import log
 from XendLogging import log
 from XendError import VmError
 
-def bootloader(blexec, disk, quiet = 0, blargs = None):
+def bootloader(blexec, disk, quiet = 0, blargs = None, imgcfg = None):
     """Run the boot loader executable on the given disk and return a
     config image.
     @param blexec  Binary to use as the boot loader
@@ -86,4 +86,10 @@ def bootloader(blexec, disk, quiet = 0, 
     pin = sxp.Parser()
     pin.input(ret)
     pin.input_eof()
-    return pin.val
+    blcfg = pin.val
+
+    if imgcfg is None:
+        return blcfg
+    else:
+        c = sxp.merge(blcfg, imgcfg)
+        return c
diff -r 0c586a81d941 -r 98f00a4ee0b4 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Fri May 05 14:05:31 2006 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri May 05 14:09:07 2006 +0100
@@ -1633,7 +1633,8 @@ class XendDomainInfo:
                 continue
             fn = blkdev_uname_to_file(disk)
             blcfg = bootloader(self.info['bootloader'], fn, 1,
-                               self.info['bootloader_args'])
+                               self.info['bootloader_args'],
+                               self.info['image'])
             break
         if blcfg is None:
             msg = "Had a bootloader specified, but can't find disk"
diff -r 0c586a81d941 -r 98f00a4ee0b4 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Fri May 05 14:05:31 2006 +0100
+++ b/tools/python/xen/xm/create.py     Fri May 05 14:09:07 2006 +0100
@@ -448,8 +448,11 @@ def configure_image(vals):
 def configure_image(vals):
     """Create the image config.
     """
+    if not vals.builder:
+        return None
     config_image = [ vals.builder ]
-    config_image.append([ 'kernel', os.path.abspath(vals.kernel) ])
+    if vals.kernel:
+        config_image.append([ 'kernel', os.path.abspath(vals.kernel) ])
     if vals.ramdisk:
         config_image.append([ 'ramdisk', os.path.abspath(vals.ramdisk) ])
     if vals.cmdline_ip:
@@ -616,7 +619,7 @@ def configure_hvm(config_image, vals):
         if (vals.__dict__[a]):
             config_image.append([a, vals.__dict__[a]])
 
-def run_bootloader(vals):
+def run_bootloader(vals, config_image):
     if not os.access(vals.bootloader, os.X_OK):
         err("Bootloader isn't executable")
     if len(vals.disk) < 1:
@@ -630,7 +633,7 @@ def run_bootloader(vals):
         vals.bootargs = "--entry=%s" %(vals.bootentry,)
 
     return bootloader(vals.bootloader, file, not vals.console_autoconnect,
-                      vals.bootargs)
+                      vals.bootargs, config_image)
 
 def make_config(vals):
     """Create the domain configuration.
@@ -662,13 +665,12 @@ def make_config(vals):
     if vals.tpmif:
         config.append(['backend', ['tpmif']])
 
+    config_image = configure_image(vals)
     if vals.bootloader:
-        config_image = run_bootloader(vals)
+        config_image = run_bootloader(vals, config_image)
         config.append(['bootloader', vals.bootloader])
         if vals.bootargs:
             config.append(['bootloader_args'], vals.bootargs)
-    else:
-        config_image = configure_image(vals)
     config.append(['image', config_image])
 
     config_devs = []

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.