diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-09-26 13:17:29 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-10-01 14:41:08 +0000 |
| commit | 9f36949b26d43c6ccbb08181c9d4452458d2c673 (patch) | |
| tree | 7b9268d4f63e42c11e0abe67168e910b77b887dd /vm/dispatcher/pool.go | |
| parent | a6341f95a21baff8dca02c63fea4abccc6056672 (diff) | |
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.
Diffstat (limited to 'vm/dispatcher/pool.go')
| -rw-r--r-- | vm/dispatcher/pool.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/vm/dispatcher/pool.go b/vm/dispatcher/pool.go index 08bc1ebfa..424724c25 100644 --- a/vm/dispatcher/pool.go +++ b/vm/dispatcher/pool.go @@ -19,7 +19,7 @@ type Instance interface { type UpdateInfo func(cb func(info *Info)) type Runner[T Instance] func(ctx context.Context, inst T, updInfo UpdateInfo) -type CreateInstance[T Instance] func(int) (T, error) +type CreateInstance[T Instance] func(context.Context, int) (T, error) // Pool[T] provides the functionality of a generic pool of instances. // The instance is assumed to boot, be controlled by one Runner and then be re-created. @@ -125,7 +125,7 @@ func (p *Pool[T]) runInstance(ctx context.Context, inst *poolInstance[T]) { inst.status(StateBooting) defer inst.status(StateOffline) - obj, err := p.creator(inst.idx) + obj, err := p.creator(ctx, inst.idx) if err != nil { p.reportBootError(ctx, err) return |
