manifest

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package manifest defines the internal virtle launch contract.

It owns the JSON schema that Nix emits for virtle, along with the defaulting and validation rules that keep the runtime assumptions consistent. The package also resolves working-directory and runtime-directory paths into the concrete host-side paths that the manager uses for sockets, lock files, volumes, QEMU binaries, and run processes.

Index

Constants

View Source
const (
	KernelSerialOff     = "off"
	KernelSerialPrint   = "print"
	KernelSerialConsole = "console"
)
View Source
const (
	MountTypeVirtioFS = "virtiofs"
	MountTypeNineP    = "9p"
	MountTypeImage    = "image"
)

Variables

This section is empty.

Functions

func DefaultVirtioFSArgs

func DefaultVirtioFSArgs(socketPath string, source string, id string) []string

DefaultVirtioFSArgs is the default virtiofsd argument list for a virtiofs hotplug device.

func GuestCommandContext

func GuestCommandContext(ctx context.Context, timeout time.Duration) (context.Context, context.CancelFunc)

GuestCommandContext bounds a guest-agent command with timeout. Zero means the command is bounded only by ctx, which is returned as-is.

func NewTemplateRenderer

func NewTemplateRenderer(providers ...TemplateProvider) (*executor.Renderer, error)

func TemplateContext

func TemplateContext(providers ...TemplateProvider) executor.Context

Types

type BalloonControllerConfig

type BalloonControllerConfig struct {
	MinActual             units.MiB     `json:"minActualMiB" toml:"minActualMiB"`
	MaxActual             units.MiB     `json:"maxActualMiB,omitempty" toml:"maxActualMiB"`
	GrowBelowAvailable    units.MiB     `json:"growBelowAvailableMiB" toml:"growBelowAvailableMiB"`
	ReclaimAboveAvailable units.MiB     `json:"reclaimAboveAvailableMiB" toml:"reclaimAboveAvailableMiB"`
	Step                  units.MiB     `json:"stepMiB,omitempty" toml:"stepMiB"`
	PollInterval          time.Duration `json:"pollInterval,omitempty" toml:"pollInterval"`
	ReclaimHoldoff        time.Duration `json:"reclaimHoldoff,omitempty" toml:"reclaimHoldoff"`
}

BalloonControllerConfig configures the automatic balloon controller.

type BalloonControllerInput

type BalloonControllerInput struct {
	MinActual             units.MiB      `json:"min_actual,omitempty" toml:"min_actual" jsonschema:"Minimum guest memory target in MiB."`
	MaxActual             units.MiB      `json:"max_actual,omitempty" toml:"max_actual" jsonschema:"Maximum guest memory target in MiB."`
	GrowBelowAvailable    units.MiB      `` /* 156-byte string literal not displayed */
	ReclaimAboveAvailable units.MiB      `` /* 165-byte string literal not displayed */
	Step                  units.MiB      `json:"step,omitempty" toml:"step" jsonschema:"Memory adjustment step size in MiB."`
	PollInterval          units.Duration `` /* 138-byte string literal not displayed */
	ReclaimHoldoff        units.Duration `` /* 145-byte string literal not displayed */
}

type BalloonDevice

type BalloonDevice struct {
	ID                string                   `json:"id" toml:"id"`
	Transport         string                   `json:"transport" toml:"transport"`
	DeflateOnOOM      bool                     `json:"deflateOnOOM,omitempty" toml:"deflateOnOOM"`
	FreePageReporting bool                     `json:"freePageReporting,omitempty" toml:"freePageReporting"`
	Controller        *BalloonControllerConfig `json:"controller,omitempty" toml:"controller"`
}

BalloonDevice is the resolved virtio-balloon device configuration.

type BalloonInput

type BalloonInput struct {
	Enabled      bool `json:"enabled,omitempty" toml:"enabled" jsonschema:"Enable the virtio memory balloon device."`
	DeflateOnOOM bool `` /* 135-byte string literal not displayed */
	// Pointer preserves omitted vs explicitly false input until resolution.
	FreePageReporting *bool                   `` /* 148-byte string literal not displayed */
	Controller        *BalloonControllerInput `` /* 129-byte string literal not displayed */
}

type CPUCount

type CPUCount struct {
	Value int  `json:"value,omitempty"`
	Set   bool `json:"set,omitempty"`
}

func ExplicitCPUs

func ExplicitCPUs(value int) CPUCount

func (CPUCount) QEMUValue

func (c CPUCount) QEMUValue() int

type Command

type Command struct {
	Path string   `json:"path"`
	Args []string `json:"args,omitempty"`
	Env  []string `json:"env,omitempty"`
}

func RenderCommand

func RenderCommand(command Command, renderer *executor.Renderer) (Command, error)

func (Command) IsZero

