From db09e5b2322f6dbd902a69405c2142617c6b8715 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 26 Sep 2025 14:51:17 +0200 Subject: vm/qemu: don't auto retry ssh connection timeout errors In almost all cases these mean some boot time crash. It also doesn't make much sense to continue string matching since the boot output may contain the matched strings in benign contexts. --- vm/qemu/qemu.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go index 63598d4bb..6714703fe 100644 --- a/vm/qemu/qemu.go +++ b/vm/qemu/qemu.go @@ -348,6 +348,12 @@ func (pool *Pool) Create(ctx context.Context, workdir string, index int) (vmimpl if err == nil { return inst, nil } + if strings.Contains(err.Error(), "can't ssh into the instance") { + // If there was a boot error, immediately return it. + // In this case, the string search below also matches against boot time output, + // and e.g. "Device or resource busy" is quite often in there. + return nil, err + } // Older qemu prints "could", newer -- "Could". if i < 1000 && strings.Contains(err.Error(), "ould not set up host forwarding rule") { continue @@ -358,6 +364,7 @@ func (pool *Pool) Create(ctx context.Context, workdir string, index int) (vmimpl if i < 1000 && strings.Contains(err.Error(), "Address already in use") { continue } + return nil, err } } -- cgit mrf-deployment