vmconfig

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 0 Imported by: 0

README

VM Config

Shared configuration schema for host-to-guest communication.

Purpose

This package defines the Config struct that is:

  • Serialized as JSON by the host when creating a VM's config disk
  • Deserialized by the guest init binary during boot

By defining this in a shared package, the host and guest code stay in sync without duplication.

Usage

The host writes this config to /config.json on the config disk (attached as /dev/vdc). The guest init binary mounts this disk and reads the JSON configuration.

Fields

  • Entrypoint/Cmd/Workdir: Container execution parameters from the OCI image
  • Env: Environment variables (merged from image + instance overrides)
  • Network: Guest IP, gateway, DNS configuration
  • GPU: Whether GPU passthrough is enabled
  • VolumeMounts: Block devices to mount inside the guest
  • InitMode: Either "exec" (container-like) or "systemd" (full VM)

Documentation

Overview

Package vmconfig defines the configuration schema passed from host to guest VM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Container execution parameters
	Entrypoint []string `json:"entrypoint"`
	Cmd        []string `json:"cmd"`
	Workdir    string   `json:"workdir"`

	// Environment variables
	Env map[string]string `json:"env"`

	// Network configuration
	NetworkEnabled bool   `json:"network_enabled"`
	GuestIP        string `json:"guest_ip,omitempty"`
	GuestCIDR      int    `json:"guest_cidr,omitempty"`
	GuestGW        string `json:"guest_gw,omitempty"`
	GuestDNS       string `json:"guest_dns,omitempty"`

	// Volume mounts
	VolumeMounts []VolumeMount `json:"volume_mounts,omitempty"`

	// Init mode: "exec" (default) or "systemd"
	InitMode string `json:"init_mode"`

	// Boot optimizations
	SkipKernelHeaders bool `json:"skip_kernel_headers,omitempty"`
	SkipGuestAgent    bool `json:"skip_guest_agent,omitempty"`
}

Config is the configuration passed to the guest init binary via config.json. This struct is serialized by the host (lib/instances/configdisk.go) and deserialized by the guest init binary (lib/system/init).

type VolumeMount

type VolumeMount struct {
	Device        string `json:"device"`
	Path          string `json:"path"`
	Mode          string `json:"mode"` // "ro", "rw", or "overlay"
	OverlayDevice string `json:"overlay_device,omitempty"`
}

VolumeMount represents a volume mount configuration.

Jump to

Keyboard shortcuts

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