func (c Command) IsZero() bool

type Document

type Document struct {
	HostName      string             `` /* 143-byte string literal not displayed */
	WorkingDir    string             `` /* 143-byte string literal not displayed */
	StateDir      string             `` /* 155-byte string literal not displayed */
	Host          HostInput          `json:"host,omitempty" toml:"host" jsonschema:"Host platform facts used while resolving QEMU defaults."`
	QEMU          QEMUInput          `json:"qemu,omitempty" toml:"qemu" jsonschema:"QEMU executable and host-side socket settings."`
	Machine       MachineInput       `json:"machine,omitempty" toml:"machine" jsonschema:"Virtual machine type CPU memory and acceleration settings."`
	Kernel        KernelInput        `json:"kernel" toml:"kernel" jsonschema:"Guest kernel initrd and kernel command-line settings."`
	Graphics      *GraphicsInput     `json:"graphics,omitempty" toml:"graphics" jsonschema:"Graphical display backend settings."`
	Mounts        MountsInput        `json:"mounts,omitempty" toml:"mounts" jsonschema:"Storage and filesystem devices attached at launch."`
	Workspace     WorkspaceInput     `` /* 130-byte string literal not displayed */
	Networks      []NetworkInput     `json:"networks,omitempty" toml:"networks" jsonschema:"Network devices and port forwards attached at launch."`
	Balloon       *BalloonInput      `json:"balloon,omitempty" toml:"balloon" jsonschema:"Virtio memory balloon device and optional controller settings."`
	SSH           SSHInput           `json:"ssh,omitempty" toml:"ssh" jsonschema:"SSH command and readiness settings for attaching to the guest."`
	VSock         VSockInput         `json:"vsock,omitempty" toml:"vsock" jsonschema:"Allowed runtime vsock CID allocation range."`
	WriteFiles    []WriteFileInput   `` /* 135-byte string literal not displayed */
	Notifications NotificationsInput `` /* 133-byte string literal not displayed */
	Run           []RunInput         `json:"run,omitempty" toml:"run" jsonschema:"Host-side processes started before QEMU and stopped during teardown."`
	Hotplug       HotplugInput       `json:"hotplug,omitempty" toml:"hotplug" jsonschema:"Devices that may be attached or detached after launch."`
}

func DecodeDocumentBytes

func DecodeDocumentBytes(data []byte, name string) (Document, error)

func DefaultDocument

func DefaultDocument() Document

DefaultDocument returns the manifest input defaults that virtle assumes when optional fields are omitted. Required fields without defaults, such as kernel.path and kernel.initrd_path, are intentionally left unset.

func DocumentWithDefaults

func DocumentWithDefaults(document Document) Document

DocumentWithDefaults returns document overlaid on DefaultDocument. Pointer, slice, and map fields keep omission semantics: nil means omitted and receives the default; non-nil empty values are preserved. Scalar durations whose zero is meaningful (guest_default_timeout, shutdown_timeout) or invalid (ssh.retry_delay) are always taken from document; DecodeDocumentBytes seeds their defaults before decoding, so documents built in code must set them explicitly.

func (Document) Manifest

func (d Document) Manifest() (*Manifest, error)

func (Document) ManifestWithOptions

func (d Document) ManifestWithOptions(options ResolveOptions) (*Manifest, error)

type ForwardPort

type ForwardPort struct {
	Proto string `json:"proto" toml:"proto" jsonschema:"Transport protocol for the forwarded port."`
	From  string `json:"from" toml:"from" jsonschema:"Forwarding direction: host or guest."`
	Host  string `json:"host" toml:"host" jsonschema:"Host endpoint address in address:port form."`
	Guest string `json:"guest" toml:"guest" jsonschema:"Guest endpoint address in address:port form."`
}

type ForwardTemplateProvider

type ForwardTemplateProvider struct {
	Host string
	Port int
}

func (ForwardTemplateProvider) TemplateContext

func (p ForwardTemplateProvider) TemplateContext() executor.Context

type GraphicsInput

type GraphicsInput struct {
	Backend string `json:"backend,omitempty" toml:"backend" jsonschema:"Display backend; headless disables graphical output."`
}

type HostInput

type HostInput struct {
	OS     string `json:"-" toml:"-"`
	Arch   string `json:"-" toml:"-"`
	System string `json:"-" toml:"-"`
}

type HotplugBlock

type HotplugBlock struct {
	ImagePath string `json:"imagePath"`
	Format    string `json:"format"`
	ReadOnly  bool   `json:"readOnly,omitempty"`
	Serial    string `json:"serial,omitempty"`
}

type HotplugDevice

type HotplugDevice struct {
	Kind     HotplugKind     `json:"kind"`
	ID       string          `json:"id"`
	VirtioFS HotplugVirtioFS `json:"virtiofs,omitempty"`
	Net      HotplugNet      `json:"net,omitempty"`
	Block    HotplugBlock    `json:"block,omitempty"`
}

