All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Run bootloader at domain creation
@ 2006-04-26  2:43 Jeremy Katz
  2006-04-26  9:48 ` Daniel Veillard
  0 siblings, 1 reply; 2+ messages in thread
From: Jeremy Katz @ 2006-04-26  2:43 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 285 bytes --]

Instead of relying on xm create to always run the bootloader, make sure
we run it if we get into domain creation with a bootloader set but no
image.  This could happen if someone creates a domain config via the
XML-RPC or sxp interfaces.

Signed-off-by: Jeremy Katz <katzj@redhat.com>

[-- Attachment #2: xen-bootloader-domcreate.patch --]
[-- Type: text/x-patch, Size: 2270 bytes --]

# HG changeset patch
# User "Jeremy Katz <katzj@redhat.com>"
# Node ID 732f89a0a4a8732f4ffb1a59022be0a58cce49cf
# Parent  3d91ee7c86ec9316d7552218e21ab0d921a93a1e
run the bootloader if we get to domain construction and don't have an
image set up, eg, for cases where we don't go through xm create

diff -r 3d91ee7c86ec -r 732f89a0a4a8 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py	Tue Apr 25 21:18:56 2006 -0400
+++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Apr 25 21:21:13 2006 -0400
@@ -1234,6 +1234,11 @@ class XendDomainInfo:
                   self.domid,
                   self.info['cpu_weight'])
 
+        # if we have a boot loader but no image, then we need to set things
+        # up by running the boot loader non-interactively
+        if self.infoIsSet('bootloader') and not self.infoIsSet('image'):
+            self.configure_bootloader()
+
         if not self.infoIsSet('image'):
             raise VmError('Missing image in configuration')
 
@@ -1613,23 +1618,25 @@ class XendDomainInfo:
 
 
     def configure_bootloader(self):
+        """Run the bootloader if we're configured to do so."""
         if not self.info['bootloader']:
             return
-        # if we're restarting with a bootloader, we need to run it
         blcfg = None
-        config = self.sxpr()
-        # FIXME: this assumes that we want to use the first disk
-        for dev in sxp.children(config, "device"):
-            disk = sxp.child(dev, "vbd")
+        # FIXME: this assumes that we want to use the first disk device
+        for (n,c) in self.info['device']:
+            if not n or not c or n != "vbd":
+                continue
+            disk = sxp.child_value(c, "uname")
             if disk is None:
                 continue
-            fn = blkdev_uname_to_file(sxp.child_value(disk, "uname"))
+            fn = blkdev_uname_to_file(disk)
             blcfg = bootloader(self.info['bootloader'], fn, 1)
+            break
         if blcfg is None:
             msg = "Had a bootloader specified, but can't find disk"
             log.error(msg)
             raise VmError(msg)
-        self.info['image'] = sxp.to_string(blcfg)
+        self.info['image'] = blcfg
 
 
     def send_sysrq(self, key):

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-26  9:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-26  2:43 [PATCH] Run bootloader at domain creation Jeremy Katz
2006-04-26  9:48 ` Daniel Veillard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.