aboutsummaryrefslogtreecommitdiffstats
path: root/vm/vmimpl
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-03-14 09:59:43 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-03-17 18:06:44 +0100
commitc298c983028502f90d21b445c2497e46f558c5bb (patch)
treeb09c4e2dcec1928ce314146cfac219d747cf2ae7 /vm/vmimpl
parentdc89691385e8105f1c9fb3d30297470562aca3c1 (diff)
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
Diffstat (limited to 'vm/vmimpl')
-rw-r--r--vm/vmimpl/util.go8
1 files changed, 6 insertions, 2 deletions
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)