HotplugDevice is a resolved hotplug device description. It is the manifest's vocabulary for devices that attach to and detach from a running VM; backends turn it into their own attach mechanism.

type HotplugForward

type HotplugForward struct {
	Proto string `json:"proto"`
	Host  string `json:"host"`
	Guest string `json:"guest"`
}

type HotplugInput

type HotplugInput struct {
	Mounts   MountsInput    `json:"mounts,omitempty" toml:"mounts" jsonschema:"Mount devices available for later hotplug attach or detach."`
	Networks []NetworkInput `json:"networks,omitempty" toml:"networks" jsonschema:"Network devices available for later hotplug attach or detach."`
}

func (HotplugInput) Len

func (h HotplugInput) Len() int

func (HotplugInput) VirtioFS

func (h HotplugInput) VirtioFS() []VirtioFSMountInput

type HotplugKind

type HotplugKind string

HotplugKind identifies the kind of a resolved hotplug device.

const (
	HotplugKindVirtioFS HotplugKind = "virtiofs"
	HotplugKindNet      HotplugKind = "net"
	HotplugKindBlock    HotplugKind = "block"
)

type HotplugNet

type HotplugNet struct {
	Backend string           `json:"backend"`
	MAC     string           `json:"mac"`
	Forward []HotplugForward `json:"forward,omitempty"`
}

type HotplugVirtioFS

type HotplugVirtioFS struct {
	Source     string   `json:"source"`
	Target     string   `json:"target,omitempty"`
	SocketPath string   `json:"socketPath"`
	Bin        string   `json:"bin"`
	Args       []string `json:"args,omitempty"`
}

type Identity

type Identity struct {
	HostName string `json:"hostName"`
}

type ImageInput

type ImageInput struct {
	Size       units.MiB `json:"size,omitempty" toml:"size" jsonschema:"Image size in MiB when creating the image."`
	FSType     string    `json:"fs,omitempty" toml:"fs" jsonschema:"Filesystem type used when creating the image."`
	Format     string    `json:"format,omitempty" toml:"format" jsonschema:"QEMU image format such as raw or qcow2."`
	AutoCreate bool      `json:"create,omitempty" toml:"create" jsonschema:"Create and format the image if it does not exist."`
	// Pointer preserves omitted vs explicitly empty input until resolution.
	Label  *string `json:"label,omitempty" toml:"label" jsonschema:"Optional filesystem label used when creating the image."`
	Direct bool    `json:"direct,omitempty" toml:"direct" jsonschema:"Use direct I/O cache settings for the block device."`
	// Pointer preserves omitted vs explicitly empty input until resolution.
	Serial *string `json:"serial,omitempty" toml:"serial" jsonschema:"Optional disk serial exposed to the guest."`
}

type ImageMountInput

type ImageMountInput struct {
	Type       string     `json:"type" toml:"type" jsonschema:"Mount kind; must be image for this entry."`
	SourcePath string     `json:"source" toml:"source" jsonschema:"Host disk image path."`
	ReadOnly   bool       `json:"read_only,omitempty" toml:"read_only" jsonschema:"Attach the image read-only."`
	Image      ImageInput `json:"image,omitempty" toml:"image" jsonschema:"Disk image creation and format settings."`
}

type KernelInput

type KernelInput struct {
	Path       string   `json:"path" toml:"path" jsonschema:"Path to the guest kernel image."`
	InitrdPath string   `json:"initrd_path" toml:"initrd_path" jsonschema:"Path to the guest initrd image."`
	Params     []string `json:"params,omitempty" toml:"params" jsonschema:"Additional kernel command-line parameters appended after virtle defaults."`
	Serial     string   `json:"serial,omitempty" toml:"serial" default:"off" jsonschema:"Serial console mode: off print or console."`
}

type MachineInput

type MachineInput struct {
	Type   string    `json:"type,omitempty" toml:"type" default:"microvm" jsonschema:"QEMU machine type to use when resolving device transports."`
	VCPU   int       `json:"vcpu,omitempty" toml:"vcpu" jsonschema:"Number of virtual CPUs to expose to the guest; zero derives the count."`
	ID     string    `json:"id,omitempty" toml:"id" jsonschema:"Optional machine identifier passed through to QEMU."`
	Memory units.MiB `json:"memory,omitempty" toml:"memory" default:"1024" jsonschema:"Guest memory size in MiB."`
	CPU    string    `json:"cpu,omitempty" toml:"cpu" jsonschema:"QEMU CPU model string."`
	// Pointer preserves omitted vs explicitly false input until resolution.
	KVM *bool `json:"kvm,omitempty" toml:"kvm" jsonschema:"Whether QEMU should enable KVM acceleration when supported."`
}

