From c298c983028502f90d21b445c2497e46f558c5bb Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 14 Mar 2019 09:59:43 +0100 Subject: vm/qemu: detect boot errors faster Currently we try to ssh into the machine for 10 minutes even if it crashed right away. Make qemu exit on kernel panic and stop ssh'ing when qemu exits. Handling bad kernels fast is actually important for bisection. Update #501 --- vm/vmimpl/util.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'vm/vmimpl') diff --git a/vm/vmimpl/util.go b/vm/vmimpl/util.go index c7462c2cf..418ae2d66 100644 --- a/vm/vmimpl/util.go +++ b/vm/vmimpl/util.go @@ -22,7 +22,7 @@ func SleepInterruptible(d time.Duration) bool { } } -func WaitForSSH(debug bool, timeout time.Duration, addr, sshKey, sshUser, OS string, port int) error { +func WaitForSSH(debug bool, timeout time.Duration, addr, sshKey, sshUser, OS string, port int, stop chan error) error { pwd := "pwd" if OS == "windows" { pwd = "dir" @@ -30,7 +30,11 @@ func WaitForSSH(debug bool, timeout time.Duration, addr, sshKey, sshUser, OS str startTime := time.Now() SleepInterruptible(5 * time.Second) for { - if !SleepInterruptible(5 * time.Second) { + select { + case <-time.After(5 * time.Second): + case err := <-stop: + return err + case <-Shutdown: return fmt.Errorf("shutdown in progress") } args := append(SSHArgs(debug, sshKey, port), sshUser+"@"+addr, pwd) -- cgit mrf-deployment