Monorepo for Tangled
tangled.org
1package microvm
2
3import (
4 "context"
5 "fmt"
6 "log/slog"
7)
8
9type Runner interface {
10 // check the host has what this backend needs for spec.
11 Validate(spec ImageSpec, enableKVM bool) error
12 Start(ctx context.Context, cfg VMConfig, volumePaths map[string]string, logger *slog.Logger) (VMHandle, error)
13}
14
15func runnerFor(runnerType string) (Runner, error) {
16 switch runnerType {
17 case "qemu", "":
18 return qemuRunner{}, nil
19 case "firecracker":
20 return nil, fmt.Errorf("runner type %q not implemented yet", runnerType)
21 default:
22 return nil, fmt.Errorf("unsupported runner type %q", runnerType)
23 }
24}