type Manifest

type Manifest struct {
	Identity      Identity        `json:"identity"`
	Paths         Paths           `json:"paths"`
	Persistence   Persistence     `json:"persistence"`
	SSH           SSH             `json:"ssh"`
	QEMU          QEMU            `json:"qemu"`
	Volumes       []Volume        `json:"volumes,omitempty"`
	VSock         VSock           `json:"vsock"`
	Workspace     Workspace       `json:"workspace,omitempty"`
	WriteFiles    WriteFiles      `json:"writeFiles,omitempty"`
	Notifications Notifications   `json:"notifications,omitempty"`
	Run           []Run           `json:"run,omitempty"`
	Hotplug       []HotplugDevice `json:"hotplug,omitempty"`
	CleanupFiles  []string        `json:"cleanupFiles,omitempty"`
}

func DefaultManifest

func DefaultManifest() (*Manifest, error)

DefaultManifest returns the fully resolved manifest defaults. Since kernel paths are required inputs and have no default, placeholder values are used so resolution can show all derived runtime defaults.

func (*Manifest) GuestCommandContext

func (m *Manifest) GuestCommandContext(ctx context.Context) (context.Context, context.CancelFunc)

GuestCommandContext bounds a guest-agent command with the manifest's guest command timeout.

func (*Manifest) ResolvedCleanupFiles

func (m *Manifest) ResolvedCleanupFiles() ([]string, error)

func (*Manifest) ResolvedControlSocketPath

func (m *Manifest) ResolvedControlSocketPath() (string, error)

func (*Manifest) ResolvedExternalVirtioFSSocketPaths

func (m *Manifest) ResolvedExternalVirtioFSSocketPaths() ([]string, error)

func (*Manifest) ResolvedGuestAgentSocketPath

func (m *Manifest) ResolvedGuestAgentSocketPath() (string, error)

func (*Manifest) ResolvedLockPath

func (m *Manifest) ResolvedLockPath() string

func (*Manifest) ResolvedNotifications

func (m *Manifest) ResolvedNotifications() Notifications

func (*Manifest) ResolvedPersistenceBaseDir

func (m *Manifest) ResolvedPersistenceBaseDir() string

func (*Manifest) ResolvedPersistenceDirectories

func (m *Manifest) ResolvedPersistenceDirectories() []string

func (*Manifest) ResolvedPersistenceStateDir

func (m *Manifest) ResolvedPersistenceStateDir() string

func (*Manifest) ResolvedQEMU

func (m *Manifest) ResolvedQEMU() (QEMU, error)

func (*Manifest) ResolvedQMPSocketPath

func (m *Manifest) ResolvedQMPSocketPath() (string, error)

func (*Manifest) ResolvedRuns

func (m *Manifest) ResolvedRuns(cid int) ([]ResolvedRun, error)

func (*Manifest) ResolvedSSHReadySocketPath

func (m *Manifest) ResolvedSSHReadySocketPath() (string, error)

func (*Manifest) ResolvedVirtioFSSocketPaths

func (m *Manifest) ResolvedVirtioFSSocketPaths() ([]string, error)

func (*Manifest) ResolvedVolumes

func (m *Manifest) ResolvedVolumes() []Volume

func (*Manifest) ResolvedWriteFiles

func (m *Manifest) ResolvedWriteFiles() []ResolvedWriteFile

func (*Manifest) SSHDestination

func (m *Manifest) SSHDestination(cid int) string

func (*Manifest) SSHRetryDelay

func (m *Manifest) SSHRetryDelay(fallback time.Duration) time.Duration

func (*Manifest) Validate

func (m *Manifest) Validate() error

type MountEntry

type MountEntry interface {
	// contains filtered or unexported methods
}

type MountInput

type MountInput struct {
	Tag        string `json:"tag" toml:"tag" jsonschema:"Stable QEMU mount tag or device identifier."`
	SourcePath string `json:"source,omitempty" toml:"source" jsonschema:"Host path or image path backing this mount."`
	ReadOnly   bool   `json:"read_only,omitempty" toml:"read_only" jsonschema:"Attach the mount or image read-only."`
}

type MountsInput

type MountsInput []MountEntry

func (MountsInput) Image

func (m MountsInput) Image() []ImageMountInput

func (MountsInput) MarshalJSON

func (m MountsInput) MarshalJSON() ([]byte, error)

func (MountsInput) NineP

func (m MountsInput) NineP() []NinePMountInput

func (MountsInput) RequiresPCI

func (m MountsInput) RequiresPCI() bool

func (*MountsInput) UnmarshalJSON

func (m *MountsInput) UnmarshalJSON(data []byte) error

func (*MountsInput) UnmarshalTOML

