From 43c5eda9fc80f3b645ea5340c932fc79cffbc3fc Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Tue, 30 May 2023 09:32:06 -0500 Subject: [PATCH] Invert state and listening logic When waiting for a VM to boot up, we check for two indicators to before mounting volumes: is the vm "running" and is the qemu socket listening. In some cases, presumably race or system pressure, it is possible that the qemu socket may be listening but the vm (and specifically sshd) is not running yet. Fixes: #17403 [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude --- pkg/machine/qemu/machine.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index 6cfc394620..75e97c33cf 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -661,7 +661,7 @@ func (v *MachineVM) Start(name string, opts machine.StartOptions) error { return err } listening := v.isListening() - for state != machine.Running || !listening { + for state != machine.Running && !listening { time.Sleep(100 * time.Millisecond) state, err = v.State(true) if err != nil {