vmshared

package
v0.2026196.208 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 23 Imported by: 11 modules, 10 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Code-assisted alias surface for the CUE-single-source cutover (WF-B THE REPOINT).

Every charly hand param struct that has a spec counterpart is now a zero-churn Go type alias onto charly/spec — the generated (cue exp gengotypes) types plus the hand-written union/state types, exposed under their charly names via spec/charly_names.go. The hand struct DEFINITIONS were deleted; these aliases keep every existing reference (`BoxConfig{…}`, `[]ServiceEntry`, …) compiling against the single CUE source of truth. Pure methods moved INTO package spec; methods that reach package-main internals are free functions here taking a *spec.X. See CHANGELOG.

NOT aliased (name collisions where the package-main type is a DIFFERENT concept, kept hand-written): CalVer (version.go computation struct, vs the spec.CalVer scalar), CandyRef (refs.go ref struct, vs the spec.CandyRef scalar), Candy (layers.go resolved-candy runtime struct, vs spec.Candy the param — aliased as CandyYAML instead).

Index

Constants

View Source
const (
	ReadinessAbsoluteCapFallback     = readinessAbsoluteCapFallback
	ReadinessIntervalHeavyFallback   = readinessIntervalHeavyFallback
	ReadinessIntervalLocalFallback   = readinessIntervalLocalFallback
	ReadinessIntervalRemoteFallback  = readinessIntervalRemoteFallback
	ReadinessNoProgressFallback      = readinessNoProgressFallback
	ReadinessPerAttemptFallback      = readinessPerAttemptFallback
	ReadinessPerAttemptHeavyFallback = readinessPerAttemptHeavyFallback
	ReadinessStopGraceFallback       = readinessStopGraceFallback
)

Re-exported constants.

Variables

View Source
var (
	AllDigits                = allDigits
	BoolPtrDefaultTrue       = boolPtrDefaultTrue
	BoolPtrToYesNo           = boolPtrToYesNo
	BoolPtrTrue              = boolPtrTrue
	ComposePackages          = composePackages
	ComposeRunCmd            = composeRunCmd
	ComposeUsers             = composeUsers
	CurrentUsername          = currentUsername
	DefaultMachineForArch    = defaultMachineForArch
	FormatForDistroID        = formatForDistroID
	LoadRegistry             = loadRegistry
	OpenOutputPath           = openOutputPath
	OvmfCandidatesForDistro  = ovmfCandidatesForDistro
	ParseGlibcVersion        = parseGlibcVersion
	PollUntil                = pollUntil
	RegistryPath             = registryPath
	ResolveCloudInitSSHUser  = resolveCloudInitSSHUser
	ResolveCPUDefaults       = resolveCPUDefaults
	SaveRegistry             = saveRegistry
	SnapshotExternalDiskPath = snapshotExternalDiskPath
	SnapshotsDir             = snapshotsDir
	SplitOsReleaseLine       = splitOsReleaseLine
	SplitPortForward         = splitPortForward
	VmDiskPath               = vmDiskPath
	WriterForPath            = writerForPath
)

Re-exported functions.

View Source
var (
	CreateInternalSnapshot    func(opts SnapshotCreateOpts) error
	DeleteInternalSnapshot    func(vmName string, entry *SnapshotEntry) error
	RevertInternalSnapshot    func(vmName string, entry *SnapshotEntry) error
	PromoteInternalToExternal func(vmName string, entry *SnapshotEntry, outPath string) error
	CreateExternalSnapshot    func(opts SnapshotCreateOpts, outFile string) error
	DeleteExternalSnapshot    func(vmName string, entry *SnapshotEntry) error
	RevertExternalSnapshot    func(vmName string, entry *SnapshotEntry) error
)

Snapshot backends. Core wires host-side RPC wrappers (vm_snapshot_client.go) that drive the out-of-process plugin; the plugin wires the in-process go-libvirt implementations (vm_snapshot_internal.go / vm_snapshot_libvirt.go).

View Source
var (
	// ErrPollStalled — the high-water mark did not advance within NoProgress.
	ErrPollStalled = errors.New("poll: no forward progress within the no-progress window")
	// ErrPollCapExceeded — the absolute wall-clock ceiling elapsed.
	ErrPollCapExceeded = errors.New("poll: absolute cap exceeded")
	// ErrPollFatal — wrap a cond error in this to abort the poll immediately.
	ErrPollFatal = errors.New("poll: fatal condition error")
	// ErrPollConfig — pollUntil's own entry validation rejected the config.
	ErrPollConfig = errors.New("poll: invalid configuration")
)
View Source
var UnmarshalEmbeddedDefaults func(dst any)

UnmarshalEmbeddedDefaults decodes the consumer's embedded build vocabulary (the ovmf_paths / ovmf_distro_aliases directives the OVMF resolver reads) into dst. Core reads its embedded charly.yml; the plugin reads its embedded build_defaults.yml.

View Source
var ValidateEgress func(kind, label string, data []byte) error

ValidateEgress gates a generated cloud-init document against its CUE egress schema before the bytes are emitted (RenderCloudInit in cloud_init_render.go).

Functions

func CompareGlibc

func CompareGlibc(a, b string) int

CompareGlibc returns -1 / 0 / 1 for a vs b, where each is "MAJOR.MINOR". Empty strings compare as equal (unknown vs unknown). A single-empty comparison returns 0 (treat unknown as compatible).

func DecrementSnapshotRefcount

func DecrementSnapshotRefcount(vmName, snapName string) error

DecrementSnapshotRefcount decreases the refcount. Floors at 0.

func DeleteSnapshot

func DeleteSnapshot(opts SnapshotDeleteOpts) error

DeleteSnapshot is the mode-aware deletion. Refuses while refcount > 0 unless Force is set.

func DetectHostGlibc

func DetectHostGlibc() (string, error)

DetectHostGlibc runs `ldd --version` and extracts the version. Returns "" with no error when glibc can't be detected (e.g. musl hosts) — callers should treat an empty string as "unknown, skip the preflight check".

func DetectRuntimeHostVendor

func DetectRuntimeHostVendor() string

DetectRuntimeHostVendor reads /proc/cpuinfo to identify the host CPU vendor (GenuineIntel | AuthenticAMD | ""). Used by RenderDomain / RenderQemuArgv to auto-append the correct nested-virt feature (vmx vs svm).

func EnsurePerVmNvram

func EnsurePerVmNvram(templatePath, perVmDir string) (string, error)