func (m *MountsInput) UnmarshalTOML(data any) error

func (MountsInput) VirtioFS

func (m MountsInput) VirtioFS() []VirtioFSMountInput

type NetworkInput

type NetworkInput struct {
	ID      string        `json:"id,omitempty" toml:"id" jsonschema:"QEMU network device identifier."`
	Type    string        `json:"type,omitempty" toml:"type" jsonschema:"Network backend type."`
	MAC     string        `json:"mac,omitempty" toml:"mac" jsonschema:"Guest network interface MAC address."`
	Forward []ForwardPort `json:"forward,omitempty" toml:"forward" jsonschema:"Port forwarding rules for this network backend."`
}

type NinePInput

type NinePInput struct {
	SecurityModel string `json:"security_model,omitempty" toml:"security_model" jsonschema:"QEMU 9p security model."`
}

type NinePMountInput

type NinePMountInput struct {
	Type string `json:"type" toml:"type" jsonschema:"Mount kind; must be 9p for this entry."`
	MountInput

	NineP NinePInput `json:"9p,omitempty" toml:"9p" jsonschema:"9p-specific mount options."`
}

type NotificationTemplateProvider

type NotificationTemplateProvider struct {
	State   string
	Message string
	Values  map[string]string
}

func (NotificationTemplateProvider) TemplateContext

func (p NotificationTemplateProvider) TemplateContext() executor.Context

type Notifications

type Notifications struct {
	Command Command  `json:"command,omitempty"`
	States  []string `json:"states,omitempty"`
}

type NotificationsInput

type NotificationsInput struct {
	Exec   []string `json:"exec,omitempty" toml:"exec" jsonschema:"Host command template invoked for enabled notification states."`
	States []string `json:"states,omitempty" toml:"states" jsonschema:"Notification state names that should trigger the command."`
}

type Paths

type Paths struct {
	WorkingDir string     `json:"workingDir"`
	LockPath   string     `json:"lockPath"`
	RuntimeDir RuntimeDir `json:"runtimeDir,omitempty"`
}

type Persistence

type Persistence struct {
	Directories []string `json:"directories"`
	BaseDir     string   `json:"baseDir,omitempty"`
	StateDir    string   `json:"stateDir,omitempty"`
}

type PortEndpoint

type PortEndpoint struct {
	Address string `json:"address" toml:"address"`
	Port    int    `json:"port" toml:"port"`
}

type QEMU

type QEMU struct {
	BinaryPath      string         `json:"binaryPath"`
	Name            string         `json:"name"`
	Machine         QEMUMachine    `json:"machine"`
	CPU             QEMUCPU        `json:"cpu"`
	Memory          QEMUMemory     `json:"memory"`
	Kernel          QEMUKernel     `json:"kernel"`
	SMP             QEMUSMP        `json:"smp"`
	Console         QEMUConsole    `json:"console"`
	Knobs           QEMUKnobs      `json:"knobs"`
	Graphics        QEMUGraphics   `json:"graphics,omitempty"`
	QMP             QEMUQMP        `json:"qmp"`
	GuestAgent      QEMUGuestAgent `json:"guestAgent,omitempty"`
	SSHReady        QEMUSSHReady   `json:"sshReady,omitempty"`
	Hotplug         QEMUHotplug    `json:"hotplug,omitempty"`
	Devices         QEMUDevices    `json:"devices"`
	MachineID       string         `json:"machineId,omitempty"`
	PassthroughArgs []string       `json:"passthroughArgs,omitempty"`
}

func (QEMU) NoGraphicEnabled

func (q QEMU) NoGraphicEnabled() bool

type QEMUBlockDevice

type QEMUBlockDevice struct {
	ID        string `json:"id"`
	ImagePath string `json:"imagePath"`
	Format    string `json:"format,omitempty"`
	AIO       string `json:"aio,omitempty"`
	Cache     string `json:"cache,omitempty"`
	ReadOnly  bool   `json:"readOnly,omitempty"`
	Serial    string `json:"serial,omitempty"`
	Transport string `json:"transport"`
}

type QEMUCPU

type QEMUCPU struct {
	Model     string `json:"model"`
	EnableKVM bool   `json:"enableKvm,omitempty"`
}

type QEMUConsole

type QEMUConsole string
const (
	QEMUConsoleOff         QEMUConsole = KernelSerialOff
	QEMUConsolePrint       QEMUConsole = KernelSerialPrint
	QEMUConsoleInteractive QEMUConsole = KernelSerialConsole
)

func (QEMUConsole) Enabled

func (c QEMUConsole) Enabled() bool

func (QEMUConsole) Interactive

func (c QEMUConsole) Interactive() bool

type QEMUDevices

