On Fri, May 11, 2012 at 09:07:25AM -0700, ron minnich wrote:
> On Fri, May 11, 2012 at 6:28 AM, Maurits van de Lande
> <M.vandeLande(a)vdl-fittings.com> wrote:
>
> > I would prefer to automatically reboot the VM (or retry the boot devices)
> > when no bootable device is found, then when the iSCSI storage is available
> > again the VM can boot normally.
> >
> > (when I manually sent CTRL+ALT+DEL to the VM the system booted normaly
> > again)
>
>
> It would be an interesting option. Sometimes, for hardware, you really
> want it to wait with the error message on the screen for a while so
> you can tell what happened. At the same time, there's nothing more
> annoying than having it wait forever when you know the hardware
> finally is ready for a boot ... Perhaps it would be possible to set a
> reasonable optional timeout and then have it reboot or, better, just
> redo the hardware scan and try again.
Makes sense - something like the below should work.
-Kevin
diff --git a/src/boot.c b/src/boot.c
index 8cc94b0..832347a 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -617,6 +617,25 @@ boot_rom(u32 vector)
call_boot_entry(so, 0);
}
+// Unable to find bootable device - warn user and eventually retry.
+static void
+boot_fail(void)
+{
+ printf("No bootable device.\n");
+ // Wait for 60 seconds and then reboot.
+ u32 end = calc_future_timer(60*1000);
+ for (;;) {
+ if (check_timer(end))
+ break;
+ wait_irq();
+ }
+ printf("Rebooting.\n");
+ struct bregs br;
+ memset(&br, 0, sizeof(br));
+ br.code = SEGOFF(SEG_BIOS, (u32)reset_vector);
+ call16big(&br);
+}
+
// Determine next boot method and attempt a boot using it.
static void
do_boot(u16 seq_nr)
@@ -625,10 +644,7 @@ do_boot(u16 seq_nr)
panic("Boot support not compiled in.\n");
if (seq_nr >= BEVCount) {
- printf("No bootable device.\n");
- // Loop with irqs enabled - this allows ctrl+alt+delete to work.
- for (;;)
- wait_irq();
+ boot_fail();
}
// Boot the given BEV type.