From ed7f95981b04a44475fcc1262ea16ea7bddc8136 Mon Sep 17 00:00:00 2001 From: Thomas Garnier Date: Wed, 30 Aug 2017 09:37:29 -0700 Subject: 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 --- vm/isolated/isolated.go | 13 +++++++------ 1 file 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") -- cgit mrf-deployment