type QEMUDevices struct {
	RNG      QEMURNGDevice       `json:"rng"`
	I8042    bool                `json:"i8042,omitempty"`
	Balloon  *BalloonDevice      `json:"balloon,omitempty"`
	VirtioFS []QEMUVirtioFSShare `json:"virtiofs,omitempty"`
	NineP    []QEMUNinePShare    `json:"9p,omitempty"`
	Block    []QEMUBlockDevice   `json:"block,omitempty"`
	Mounts   []QEMUMountDevice   `json:"mounts,omitempty"`
	Network  []QEMUNetDevice     `json:"network,omitempty"`
	VSOCK    QEMUVSOCKDevice     `json:"vsock"`
}

type QEMUGraphics

type QEMUGraphics struct {
	Backend string `json:"backend"`
}

func (QEMUGraphics) IsZero

func (g QEMUGraphics) IsZero() bool

type QEMUGuestAgent

type QEMUGuestAgent struct {
	SocketPath      string        `json:"socketPath,omitempty"`
	CommandTimeout  time.Duration `json:"commandTimeout,omitempty"`
	ShutdownExec    []string      `json:"shutdownExec,omitempty"`
	ShutdownTimeout time.Duration `json:"shutdownTimeout,omitempty"`
}

type QEMUHotplug

type QEMUHotplug struct {
	PCIEPorts int `json:"pciePorts,omitempty"`
}

type QEMUInput

type QEMUInput struct {
	Exec                []string          `json:"exec,omitempty" toml:"exec" jsonschema:"Command template used to launch QEMU; the first element is the QEMU binary."`
	FwdTunnelExec       []string          `` /* 127-byte string literal not displayed */
	User                string            `json:"user,omitempty" toml:"user" jsonschema:"Host user used for QEMU-related process policy when supported."`
	Seccomp             bool              `json:"seccomp,omitempty" toml:"seccomp" jsonschema:"Enable QEMU seccomp sandboxing."`
	MachineOptions      map[string]string `` /* 146-byte string literal not displayed */
	QMPSocket           string            `` /* 175-byte string literal not displayed */
	GuestAgentSocket    string            `` /* 186-byte string literal not displayed */
	GuestDefaultTimeout units.Duration    `` /* 294-byte string literal not displayed */
	ShutdownExec        []string          `` /* 145-byte string literal not displayed */
	ShutdownTimeout     units.Duration    `` /* 151-byte string literal not displayed */
	HotplugPorts        int               `` /* 244-byte string literal not displayed */
}

type QEMUKernel

type QEMUKernel struct {
	Path       string `json:"path"`
	InitrdPath string `json:"initrdPath"`
	Params     string `json:"params,omitempty"`
}

type QEMUKnobs

type QEMUKnobs struct {
	NoDefaults     bool `json:"noDefaults,omitempty"`
	NoUserConfig   bool `json:"noUserConfig,omitempty"`
	NoReboot       bool `json:"noReboot,omitempty"`
	NoGraphic      bool `json:"noGraphic,omitempty"`
	SeccompSandbox bool `json:"seccompSandbox,omitempty"`
}

type QEMUMachine

type QEMUMachine struct {
	Type    string   `json:"type"`
	Options []string `json:"options,omitempty"`
}

type QEMUMemory

type QEMUMemory struct {
	Size    units.MiB `json:"sizeMiB"`
	Backend string    `json:"backend,omitempty"`
	Shared  bool      `json:"shared,omitempty"`
}

type QEMUMountDevice

type QEMUMountDevice struct {
	Type     string             `json:"type"`
	VirtioFS *QEMUVirtioFSShare `json:"virtiofs,omitempty"`
	NineP    *QEMUNinePShare    `json:"9p,omitempty"`
	Block    *QEMUBlockDevice   `json:"block,omitempty"`
}

type QEMUNetDevice

type QEMUNetDevice struct {
	ID            string   `json:"id"`
	Backend       string   `json:"backend"`
	MacAddress    string   `json:"macAddress"`
	Transport     string   `json:"transport"`
	RomFile       string   `json:"romFile,omitempty"`
	DisableROM    bool     `json:"disableROM,omitempty"`
	NetdevOptions []string `json:"netdevOptions,omitempty"`
	MQVectors     int      `json:"mqVectors,omitempty"`
}

type QEMUNinePShare

type QEMUNinePShare struct {
	ID            string `json:"id"`
	SourcePath    string `json:"sourcePath"`
	Tag           string `json:"tag"`
	SecurityModel string `json:"securityModel"`
	ReadOnly      bool   `json:"readOnly"`
	Transport     string `json:"transport"`
}

type QEMUQMP

type QEMUQMP struct {
	SocketPath string `json:"socketPath"`
}

type QEMURNGDevice

type QEMURNGDevice struct {
	ID        string `json:"id"`
	Transport string `json:"transport"`
}

