From 9f36949b26d43c6ccbb08181c9d4452458d2c673 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 26 Sep 2025 13:17:29 +0200 Subject: vm: add context to Pool.Create() Enable external abortion of the instance creation process. This is especially useful for the qemu case where we retry the creation/boot up to 1000 times, which can take significant time (e.g. it timeouts syz-cluster pods on unstable kernels). The context can be further propagated to WaitForSSH, but that requires another quite significant vm/ refactoring. --- pkg/instance/execprog.go | 2 +- pkg/instance/instance.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'pkg/instance') diff --git a/pkg/instance/execprog.go b/pkg/instance/execprog.go index 7c97819f4..564889ba2 100644 --- a/pkg/instance/execprog.go +++ b/pkg/instance/execprog.go @@ -91,7 +91,7 @@ func SetupExecProg(vmInst *vm.Instance, mgrCfg *mgrconfig.Config, reporter *repo func CreateExecProgInstance(vmPool *vm.Pool, vmIndex int, mgrCfg *mgrconfig.Config, reporter *report.Reporter, opt *OptionalConfig) (*ExecProgInstance, error) { - vmInst, err := vmPool.Create(vmIndex) + vmInst, err := vmPool.Create(context.Background(), vmIndex) if err != nil { return nil, fmt.Errorf("failed to create VM: %w", err) } diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go index b0398ba14..51802acf9 100644 --- a/pkg/instance/instance.go +++ b/pkg/instance/instance.go @@ -6,6 +6,7 @@ package instance import ( + "context" "encoding/json" "errors" "fmt" @@ -314,7 +315,7 @@ type EnvTestResult struct { } func (inst *inst) test() EnvTestResult { - vmInst, err := inst.vmPool.Create(inst.vmIndex) + vmInst, err := inst.vmPool.Create(context.Background(), inst.vmIndex) if err != nil { testErr := &TestError{ Boot: true, -- cgit mrf-deployment