124 lines
5.1 KiB
Diff
124 lines
5.1 KiB
Diff
|
Index: xen-3.0.3-testing/tools/python/xen/xm/create.py
|
||
|
===================================================================
|
||
|
--- xen-3.0.3-testing.orig/tools/python/xen/xm/create.py
|
||
|
+++ xen-3.0.3-testing/tools/python/xen/xm/create.py
|
||
|
@@ -126,7 +126,7 @@ gopts.var('bootloader', val='FILE',
|
||
|
use="Path to bootloader.")
|
||
|
|
||
|
gopts.var('bootargs', val='NAME',
|
||
|
- fn=set_value, default=None,
|
||
|
+ fn=set_value, default='',
|
||
|
use="Arguments to pass to boot loader")
|
||
|
|
||
|
gopts.var('bootentry', val='NAME',
|
||
|
@@ -649,16 +649,17 @@ def run_bootloader(vals, config_image):
|
||
|
err("Bootloader isn't executable")
|
||
|
if len(vals.disk) < 1:
|
||
|
err("No disks configured and boot loader requested")
|
||
|
- (uname, dev, mode, backend) = vals.disk[0]
|
||
|
- file = blkif.blkdev_uname_to_file(uname)
|
||
|
|
||
|
if vals.bootentry:
|
||
|
warn("The bootentry option is deprecated. Use bootargs and pass "
|
||
|
"--entry= directly.")
|
||
|
vals.bootargs = "--entry=%s" %(vals.bootentry,)
|
||
|
+ if vals.root:
|
||
|
+ vals.bootargs += " --root=%s" % vals.root.split()[0]
|
||
|
+ vals.bootargs += " --disks=\"%s\"" % str(vals.disk)
|
||
|
|
||
|
- return bootloader(vals.bootloader, file, not vals.console_autoconnect,
|
||
|
- vals.bootargs, config_image)
|
||
|
+ return bootloader(vals.bootloader, not vals.console_autoconnect,
|
||
|
+ vals.dryrun, vals.bootargs, config_image)
|
||
|
|
||
|
def make_config(vals):
|
||
|
"""Create the domain configuration.
|
||
|
Index: xen-3.0.3-testing/tools/python/xen/xend/XendBootloader.py
|
||
|
===================================================================
|
||
|
--- xen-3.0.3-testing.orig/tools/python/xen/xend/XendBootloader.py
|
||
|
+++ xen-3.0.3-testing/tools/python/xen/xend/XendBootloader.py
|
||
|
@@ -20,11 +20,9 @@ import shlex
|
||
|
from XendLogging import log
|
||
|
from XendError import VmError
|
||
|
|
||
|
-def bootloader(blexec, disk, quiet = 0, blargs = None, imgcfg = None):
|
||
|
- """Run the boot loader executable on the given disk and return a
|
||
|
- config image.
|
||
|
+def bootloader(blexec, quiet = 0, dryrun = 0, blargs = None, imgcfg = None):
|
||
|
+ """Run the boot loader executable and return a config image.
|
||
|
@param blexec Binary to use as the boot loader
|
||
|
- @param disk Disk to run the boot loader on.
|
||
|
@param quiet Run in non-interactive mode, just booting the default.
|
||
|
@param blargs Arguments to pass to the bootloader."""
|
||
|
|
||
|
@@ -32,10 +30,6 @@ def bootloader(blexec, disk, quiet = 0,
|
||
|
msg = "Bootloader isn't executable"
|
||
|
log.error(msg)
|
||
|
raise VmError(msg)
|
||
|
- if not os.access(disk, os.R_OK):
|
||
|
- msg = "Disk isn't accessible"
|
||
|
- log.error(msg)
|
||
|
- raise VmError(msg)
|
||
|
|
||
|
while True:
|
||
|
fifo = "/var/lib/xen/xenbl.%s" %(random.randint(0, 32000),)
|
||
|
@@ -48,10 +42,11 @@ def bootloader(blexec, disk, quiet = 0,
|
||
|
args = [ blexec ]
|
||
|
if quiet:
|
||
|
args.append("-q")
|
||
|
+ if dryrun:
|
||
|
+ args.append("--dryrun")
|
||
|
args.append("--output=%s" %(fifo,))
|
||
|
if blargs is not None:
|
||
|
args.extend(shlex.split(blargs))
|
||
|
- args.append(disk)
|
||
|
|
||
|
try:
|
||
|
os.execvp(args[0], args)
|
||
|
@@ -68,6 +63,7 @@ def bootloader(blexec, disk, quiet = 0,
|
||
|
continue
|
||
|
break
|
||
|
ret = ""
|
||
|
+ # TODO: Add timeout, cleanup and raise VmError if it occurs
|
||
|
while 1:
|
||
|
select.select([r], [], [])
|
||
|
s = os.read(r, 1024)
|
||
|
Index: xen-3.0.3-testing/tools/python/xen/xend/XendDomainInfo.py
|
||
|
===================================================================
|
||
|
--- xen-3.0.3-testing.orig/tools/python/xen/xend/XendDomainInfo.py
|
||
|
+++ xen-3.0.3-testing/tools/python/xen/xend/XendDomainInfo.py
|
||
|
@@ -1743,18 +1743,27 @@ class XendDomainInfo:
|
||
|
if not self.info['bootloader']:
|
||
|
return
|
||
|
blcfg = None
|
||
|
- # FIXME: this assumes that we want to use the first disk device
|
||
|
+ """This code is currently unneeded, but will be used
|
||
|
+ again when boot device selection is more dynamic.
|
||
|
+ vbds = []
|
||
|
for (n,c) in self.info['device']:
|
||
|
if not n or not c or not(n in ["vbd", "tap"]):
|
||
|
continue
|
||
|
disk = sxp.child_value(c, "uname")
|
||
|
if disk is None:
|
||
|
continue
|
||
|
- fn = blkdev_uname_to_file(disk)
|
||
|
- blcfg = bootloader(self.info['bootloader'], fn, 1,
|
||
|
- self.info['bootloader_args'],
|
||
|
- self.info['image'])
|
||
|
- break
|
||
|
+ vbds.append([sxp.child_value(c, "uname"),
|
||
|
+ sxp.child_value(c, "dev"),
|
||
|
+ sxp.child_value(c, "mode"),
|
||
|
+ sxp.child_value(c, "backend")])
|
||
|
+ if vbds:
|
||
|
+ bootargs = self.info['bootloader_args'] + \
|
||
|
+ " --disks=\"%s\"" % str(vbds)
|
||
|
+ if self.info['root']:
|
||
|
+ bootargs += " --root=%s" % self.info['root'].split()[0]
|
||
|
+ """
|
||
|
+ blcfg = bootloader(self.info['bootloader'], 1, 0,
|
||
|
+ self.info['bootloader_args'], self.info['image'])
|
||
|
if blcfg is None:
|
||
|
msg = "Had a bootloader specified, but can't find disk"
|
||
|
log.error(msg)
|