type QEMUSMP

type QEMUSMP struct {
	CPUs CPUCount `json:"cpus,omitempty"`
}

type QEMUSSHReady

type QEMUSSHReady struct {
	SocketPath string `json:"socketPath,omitempty"`
}

type QEMUTemplateProvider

type QEMUTemplateProvider struct {
	HostName   string
	WorkingDir string
	StateDir   string
	Host       HostInput
}

func (QEMUTemplateProvider) TemplateContext

func (p QEMUTemplateProvider) TemplateContext() executor.Context

type QEMUVSOCKDevice

type QEMUVSOCKDevice struct {
	ID        string `json:"id"`
	Transport string `json:"transport"`
}

type QEMUVirtioFSShare

type QEMUVirtioFSShare struct {
	ID         string `json:"id"`
	SocketPath string `json:"socketPath"`
	Tag        string `json:"tag"`
	Transport  string `json:"transport"`
}

type RangeInput

type RangeInput struct {
	Min int `json:"min,omitempty" toml:"min" jsonschema:"Inclusive minimum value."`
	Max int `json:"max,omitempty" toml:"max" jsonschema:"Inclusive maximum value."`
}

type ResolveOptions

type ResolveOptions struct {
	Logger *slog.Logger
}

type ResolvedRun

type ResolvedRun struct {
	Exec []string
	Env  []string
	Dir  string
}

type ResolvedWriteFile

type ResolvedWriteFile struct {
	GuestPath   string
	Chown       string
	Mode        string
	Overwrite   bool
	FollowLinks bool
	WriteBack   bool
	Content     WriteFileContent
}

type Run

type Run struct {
	Exec []string       `json:"exec"`
	Env  []string       `json:"env,omitempty"`
	Vars map[string]any `json:"vars,omitempty"`
}

type RunInput

type RunInput struct {
	Exec []string       `json:"exec" toml:"exec" jsonschema:"Host command template to start before QEMU."`
	Vars map[string]any `json:"vars,omitempty" toml:"vars" jsonschema:"Template variables made available to this run command."`
}

type RunTemplateProvider

type RunTemplateProvider struct {
	CID       int
	StateDir  string
	Workspace Workspace
	Vars      map[string]any
}

func (RunTemplateProvider) TemplateContext

func (p RunTemplateProvider) TemplateContext() executor.Context

type RuntimeDir

type RuntimeDir struct {
	Mode RuntimeDirMode `json:"mode,omitempty"`
	Path string         `json:"path,omitempty"`
}

type RuntimeDirMode

type RuntimeDirMode int
const (
	RuntimeDirWorking RuntimeDirMode = iota
	RuntimeDirXDG
	RuntimeDirPath
)

type SSH

type SSH struct {
	Argv          []string      `json:"argv"`
	User          string        `json:"user"`
	RetryDelay    time.Duration `json:"retryDelay,omitempty"`
	Autoprovision bool          `json:"autoprovision,omitempty"`
}

type SSHInput

type SSHInput struct {
	Exec          []string       `json:"exec,omitempty" toml:"exec" jsonschema:"SSH command template used to attach to the guest."`
	User          string         `json:"user,omitempty" toml:"user" default:"agent" jsonschema:"Guest SSH username."`
	ReadySocket   string         `` /* 147-byte string literal not displayed */
	RetryDelay    units.Duration `` /* 161-byte string literal not displayed */
	Autoprovision bool           `` /* 129-byte string literal not displayed */
}

type SSHTemplateProvider

type SSHTemplateProvider struct {
	CID         int
	User        string
	Destination string
}

func (SSHTemplateProvider) TemplateContext

func (p SSHTemplateProvider) TemplateContext() executor.Context

type TemplateContextFunc

type TemplateContextFunc func() executor.Context

func (TemplateContextFunc) TemplateContext

func (f TemplateContextFunc) TemplateContext() executor.Context

type TemplateProvider

type TemplateProvider interface {
	TemplateContext() executor.Context
}

TemplateProvider contributes values to an exec template rendering context.

func StaticTemplateContext

func StaticTemplateContext(values executor.Context) TemplateProvider

type VSock

type VSock struct {
	CIDRange VSockCIDRange `json:"cidRange"`
}

type VSockCIDRange

type VSockCIDRange struct {
	Start int `json:"start"`
	End   int `json:"end"`
}

type VSockInput

type VSockInput struct {
	CIDRange RangeInput `json:"cid_range,omitempty" toml:"cid_range" jsonschema:"Inclusive range of vsock CIDs virtle may allocate at launch."`
}

type VirtioFSInput

