diff options
| author | Thomas Garnier <thgarnie@google.com> | 2017-08-30 09:37:29 -0700 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-08-30 19:30:38 +0200 |
| commit | ed7f95981b04a44475fcc1262ea16ea7bddc8136 (patch) | |
| tree | 79d8ecbc3275beb6a27502b0893a7ab50b225a79 | |
| parent | 49c11eb5140bbe727be05015f78831043e2fe3a8 (diff) | |
Fix reboot support for VM isolated
Do not fail a reboot if the reboot command returns an error. Reduces the
wait time per ssh commands to 30 seconds.
Signed-off-by: Thomas Garnier <thgarnie@google.com>
| -rw-r--r-- | vm/isolated/isolated.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/vm/isolated/isolated.go b/vm/isolated/isolated.go index cd4235928..ceb3aacc2 100644 --- a/vm/isolated/isolated.go +++ b/vm/isolated/isolated.go @@ -136,7 +136,7 @@ func (inst *instance) ssh(command string) ([]byte, error) { done := make(chan bool) go func() { select { - case <-time.After(time.Minute): + case <-time.After(time.Second * 30): if inst.debug { Logf(0, "ssh hanged") } @@ -163,20 +163,21 @@ func (inst *instance) ssh(command string) ([]byte, error) { func (inst *instance) repair() error { Logf(2, "isolated: trying to ssh") if err := inst.waitForSsh(30 * 60); err == nil { - Logf(2, "isolated: ssh succeeded") if inst.cfg.Target_Reboot == true { - if _, err = inst.ssh("reboot"); err != nil { - Logf(2, "isolated: failed to send reboot command") - return err - } + Logf(2, "isolated: trying to reboot") + inst.ssh("reboot") // reboot will return an error, ignore it if err := inst.waitForReboot(5 * 60); err != nil { Logf(2, "isolated: machine did not reboot") return err } + Logf(2, "isolated: rebooted wait for comeback") if err := inst.waitForSsh(30 * 60); err != nil { Logf(2, "isolated: machine did not comeback") return err } + Logf(2, "isolated: reboot succeeded") + } else { + Logf(2, "isolated: ssh succeeded") } } else { Logf(2, "isolated: ssh failed") |