EnsurePerVmNvram copies the OVMF_VARS template to a per-VM NVRAM file on first use. Returns the absolute path of the per-VM NVRAM (which is what rt.NVRAMPath should be set to). Idempotent: if the per-VM file already exists, it's preserved (contains the guest's accumulated UEFI variables).

func ISOBuilderAvailable

func ISOBuilderAvailable() (name string, ok bool)

ISOBuilderAvailable reports whether any supported ISO builder is on PATH. Used by `charly doctor` to list missing VM dependencies.

func IncrementSnapshotRefcount

func IncrementSnapshotRefcount(vmName, snapName string) error

IncrementSnapshotRefcount increases the refcount on the named snapshot. Used by clone/ephemeral instantiation paths.

func InstallSignalHandler

func InstallSignalHandler()

InstallSignalHandler arms the global signal handler exactly once. Subsequent calls are no-ops. On SIGTERM/SIGINT/SIGHUP it runs the registered temp cleanups AND the registered shutdown hooks (plugin-client reaping, etc.), then re-raises the signal so the process exits with the conventional 128+signum status code.

SIGKILL is not catchable (kernel-level). Leftover temps from a SIGKILL'd charly are caught by the next invocation's SweepStaleTemps; orphaned plugin servers from a SIGKILL'd charly self-terminate via the plugin SDK's parent-death watch (see plugin/sdk/parentwatch.go).

func IsDeviceElement

func IsDeviceElement(snippet string) bool

IsDeviceElement returns true if the XML snippet's root element belongs inside <devices>.

func KeyToRootTmpfilesD

func KeyToRootTmpfilesD(pubkey string) string

KeyToRootTmpfilesD converts an SSH public key to a systemd tmpfiles.d config that creates /root/.ssh/authorized_keys. Matches bcvk's key_to_root_tmpfiles_d.

func KeyToUserTmpfilesD

func KeyToUserTmpfilesD(user, home, pubkey string) string

KeyToUserTmpfilesD generates a systemd tmpfiles.d config that delivers a per-VM SSH key for the named user. The user account itself must already exist in the rootfs (created at build time by the bootloader install template OR by cloud-init); this function only delivers the *key*, never bakes one into the image.

