From: kaf24@firebug.cl.cam.ac.uk Date: Fri, 28 Apr 2006 13:11:57 +0000 (+0100) Subject: Instead of relying on xm create to always run the bootloader, make sure X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16108^2~59 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c57010da2d0667184027c8b5dda5474c2311f0a7;p=xen.git 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 --- diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 1030637012..a4c1d4a9e4 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -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):