Stop waiting for ssh if qemu is dead
This commit is contained in:
parent
31370b7bad
commit
d5ea97c532
@ -342,6 +342,10 @@ func (q System) WaitForSSH(timeout time.Duration) error {
|
|||||||
for start := time.Now(); time.Since(start) < timeout; {
|
for start := time.Now(); time.Since(start) < timeout; {
|
||||||
time.Sleep(time.Second / 4)
|
time.Sleep(time.Second / 4)
|
||||||
|
|
||||||
|
if q.Died || q.KernelPanic {
|
||||||
|
return errors.New("no ssh (qemu is dead)")
|
||||||
|
}
|
||||||
|
|
||||||
client, err := q.ssh("root")
|
client, err := q.ssh("root")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
@ -360,6 +364,7 @@ func (q System) WaitForSSH(timeout time.Duration) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
client.Close()
|
client.Close()
|
||||||
|
q.Log.Debug().Msg("ssh is available")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user