SMBIOS-vs-cloud-init priority: the key is written to a ROOT-owned, sshd- checked file at /etc/ssh/authorized_keys.d/<user>, and a sshd_config.d drop-in widens AuthorizedKeysFile to check BOTH ~/.ssh/authorized_keys (cloud-init's domain) AND that file. systemd-tmpfiles applies this BEFORE sshd starts, so the SMBIOS key is ALWAYS accepted even if cloud-init later rewrites the user's own authorized_keys — SMBIOS owns the drop-in location, cloud-init owns ~/.ssh, and sshd honors both. The key is ALSO written to ~/.ssh/authorized_keys as a fallback for any guest sshd that ignores the drop-in (so the key works whether or not the widened path takes effect).

The home path defaults to /home/<user> when empty.

func KillQemuByPID

func KillQemuByPID(stateDir string)

KillQemuByPID force-kills a direct-QEMU VM by the PID recorded in its state dir (the last-resort path when QMP graceful/force shutdown is unavailable). Pure OS process kill — no govmm.

func LibvirtSessionSocket

func LibvirtSessionSocket() string

LibvirtSessionSocket returns the path to the user's libvirt session socket. Modern libvirt (≥ 8.0) uses per-driver modular daemons (virtqemud-sock); legacy libvirt (< 8.0) uses the monolithic libvirt-sock. Probe the modular socket first (every current distro), fall back to legacy.

func LibvirtSessionSocketWithProbes

func LibvirtSessionSocketWithProbes() (picked string, probed []string)

func QemuSystemBinary

func QemuSystemBinary() string

QemuSystemBinary returns the architecture-appropriate QEMU binary name.

func RegisterShutdownHook

func RegisterShutdownHook(fn func())

RegisterShutdownHook registers fn to run on a catchable shutdown signal (SIGTERM/SIGINT/SIGHUP), in the signal handler, before it re-raises the signal and the process exits. It is the package-boundary seam that lets package main reap resources the vmshared signal handler cannot reference directly — notably the connected out-of-process plugin clients (providerRegistry.Close): a Ctrl-C'd / `systemctl stop`ped charly kills its plugin servers instead of orphaning them (the 77h-orphan leak). Hooks run in registration order; each MUST be best-effort and bounded (the handler is synchronous). A nil fn is a no-op.

func RegisterTempCleanup

func RegisterTempCleanup(path string)

RegisterTempCleanup registers path for cleanup on graceful shutdown (SIGTERM/SIGINT/SIGHUP). Existing `defer os.Remove(...)` callers keep working for normal exit; this is a SUPPLEMENTAL safety net for the ungraceful-but-catchable signal path. Empty path is a no-op.

func RenderCloudInit

func RenderCloudInit(spec *VmSpec, rt CloudInitRuntimeParams) (userData, metaData, networkConfig string, err error)

RenderCloudInit produces the three NoCloud seed ISO payloads from a VmSpec plus runtime parameters. Pure function — no filesystem or network calls.

- userData → written to cidata/user-data (prefixed with #cloud-config) - metaData → written to cidata/meta-data (instance-id + hostname) - networkCfg → written to cidata/network-config (optional; empty if unset)

Defaults applied automatically (D15):

  1. VmSSH.User added to users: with sudo + ssh_authorized_keys (if the key-injection channel is enabled AND SSHPublicKey != "")
  2. Minimum packages: {openssh, curl, tar} unioned with user's Packages
  3. Minimum runcmd: {systemctl enable --now sshd} prepended
  4. charly_install: NOT a cloud-init concern — the vm deploy's PrepareVenue delivers charly post-boot (auto/scp stage it; skip verifies). No charly download runcmd.
  5. VmCloudInit.Extra: raw cloud-config YAML appended as a second document (separated by ---) if non-empty

func RenderQemuArgv

func RenderQemuArgv(spec *VmSpec, rt VmRuntimeParams, paths QemuRuntimePaths) []string

RenderQemuArgv produces the full argv for `qemu-system-<arch>` from a VmSpec + VmRuntimeParams + QemuRuntimePaths. Pure function — no filesystem or process state side effects.

Covers the intersection of libvirt schema features that map cleanly to QEMU: machine, cpu (D16 defaults), firmware (D17 pflash), disks (root + seed iso D5 + additional), network (user-mode hostfwd), SMBIOS credentials (D13), RNG, balloon, qemu-guest-agent channel.

Structured libvirt features without a QEMU mapping (virtiofs, launch_security beyond SEV, PCI hostdev, graphics/spice, TPM) are skipped with a warning comment inserted via the caller's log output — this function only returns argv.

func ResolveKeyInjectionChannels

func ResolveKeyInjectionChannels(spec *VmSpec) (smbios, cloudInit bool)

ResolveKeyInjectionChannels applies the D13 auto-defaults and explicit-wins merging to produce the effective (smbios, cloudInit) toggle state for a VmSpec. Returns the booleans persisted into VmDeployState.KeyInjectionResolved.

func ResolveOvmfForSpec

func ResolveOvmfForSpec(spec *VmSpec, vmStateDir string) (codePath, nvramPath string, err error)

ResolveOvmfForSpec is a convenience wrapper: detects the host distro, picks the correct OVMF_CODE/OVMF_VARS pair for the VmSpec's firmware setting, and provisions the per-VM NVRAM file. Returns (CodePath, NVRAMPath) — the two values needed to populate VmRuntimeParams.

Returns ("", "", nil) when firmware == "bios" (BIOS boot needs no firmware images).

func ResolveVmCpus

func ResolveVmCpus(spec *VmSpec) int

ResolveVmCpus picks the spec-declared CPU count or falls back to 2.

func ResolveVmRam

func ResolveVmRam(spec *VmSpec) string

ResolveVmRam picks the spec-declared RAM or falls back to "4G".

func RevertSnapshot

func RevertSnapshot(vmName, snapName string) error

RevertSnapshot is the mode-aware revert.

func SmbiosCredForRootSSH

func SmbiosCredForRootSSH(pubkey string) string

SmbiosCredForRootSSH is preserved as a compatibility wrapper for the existing call sites in vm.go (legacy bootc paths).

func SmbiosCredForSSH

func SmbiosCredForSSH(user, home, pubkey string) string

SmbiosCredForSSH generates the SMBIOS type 11 credential string that delivers a per-VM SSH key to the named user via systemd-tmpfiles. When user == "" or user == "root", the legacy /root/.ssh path is used. Returns: "io.systemd.credential.binary:tmpfiles.extra=<base64>"

func SnapshotsRefcountSummary

func SnapshotsRefcountSummary(vmName string) string

SnapshotsRefcountSummary returns "<n> active references" or empty when zero — for human-readable status output.

func SweepStaleTemps

func SweepStaleTemps()

SweepStaleTemps removes /tmp/<prefix>* entries that are (a) NOT held open by any running process AND (b) older than sweepSafetyFloor AND (c) owned by the current user. Best-effort: never errors, never blocks. Called once from main().

func UnregisterTempCleanup

func UnregisterTempCleanup(path string)

UnregisterTempCleanup removes a path from the registry. Called by the existing defer-cleanup paths after they successfully os.Remove the file, so the registry doesn't accumulate stale entries in long- running charly processes (e.g. `charly mcp serve`).

func ValidateLibvirtSnippet

func ValidateLibvirtSnippet(snippet string) error

ValidateLibvirtSnippet checks that a string is valid XML with at least one element.

func VmDiskDir

func VmDiskDir(vmName string) string

VmDiskDir returns the per-VM directory holding a built disk image (disk.qcow2) and, for cloud_image/bootstrap/clone sources, its NoCloud seed.iso. The path is namespaced by the DISK SOURCE (the kind:vm ENTITY), so it is the shared read-only BASE every per-deploy overlay backs onto — building or creating one entity never reuses a SIBLING entity's disk or — critically — its stale seed.iso, whose embedded SSH key would mismatch this VM's own id_ed25519 and silently break the deploy's authentication.

func VmDomainIdentity added in v0.2026194.659

func VmDomainIdentity(deployName string) string

VmDomainIdentity normalizes a deploy/bundle name into the per-deploy VM DOMAIN IDENTITY — the token that keys the libvirt domain (charly-<identity>), the per-domain state dir, the managed ssh-config alias, and the ssh-port ledger entry (vm:<identity>). It is DISTINCT from the kind:vm ENTITY (the disk/spec source, resolved via the deploy's `from:` cross-ref): several distinct beds may share one entity, so keying the domain by the ENTITY collided them on one libvirt domain + one disk + one host SSH port. Keying by the DEPLOY NAME instead makes distinct beds collision-free by construction (each gets its own domain, per-deploy disk overlay, and auto-allocated port).

The normalization strips a leading "vm:" prefix and flattens the instance ("/") and nested-path (".") separators to "-", so a bare bed name maps to itself (check-builder-vm → check-builder-vm), a bundle ref maps to its VM token (vm:arch → arch), and a direct `charly vm create <entity>` (whose domain identity IS the entity) is unchanged. Both the host preresolver and candy/plugin-deploy-vm call this on the SAME deploy name, so the domain they derive always agrees.

func WriteJSON

func WriteJSON(w io.Writer, v any) error

WriteJSON encodes v as indented JSON to w (the `--json` output helper; the `charly vm snapshot list --json` path uses it).

func WriteSeedISO

func WriteSeedISO(outPath, userData, metaData, networkConfig string) error

WriteSeedISO builds a NoCloud cidata ISO at outPath. Takes the three rendered strings from RenderCloudInit (user-data, meta-data, and optional network-config) and shells out to xorriso to pack them into an ISO9660+Joliet+RockRidge image labeled cloudInitVolumeID.

The guest's cloud-init scans for a filesystem labeled "CIDATA" or "cidata" (it tries both cases) on first boot. Files inside:

user-data       — the #cloud-config YAML (required)
meta-data       — instance-id + hostname (required, can be empty)
network-config  — v2 network schema (optional)

Returns an error if xorriso isn't installed or the ISO write fails. charly doctor checks for xorriso and suggests the install package.

Types

type AURPackages

type AURPackages = spec.AUR

type AgentConfig

type AgentConfig = spec.Agent

type AliasConfig

type AliasConfig = spec.AliasConfig

type AliasYAML

type AliasYAML = spec.AliasYAML

type AlpineBootstrapDef

type AlpineBootstrapDef = spec.AlpineBootstrap

type AndroidAdbEndpoint

type AndroidAdbEndpoint = spec.AdbEndpoint

--- nested types renamed in spec (charly name != cue-def name) ---

type AndroidGoogleAccount

type AndroidGoogleAccount = spec.GoogleAccount

type AndroidSpec

type AndroidSpec = spec.AndroidSpec

type ApkPackageSpec

type ApkPackageSpec = spec.ApkPackageSpec

type BaseUserDef

type BaseUserDef = spec.BaseUser

type BootloaderDef

type BootloaderDef = spec.Bootloader

type BootstrapDef

type BootstrapDef = spec.Bootstrap

type BoxConfig

type BoxConfig = spec.BoxConfig

type BuildStageContext added in v0.2026189.748

type BuildStageContext = spec.BuildStageContext

type BuilderDef

type BuilderDef = spec.BuilderDef

type BundleNode

type BundleNode = spec.BundleNode

type CacheMountDef

type CacheMountDef = spec.CacheMount

type CandyArtifact

type CandyArtifact = spec.CandyArtifact

type CandyArtifactRewrite

type CandyArtifactRewrite = spec.CandyArtifactRewrite

type CandyCapabilities

type CandyCapabilities = spec.CandyCapabilities

type CandyPluginDecl

type CandyPluginDecl = spec.Plugin

type CandyYAML

type CandyYAML = spec.CandyYAML

type CloudInitRuntimeParams

type CloudInitRuntimeParams struct {
	// SSHPublicKey is the OpenSSH authorized_keys-format public key
	// line (e.g. "ssh-ed25519 AAAA..."). Empty when key injection is
	// disabled or when VmSSH.KeySource == "none".
	SSHPublicKey string

	// InstanceID is the stable UUIDv4 cloud-init instance-id.
	// Pinned at first VM create and persisted in VmDeployState.
	InstanceID string

	// Hostname for the guest. Defaults to the VM name when empty.
	Hostname string

	// InjectKeyViaCloudInit is the resolved D13 key_injection.cloud_init
	// channel state. When false the renderer emits no
	// ssh_authorized_keys entries even if SSHPublicKey is populated.
	InjectKeyViaCloudInit bool
}

CloudInitRuntimeParams carries the runtime-resolved state needed to render cloud-init user-data: the SSH public key to inject, the instance-id (stable UUIDv4 persisted in VmDeployState), the hostname, and whether cloud-init should inject the SSH key at all (computed from D13 auto-defaults + explicit VmKeyInjection overrides).

type CopyDef

type CopyDef = spec.Copy

type CredentialMount

type CredentialMount = spec.CredentialMount

type DataYAML

type DataYAML = spec.DataYAML

type DebootstrapDef

type DebootstrapDef = spec.Debootstrap

type DebootstrapRepo

type DebootstrapRepo = spec.DebootstrapRepo

type DeployExpose

type DeployExpose = spec.DeployExpose

type DeployProbes

type DeployProbes = spec.DeployProbes

type DeployResources

type DeployResources = spec.DeployResources

type DeploySecretConfig

type DeploySecretConfig = spec.DeploySecret

type DeployShellOverlay

type DeployShellOverlay = spec.DeployShellOverlay

type DeployStorage

type DeployStorage = spec.DeployStorage

type DeployVolumeConfig

type DeployVolumeConfig = spec.DeployVolume

type DistroDef

type DistroDef = spec.ResolvedDistro

type DistroPackages

type DistroPackages = spec.DistroPackages

type DnfConfig

type DnfConfig = spec.Dnf

type EnvDependency

type EnvDependency = spec.EnvDependency

type EphemeralLifetime

type EphemeralLifetime = spec.EphemeralLifetime

type EphemeralRuntime

type EphemeralRuntime = spec.EphemeralRuntime

type ExtractYAML

type ExtractYAML = spec.ExtractYAML

type FormatDef

type FormatDef = spec.Format

type FormatRule

type FormatRule = spec.FormatRule

type GpuSelector

type GpuSelector = spec.GpuSelector

type HooksConfig

type HooksConfig = spec.HooksConfig

type HostDistro

type HostDistro struct {
	// ID is the primary identifier, e.g. "fedora", "arch", "ubuntu",
	// "debian". Matches /etc/os-release's ID= field.
	ID string

	// VersionID is the release identifier, e.g. "43" for Fedora 43,
	// "24.04" for Ubuntu 24.04. Empty for rolling-release distros
	// (arch).
	VersionID string

	// IDLike is the list of distros this system claims compatibility
	// with, in order. Populated from ID_LIKE=; enables fallback when a
	// candy only has a parent-distro section (e.g. an ubuntu host
	// picking up a debian: section).
	IDLike []string

	// Tags is the ordered list of distro tags to use for format-section
	// matching: [exact ID+Version, ID, ID_LIKE entries]. Matches the
	// img.Distro list structure used by candy tag-section resolution.
	Tags []string
}

HostDistro identifies the host's distro for BuildDeployPlan.

func DetectHostDistro

func DetectHostDistro() (*HostDistro, error)

DetectHostDistro reads /etc/os-release and derives the structured distro identity. Errors only when /etc/os-release is unreadable.

func (*HostDistro) FormatHint

func (hd *HostDistro) FormatHint() string

FormatHint returns the best-guess format name (rpm/deb/pac) based on the host distro's ID / ID_LIKE, via the single distroIDToFormat table. Used when the caller has no DistroDef in hand (e.g. the synthetic host-adhoc image). For a resolved DistroDef, prefer DistroDef.PrimaryFormat.

func (*HostDistro) PopulateTags

func (hd *HostDistro) PopulateTags()

PopulateTags derives HostDistro.Tags from the other fields. The resulting list includes both the os-release ID (exact match for candy tag sections like `arch:`) and the embedded vocabulary's (charly/charly.yml) canonical name (for DistroConfig.ResolveDistro to find the format definitions).

func (*HostDistro) PrimaryTag

func (hd *HostDistro) PrimaryTag() string

PrimaryTag returns the first tag (most specific). Convenience for callers that want a single "best match" string.

type InitDef

type InitDef = spec.InitDef

type InstallContext added in v0.2026189.748

type InstallContext = spec.InstallContext

type InstallOptsConfig

type InstallOptsConfig = spec.InstallOptsConfig

type IterateConfig

type IterateConfig = spec.IterateConfig

type K8sDeployConfig

type K8sDeployConfig = spec.K8sDeploy

type K8sGatewayAPI

type K8sGatewayAPI = spec.K8sGatewayAPI

type K8sHostname

type K8sHostname = spec.K8sHostname

type K8sImagesDefaults

type K8sImagesDefaults = spec.K8sImagesDefaults

type K8sIngressDefaults

type K8sIngressDefaults = spec.K8sIngressDefaults

type K8sObservability

type K8sObservability = spec.K8sObservability

type K8sPatch

type K8sPatch = spec.K8sPatch

type K8sPodDefaults

type K8sPodDefaults = spec.K8sPodDefaults

type K8sResourceDefaults

type K8sResourceDefaults = spec.K8sResourceDefaults

type K8sResourceValues

type K8sResourceValues = spec.K8sResourceValues

type K8sResources

type K8sResources = spec.K8sResources

type K8sSecretsBackend

type K8sSecretsBackend = spec.K8sSecretsBackend

type K8sSpec

type K8sSpec = spec.K8sSpec

type K8sStorage

type K8sStorage = spec.K8sStorage

type LibvirtAudio

type LibvirtAudio = spec.LibvirtAudio

type LibvirtCPU

type LibvirtCPU = spec.LibvirtCPU

type LibvirtCPUCache

type LibvirtCPUCache = spec.LibvirtCPUCache

type LibvirtCPUFeature

type LibvirtCPUFeature = spec.LibvirtCPUFeature

type LibvirtCPUTopology

type LibvirtCPUTopology = spec.LibvirtCPUTopology

type LibvirtCPUTune

type LibvirtCPUTune = spec.LibvirtCPUTune

type LibvirtChannel

type LibvirtChannel = spec.LibvirtChannel

type LibvirtClock

type LibvirtClock = spec.LibvirtClock

type LibvirtConsole

type LibvirtConsole = spec.LibvirtConsole

type LibvirtDevices

type LibvirtDevices = spec.LibvirtDevices

type LibvirtDisk

type LibvirtDisk = spec.LibvirtDisk

type LibvirtDomain

type LibvirtDomain = spec.LibvirtDomain

type LibvirtEmulatorPin

type LibvirtEmulatorPin = spec.LibvirtEmulatorPin

type LibvirtFeatures

type LibvirtFeatures = spec.LibvirtFeatures

type LibvirtFilesystem

type LibvirtFilesystem = spec.LibvirtFilesystem

type LibvirtGraphics

type LibvirtGraphics = spec.LibvirtGraphics

type LibvirtGraphicsListen

type LibvirtGraphicsListen = spec.LibvirtGraphicsListen

type LibvirtGraphicsListeners

type LibvirtGraphicsListeners = spec.LibvirtGraphicsListeners

type LibvirtHostdev

type LibvirtHostdev = spec.LibvirtHostdev

type LibvirtHub

type LibvirtHub = spec.LibvirtHub

type LibvirtHugepages

type LibvirtHugepages = spec.LibvirtHugepages

type LibvirtHyperV

type LibvirtHyperV = spec.LibvirtHyperV

type LibvirtIOMMU

type LibvirtIOMMU = spec.LibvirtIOMMU

type LibvirtIOThreadPin

type LibvirtIOThreadPin = spec.LibvirtIOThreadPin

type LibvirtInput

type LibvirtInput = spec.LibvirtInput

type LibvirtInterface

type LibvirtInterface = spec.LibvirtInterface

type LibvirtKVM

type LibvirtKVM = spec.LibvirtKVM

type LibvirtLaunchSecurity

type LibvirtLaunchSecurity = spec.LibvirtLaunchSecurity

type LibvirtMemBalloon

type LibvirtMemBalloon = spec.LibvirtMemBalloon

type LibvirtMemTune

type LibvirtMemTune = spec.LibvirtMemTune

type LibvirtMemnode

type LibvirtMemnode = spec.LibvirtMemnode

type LibvirtMemoryBacking

type LibvirtMemoryBacking = spec.LibvirtMemoryBacking

type LibvirtNUMACell

type LibvirtNUMACell = spec.LibvirtNUMACell

type LibvirtNUMAMemory

type LibvirtNUMAMemory = spec.LibvirtNUMAMemory

type LibvirtNUMATune

type LibvirtNUMATune = spec.LibvirtNUMATune

type LibvirtPanic

type LibvirtPanic = spec.LibvirtPanic

type LibvirtParallel

type LibvirtParallel = spec.LibvirtParallel

type LibvirtPortForward

type LibvirtPortForward = spec.LibvirtPortForward

type LibvirtRNG

type LibvirtRNG = spec.LibvirtRNG

type LibvirtRedirDev

type LibvirtRedirDev = spec.LibvirtRedirDev

type LibvirtResource

type LibvirtResource = spec.LibvirtResource

type LibvirtSecLabel

type LibvirtSecLabel = spec.LibvirtSecLabel

type LibvirtSerial

type LibvirtSerial = spec.LibvirtSerial

type LibvirtShmem

type LibvirtShmem = spec.LibvirtShmem

type LibvirtSmartcard

type LibvirtSmartcard = spec.LibvirtSmartcard

type LibvirtSound

type LibvirtSound = spec.LibvirtSound

type LibvirtSpinlocks

type LibvirtSpinlocks = spec.LibvirtSpinlocks

type LibvirtSysInfo

type LibvirtSysInfo = spec.LibvirtSysInfo

type LibvirtTPM

type LibvirtTPM = spec.LibvirtTPM

type LibvirtTimer

type LibvirtTimer = spec.LibvirtTimer

type LibvirtURI

type LibvirtURI struct {
	// Mode is "session" (currently the only supported value).
	Mode string

	// Remote is the SSH target when scheme is qemu+ssh://. Zero
	// value means local (qemu:///session).
	Remote SSHTarget

	// Raw is the original URI string for error messages.
	Raw string
}

LibvirtURI is the parsed form of an `charly --uri …` value.

func ParseLibvirtURI

func ParseLibvirtURI(s string) (LibvirtURI, error)

ParseLibvirtURI handles the four recognized shapes. Empty / missing URI returns a local-session value; invalid URIs return an error.

func (LibvirtURI) IsLocal

func (u LibvirtURI) IsLocal() bool

IsLocal reports whether the URI targets the local libvirt session. Equivalent to len(u.Remote.Host) == 0.

type LibvirtUSB

type LibvirtUSB = spec.LibvirtUSB

type LibvirtVCPUPin

type LibvirtVCPUPin = spec.LibvirtVCPUPin

type LibvirtVendorID

type LibvirtVendorID = spec.LibvirtVendorID

type LibvirtVideo

type LibvirtVideo = spec.LibvirtVideo

type LibvirtVsock

type LibvirtVsock = spec.LibvirtVsock

type LibvirtWatchdog

type LibvirtWatchdog = spec.LibvirtWatchdog

type LocalPkgDef

type LocalPkgDef = spec.LocalPkg

type LocalSpec

type LocalSpec = spec.LocalSpec

type MCPServerYAML

type MCPServerYAML = spec.MCPServerYAML

type Matcher

type Matcher = spec.Matcher

type MatcherList

type MatcherList = spec.MatcherList

type MergeConfig

type MergeConfig = spec.MergeConfig

type Op

type Op = spec.Op

type OvmfPaths

type OvmfPaths struct {
	// CodePath is the OVMF_CODE firmware image. Read-only.
	CodePath string

	// VarsTemplate is the OVMF_VARS template with standard UEFI CA
	// keys pre-enrolled (when secure=true). The per-VM NVRAM file is
	// copied from this template on first VM create.
	VarsTemplate string

	// Secure indicates whether this is the secure-boot-enabled variant.
	Secure bool
}

OvmfPaths is the pair of firmware image paths needed to boot a UEFI VM: OVMF_CODE (read-only, shared across all VMs) and an OVMF_VARS template (read-only, copied to a per-VM writable NVRAM file on first VM create).

func ResolveOvmfPaths

func ResolveOvmfPaths(distroID string, secure bool) (OvmfPaths, error)

ResolveOvmfPaths picks the correct OVMF_CODE + OVMF_VARS paths for the host distro + secure-boot setting. Returns an error when no candidate path exists on disk so `charly vm create` fails with a clean remediation hint instead of a cryptic QEMU pflash error.

D17 path table:

Fedora         /usr/share/OVMF/OVMF_CODE{.secboot,}.fd
               /usr/share/OVMF/OVMF_VARS{.secboot,}.fd
Arch           /usr/share/edk2/x64/OVMF_CODE{.secboot,}.4m.fd
               /usr/share/edk2/x64/OVMF_VARS.4m.fd
Debian/Ubuntu  /usr/share/OVMF/OVMF_CODE_4M{.ms,}.fd
               /usr/share/OVMF/OVMF_VARS_4M{.ms,}.fd

type PackageItem

type PackageItem = spec.PackageItem

type PacstrapDef

type PacstrapDef = spec.Pacstrap

type PacstrapRepo

type PacstrapRepo = spec.PacstrapRepo

type PhaseSet

type PhaseSet = spec.PhaseSet

type PhaseTemplates

type PhaseTemplates = spec.PhaseTemplates

type PodSpec

type PodSpec = spec.PodSpec

type PollClass

type PollClass int

PollClass selects the tick-interval band only (never the deadline). Local = in-process/loopback probes (podman exec, libvirt domain-state, supervisord); Remote = one-ssh/network-round-trip probes; Heavy = full-suite subprocess probes (each tick runs a whole `charly check live` pass).

const (
	PollLocal PollClass = iota
	PollRemote
	PollHeavy
)

type PollCondition

type PollCondition func(ctx context.Context) (ready bool, progress float64, err error)

PollCondition is the caller's readiness probe, invoked once per tick under a per-attempt timeout context.

ready    — the awaited state is reached; pollUntil returns nil.
progress — a MONOTONIC forward-motion score (higher == more progress, e.g. a
           count or an AI score). The no-progress watchdog resets only when
           this reaches a NEW HIGH-WATER value, so oscillation/regression
           cannot masquerade as progress. Ignored in cap-only mode
           (NoProgress<=0) — pass 0 for binary/edge sites.
err      — wrap ErrPollFatal to abort IMMEDIATELY (unrecoverable: process
           died, auth/permission error). Any other non-nil err is transient
           (target not up yet): routed to OnTransient, treated as not-ready,
           and does NOT advance the high-water mark.

type PollConfig

type PollConfig struct {
	Name        string        // label woven into log lines + errors, e.g. "ssh-ready check-k3s-vm"
	Interval    time.Duration // tick cadence (pacing only; never the deadline). >0 required.
	PerAttempt  time.Duration // per-cond context timeout (the never-hang kill-switch for a blocking probe). >0 required.
	NoProgress  time.Duration // monotonic stall window; 0 disables (cap-only mode).
	AbsoluteCap time.Duration // generous never-hang ceiling; 0 means "no cap" (NoProgress must then be >0).

	// OnTick (optional) is host-side observability per tick. NEVER AI-visible
	// (matches check_watchdog.go doctrine). sinceAdvance is time since the last
	// high-water advance (0 in cap-only mode).
	OnTick func(elapsed time.Duration, progress float64, sinceAdvance time.Duration)
	// OnTransient (optional) receives each transient (non-fatal) cond error.
	OnTransient func(err error)
	// contains filtered or unexported fields
}

PollConfig parameterizes one pollUntil call. Build it via ResolvedReadiness's Wait / WaitCapped / StopGate so no call site carries a magic literal.

type PortScope

type PortScope = spec.PortScope

type PortSpec

type PortSpec = spec.PortSpec

type PreemptibleConfig

type PreemptibleConfig = spec.PreemptibleConfig

type QemuRuntimePaths

type QemuRuntimePaths struct {
	// MonitorSocket — unix socket for the QEMU monitor (`-monitor`).
	MonitorSocket string

	// QmpSocket — unix socket for QMP (`-qmp`).
	QmpSocket string

	// ConsoleSocket — unix socket for the serial console (`-serial`).
	ConsoleSocket string

	// PidFile — `-pidfile` target.
	PidFile string
}

QemuRuntimePaths carries backend-specific paths that QEMU needs but libvirt doesn't (socket paths, pidfile). Composed with VmRuntimeParams when the QEMU backend renders its argv.

type ReadinessConfig

type ReadinessConfig = spec.ReadinessConfig

type ResolvedReadiness

type ResolvedReadiness struct {
	IntervalLocal   time.Duration
	IntervalRemote  time.Duration
	IntervalHeavy   time.Duration
	PerAttempt      time.Duration
	PerAttemptHeavy time.Duration
	NoProgress      time.Duration
	AbsoluteCap     time.Duration
	StopGrace       time.Duration
}

ResolvedReadiness is the load-time-materialized, validated bounds set (resolveReadiness in build.go merges flag/env → defaults.readiness → the named fallback constants, then ReadinessConfig.Validate enforces ordering). The zero value is SAFE — every builder falls back to the compiled-in fallback constants — so a site that has not yet been threaded the resolved set still gets sane, never-hang bounds (it just isn't operator-tunable until threaded).

func ResolveReadiness

func ResolveReadiness(rc *ReadinessConfig) (ResolvedReadiness, error)

ResolveReadiness materializes the validated ResolvedReadiness from a `defaults.readiness:` block plus CHARLY_READINESS_* env overrides plus the named fallbacks. Nil-safe (nil → all fallbacks/env). The SINGLE resolver — charly core (loadedReadiness, from the project config) AND the out-of-process plugins (nil + the host-threaded env) both call it.

func (ResolvedReadiness) PerAttemptFor

func (rr ResolvedReadiness) PerAttemptFor(class PollClass) time.Duration

PerAttemptFor returns the effective per-attempt never-hang bound for a poll class (the field value, or the built-in fallback when unset).

func (ResolvedReadiness) PluginEnv

func (rr ResolvedReadiness) PluginEnv() []string

PluginEnv emits the CHARLY_READINESS_* entries (KEY=VALUE) for this RESOLVED readiness, so an out-of-process plugin — which cannot LoadUnified — re-reads the host-resolved bounds via its own ResolveReadiness. The host appends these to a plugin's spawn env (charly's LocalTransport.Connect). Durations round-trip through String() ⟷ resolveReadinessDuration.

func (ResolvedReadiness) StopGate

func (rr ResolvedReadiness) StopGate(name string) PollConfig

StopGate builds a settle/teardown PollConfig: cap-only at StopGrace (a clean timeout for the binary "is it down yet?" — the caller performs the force fallback on ErrPollCapExceeded). Replaces the 60s/180s/10s stop magic numbers with one config-sourced grace; no 2× multiplier.

func (ResolvedReadiness) ValidateOrdering

func (rr ResolvedReadiness) ValidateOrdering() error

ValidateOrdering enforces the bound ordering on the RESOLVED set (must run post-env, not on the raw YAML — an env override must not slip a bad bound through): each interval <= no_progress; no_progress <= absolute_cap; poll_interval_local <= stop_grace <= absolute_cap.

func (ResolvedReadiness) Wait

func (rr ResolvedReadiness) Wait(name string, class PollClass) PollConfig

Wait builds a MONOTONIC readiness PollConfig: the no-progress watchdog is active (the load-robust early-out), with a generous absolute cap as the never-hang backstop. Use ONLY where cond reports a genuinely advancing high-water progress score (supervisord settled-count, check-live pass tally, AI score). For binary/edge markers use WaitCapped instead.

func (ResolvedReadiness) WaitCapped

func (rr ResolvedReadiness) WaitCapped(name string, class PollClass, cap time.Duration) PollConfig

WaitCapped builds a CAP-ONLY PollConfig (NoProgress disabled): wait until cond is ready or the generous cap elapses. Use for BINARY/EDGE readiness (ssh-up, boot_id, cloud-init-done, file-present, channel-up) where the marker is frozen until the end, AND for AUTHOR/CALLER-declared deadlines (eventually:, WaitSeconds, guest-exec maxWait) which must be preserved exactly. cap<=0 falls back to the generous config absolute_cap.

func (ResolvedReadiness) WatchProgress

func (rr ResolvedReadiness) WatchProgress(name string, class PollClass, noProgress time.Duration) PollConfig

WatchProgress builds a NO-CAP monotonic watchdog (NoProgress active, no absolute cap) for an intentionally unbounded long-runner: the AI iteration loop, whose run must NOT be killed at a wall-clock cap as long as the score keeps improving. noProgress<=0 falls back to the config no_progress.

type ResourceDef

type ResourceDef = spec.ResourceDef

type RouteYAML

type RouteYAML = spec.RouteYAML

type SSHTarget

type SSHTarget struct {
	User string
	Host string
	Port int
}

SSHTarget is the parsed form of an ssh-style target string. Examples:

  • "host" → {User: $USER, Host: "host", Port: 22}
  • "user@host" → {User: "user", Host: "host", Port: 22}
  • "user@host:2222" → {User: "user", Host: "host", Port: 2222}
  • "qemu+ssh://user@host/…" → parsed via ParseLibvirtSSHURI (not here)

func ParseSSHTarget

func ParseSSHTarget(s string) (SSHTarget, error)

ParseSSHTarget accepts "[user@]host[:port]" and fills defaults:

  • User: $USER
  • Port: 22

func (SSHTarget) String

func (t SSHTarget) String() string

String renders the canonical "user@host:port" form.

type SecretYAML

type SecretYAML = spec.SecretYAML

type SecurityConfig

type SecurityConfig = spec.SecurityConfig

type ServiceEntry

type ServiceEntry = spec.ServiceEntry

type ServiceOverrides

type ServiceOverrides = spec.CandyServiceOverrides

type ServiceSchemaDef

type ServiceSchemaDef = spec.InitServiceSchema

type ShellConfig

type ShellConfig = spec.Shell

type ShellSpec

type ShellSpec = spec.ShellSpec

type SidecarConfig

type SidecarConfig = spec.PodSidecar

type SidecarDef

type SidecarDef = spec.SidecarDef

type SidecarSecret

type SidecarSecret = spec.SidecarSecret

type SidecarVolume

type SidecarVolume = spec.SidecarVolume

type SnapshotCreateOpts

type SnapshotCreateOpts struct {
	// VmName is the kind:vm entity name (without charly- prefix).
	VmName string

	// SnapName is the new snapshot's name.
	SnapName string

	// Mode is "external" or "internal" — empty defaults to external.
	Mode string

	// Description is an optional human note.
	Description string

	// Quiesce, when true, requests guest-agent fsfreeze before
	// snapshotting (with libvirt's plain freeze as fallback).
	Quiesce bool

	// LibvirtBackend, when non-nil, overrides the auto-detected backend.
	// Default: probe via existing resolveVmBackend.
	LibvirtBackend string
}

SnapshotCreateOpts parameterizes the creation of a snapshot.

type SnapshotDeleteOpts

type SnapshotDeleteOpts struct {
	VmName   string
	SnapName string
	// Force allows deletion even when refcount > 0. Default false.
	// Recommended only when the consuming clones/ephemerals have
	// already been destroyed and the registry is stale.
	Force bool
}

SnapshotDeleteOpts parameterizes deletion.

type SnapshotEntry

type SnapshotEntry struct {
	// Name uniquely identifies the snapshot within this VM.
	Name string `json:"name"`

	// Mode is "external" or "internal".
	Mode string `json:"mode"`

	// LibvirtName is the snapshot's name as known to libvirt. For
	// external mode, libvirt registers the snapshot as a domain
	// snapshot and we store the libvirt-side identifier here. For
	// internal mode, this matches Name (qemu-img embeds the literal
	// name).
	LibvirtName string `json:"libvirt_name,omitempty"`

	// DiskPath is the absolute path to the external snapshot file.
	// Empty for internal-mode snapshots.
	DiskPath string `json:"disk_path,omitempty"`

	// Description carries the operator-supplied note.
	Description string `json:"description,omitempty"`

	// Created is the RFC3339 creation timestamp.
	Created string `json:"created,omitempty"`

	// Parent is the prior snapshot in the implicit chain at create
	// time (whichever was current then). Informational; helps trace
	// backing-chain ancestry.
	Parent string `json:"parent,omitempty"`

	// Refcount tracks active clones / ephemerals depending on this
	// snapshot. delete refuses while > 0.
	Refcount int `json:"refcount"`

	// Quiesced records whether the snapshot was taken with guest-agent
	// fsfreeze active. Informational; helps an operator decide
	// whether the snapshot is consistent.
	Quiesced bool `json:"quiesced,omitempty"`
}

SnapshotEntry is one snapshot record. Mirrors VmSnapshotState plus on-disk-only fields (the registry is internal; VmSnapshotState is the charly.yml-facing mirror).

func CreateSnapshot

func CreateSnapshot(opts SnapshotCreateOpts) (*SnapshotEntry, error)

CreateSnapshot is the mode-aware orchestrator for `charly vm snapshot create`. Looks up the active VM, dispatches to the matching mode- specific implementation, and records the result in registry.json + meta.json.

func ListSnapshots

func ListSnapshots(vmName string) ([]*SnapshotEntry, error)

ListSnapshots returns the snapshots for a VM as a name-sorted slice.

func LookupSnapshot

func LookupSnapshot(vmName, snapName string) (*SnapshotEntry, error)

LookupSnapshot returns a snapshot entry by name or an error.

func PromoteSnapshot

func PromoteSnapshot(vmName, snapName string) (*SnapshotEntry, error)

PromoteSnapshot converts an internal snapshot to external mode by extracting it via `qemu-img convert` to a new qcow2 file in the snapshots directory. After promotion, the snapshot is usable as a clone backing target. The internal snapshot inside the primary qcow2 is left in place — promote is non-destructive.

type SnapshotRegistry

type SnapshotRegistry struct {
	// Version is the registry schema version. V1 is the initial release.
	Version int `json:"version"`

	// Snapshots is the unified set of snapshots known to charly for this
	// VM, keyed by Name. Both modes appear here.
	Snapshots map[string]*SnapshotEntry `json:"snapshots"`
}

SnapshotRegistry is the on-disk schema for snapshots/registry.json. Versioned so future shape evolutions can migrate cleanly.

type Step

type Step = spec.Step

type StepKeyword

type StepKeyword = spec.StepKeyword

type TunnelYAML

type TunnelYAML = spec.TunnelYAML

type VmCharlyInstall

type VmCharlyInstall = spec.VmCharlyInstall

type VmChecksum

type VmChecksum = spec.VmChecksum

type VmCloudInit

type VmCloudInit = spec.VmCloudInit

type VmCloudInitFile

type VmCloudInitFile = spec.VmCloudInitFile

type VmCloudInitMirrors

type VmCloudInitMirrors = spec.VmCloudInitMirrors

type VmCloudInitNetwork

type VmCloudInitNetwork = spec.VmCloudInitNetwork

type VmCloudInitUser

type VmCloudInitUser = spec.VmCloudInitUser

type VmDeployState

type VmDeployState = spec.VmDeployState

type VmKeyInjection

type VmKeyInjection = spec.VmKeyInjection

type VmKeyInjectionResolved

type VmKeyInjectionResolved = spec.VmKeyInjectionResolved

type VmNetwork

type VmNetwork = spec.VmNetwork

type VmRuntimeParams

type VmRuntimeParams struct {
	// Name is the libvirt domain name / QEMU process handle.
	Name string

	// QCOW2Path is the absolute path to the VM's root qcow2 disk.
	QCOW2Path string

	// SeedISOPath is the absolute path to the NoCloud cidata ISO.
	// Empty → no cdrom attached (bootc source with cloud-init disabled).
	SeedISOPath string

	// NVRAMPath is the absolute path to the per-VM UEFI NVRAM file.
	// Empty → firmware: bios (no pflash drives emitted).
	NVRAMPath string

	// OVMFCodePath is the absolute path to the OVMF_CODE firmware image.
	// Required when Firmware == "uefi-*"; empty when bios.
	OVMFCodePath string

	// HostArch is the host architecture string (e.g. "x86_64", "aarch64").
	HostArch string

	// HostCPUVendor is "GenuineIntel" | "AuthenticAMD" | "". Used to
	// auto-append +vmx or +svm in resolveCPUDefaults when mode defaults
	// to host-passthrough and the user hasn't explicitly disabled nested
	// virt.
	HostCPUVendor string

	// SMBIOSCredentials are pre-formatted systemd-credential oemString
	// entries (e.g. "io.systemd.credential.binary:tmpfiles.extra=<b64>").
	SMBIOSCredentials []string

	// RamMB is the resolved RAM in MiB (VmSpec.Ram parsed).
	RamMB int

	// Cpus is the resolved vCPU count (VmSpec.Cpus with defaults applied).
	Cpus int

	// SshPort is the host port forwarded to guest :22.
	SshPort int

	// ExtraPortForwards are additional "host:guest" TCP forwards on
	// top of the SSH port. Used with user-mode networking.
	ExtraPortForwards []string

	// VmStateDir is the absolute path to the per-VM state directory
	// (~/.local/share/charly/vm/charly-<name>/). Used by the libvirt YAML
	// bridge to expand `{{.VmStateDir}}` template references in
	// path-bearing libvirt attributes (channel <source path=>,
	// graphics socket paths). Populated by the create-time caller
	// (vm_create_spec.go::runVmSpecCreate) so author-supplied paths
	// stay portable across users without hardcoded /home/<x>.
	VmStateDir string
}

VmRuntimeParams carries the runtime-resolved state that the libvirt-XML and QEMU-argv emitters need but isn't in the author's VmSpec: the VM name, disk paths, SSH pubkey, host architecture, host CPU vendor, etc. Both RenderDomainXML (libvirt) and RenderQEMUArgs (qemu) consume the same struct so the "rendered from a common source" invariant is preserved.

type VmSSH

type VmSSH = spec.VmSSH

type VmSnapshotDecl

type VmSnapshotDecl = spec.VmSnapshotDecl

type VmSnapshotState

type VmSnapshotState = spec.VmSnapshotState

func MirrorSnapshotsToDeployState

func MirrorSnapshotsToDeployState(vmName string) ([]VmSnapshotState, error)

MirrorSnapshotsToDeployState copies the registry into a slice of VmSnapshotState records suitable for embedding in charly.yml's vm_state. Sorted by name for stable diffs.

type VmSource

type VmSource = spec.VmSource

type VmSpec

type VmSpec = spec.ResolvedVm

type VolumeYAML

type VolumeYAML = spec.VolumeYAML

Jump to

Keyboard shortcuts

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