type VirtioFSInput struct {
	Socket string   `` /* 135-byte string literal not displayed */
	Bin    string   `json:"bin,omitempty" toml:"bin" jsonschema:"Virtiofs daemon executable path or wrapper script."`
	Args   []string `json:"args,omitempty" toml:"args" jsonschema:"Arguments for the virtiofs daemon command."`
}

type VirtioFSMountInput

type VirtioFSMountInput struct {
	Type string `json:"type" toml:"type" jsonschema:"Mount kind; must be virtiofs for this entry."`
	MountInput
	Target string `json:"target,omitempty" toml:"target" jsonschema:"Optional guest mount target used for hotplug guest mount commands."`

	VirtioFS VirtioFSInput `json:"virtiofs,omitempty" toml:"virtiofs" jsonschema:"Virtiofs daemon socket and command settings."`
}

type VirtioFSTemplateProvider

type VirtioFSTemplateProvider struct {
	SocketPath string
	SourcePath string
	Tag        string
}

func (VirtioFSTemplateProvider) TemplateContext

func (p VirtioFSTemplateProvider) TemplateContext() executor.Context

type Volume

type Volume struct {
	ImagePath     string    `json:"imagePath"`
	Size          units.MiB `json:"sizeMiB,omitempty"`
	FSType        string    `json:"fsType,omitempty"`
	AutoCreate    bool      `json:"autoCreate,omitempty"`
	Label         string    `json:"label,omitempty"`
	MkfsExtraArgs []string  `json:"mkfsExtraArgs,omitempty"`
}

type Workspace

type Workspace struct {
	GuestDir string `json:"guestDir,omitempty"`
	HostDir  string `json:"hostDir,omitempty"`
	MountCWD bool   `json:"mountCWD,omitempty"`
}

type WorkspaceInput

type WorkspaceInput struct {
	GuestDir string `json:"guest_dir,omitempty" toml:"guest_dir" jsonschema:"Guest workspace directory used in templates."`
	HostDir  string `json:"host_dir,omitempty" toml:"host_dir" jsonschema:"Host workspace directory used in templates."`
	MountCWD bool   `json:"mount_cwd,omitempty" toml:"mount_cwd" jsonschema:"Mount the current working directory into the guest after launch."`
}

type WriteFile

type WriteFile struct {
	Chown       string           `json:"chown,omitempty"`
	Mode        string           `json:"mode,omitempty"`
	Overwrite   bool             `json:"overwrite,omitempty"`
	FollowLinks bool             `json:"followLinks,omitempty"`
	WriteBack   bool             `json:"writeBack,omitempty"`
	Content     WriteFileContent `json:"content,omitempty"`
}

type WriteFileContent

type WriteFileContent struct {
	Kind WriteFileContentKind `json:"kind,omitempty"`
	Text string               `json:"text,omitempty"`
	Path string               `json:"path,omitempty"`
}

type WriteFileContentKind

type WriteFileContentKind int
const (
	WriteFileContentNone WriteFileContentKind = iota
	WriteFileContentText
	WriteFileContentPath
)

type WriteFileInput

type WriteFileInput struct {
	GuestPath string `json:"guest_path" toml:"guest_path" jsonschema:"Absolute guest path to write."`
	// Pointer preserves omitted vs explicitly empty input until resolution.
	Chown *string `json:"chown,omitempty" toml:"chown" jsonschema:"Optional guest owner and group in owner:group form."`
	// Pointer preserves omitted vs explicitly empty input until resolution.
	Text *string `json:"text,omitempty" toml:"text" jsonschema:"Inline text content to write to the guest path."`
	// Pointer preserves omitted vs explicitly empty input until resolution.
	Mode *string `json:"mode,omitempty" toml:"mode" jsonschema:"Optional file mode matching ^0?[0-7]{3}$."`
	// Pointer preserves omitted vs explicitly false input until resolution.
	Overwrite *bool `json:"overwrite,omitempty" toml:"overwrite" jsonschema:"Overwrite an existing guest file."`
	// Pointer preserves omitted vs explicitly false input until resolution.
	FollowLinks *bool `json:"follow_links,omitempty" toml:"follow_links" jsonschema:"Follow symlinks when reading source content from the host."`
	// Pointer preserves omitted vs explicitly false input until resolution.
	WriteBack *bool `json:"write_back,omitempty" toml:"write_back" jsonschema:"Copy guest changes back to the host source path during teardown."`
	// Pointer preserves omitted vs explicitly empty input until resolution.
	Path *string `json:"source,omitempty" toml:"source" jsonschema:"Host source path for file content."`
}

type WriteFiles

type WriteFiles map[string]WriteFile

Directories

Path Synopsis
Package schema generates the JSON Schema for the manifest input format.
Package schema generates the JSON Schema for the manifest input format.
Package tagged decodes and encodes JSON-style tagged union lists.
Package tagged decodes and encodes JSON-style tagged union lists.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL