Documentation
¶
Overview ¶
Package shimconfig defines the configuration types shared between the hypeman API server and the vz-shim subprocess.
Index ¶
Constants ¶
const ( // SnapshotManifestFile is the metadata file stored in snapshot directories. // Kept as config.json to match existing snapshot path conventions. SnapshotManifestFile = "config.json" // SnapshotMachineStateFile is the serialized VM machine state filename. SnapshotMachineStateFile = "machine-state.vzm" // StopReceiptFile is written in the instance directory when a macOS guest stops // its VM itself. StopReceiptFile = "vz-guest-stopped" )
const RosettaMountTag = "rosetta"
RosettaMountTag is the virtio-fs tag for the Rosetta directory share. The host (vz-shim) attaches the share under this tag and the guest (init) mounts it by the same tag, so the value is a shared constant rather than a wire field. This file carries no build constraint so the Linux-built guest init can reference the tag while the rest of the package stays darwin-only.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiskConfig ¶ added in v0.4.0
type DiskConfig struct {
Path string `json:"path"`
Readonly bool `json:"readonly"`
// Parents, when set, are the read-only images below Path, base first; Path is
// then the ASIF overlay on top of them.
Parents []string `json:"parents,omitempty"`
}
DiskConfig represents a disk attached to the VM.
type NetworkConfig ¶ added in v0.4.0
type NetworkConfig struct {
MAC string `json:"mac"`
// IPv4Subnet and IPv4Address, when set, give the guest its own vmnet network with
// a DHCP reservation for MAC. Otherwise the guest uses vmnet's shared NAT.
IPv4Subnet string `json:"ipv4_subnet,omitempty"`
IPv4Address string `json:"ipv4_address,omitempty"`
}
NetworkConfig represents a network interface.
type ShimConfig ¶ added in v0.4.0
type ShimConfig struct {
// Compute resources
VCPUs int `json:"vcpus"`
MemoryBytes int64 `json:"memory_bytes"`
// Storage
Disks []DiskConfig `json:"disks"`
// Network
Networks []NetworkConfig `json:"networks"`
// Console
SerialLogPath string `json:"serial_log_path"`
// Boot configuration
KernelPath string `json:"kernel_path"`
InitrdPath string `json:"initrd_path"`
KernelArgs string `json:"kernel_args"`
// macOS boot mode: all three fields must be supplied together.
MacHardwareModelData string `json:"mac_hardware_model_data,omitempty"`
MacMachineIdentifierData string `json:"mac_machine_identifier_data,omitempty"`
MacAuxStoragePath string `json:"mac_aux_storage_path,omitempty"`
// Guest memory reclaim
EnableMemoryBalloon bool `json:"enable_memory_balloon,omitempty"`
RequireMemoryBalloon bool `json:"require_memory_balloon,omitempty"`
// EnableRosetta attaches a Linux Rosetta virtio-fs share (tag
// RosettaMountTag) so the guest can execute x86-64 binaries. Apple silicon
// only; the shim errors if the host does not support it.
EnableRosetta bool `json:"enable_rosetta,omitempty"`
// Socket paths (where shim should listen)
ControlSocket string `json:"control_socket"`
VsockSocket string `json:"vsock_socket"`
// Logging
LogPath string `json:"log_path"`
// StopReceiptPath, when set, is written once the guest stops the VM itself, as
// after an orderly power-off. A stop the shim forces does not write it.
StopReceiptPath string `json:"stop_receipt_path,omitempty"`
// Generic machine identifier data representation (base64), used to keep
// platform identity stable across save/restore.
MachineIdentifierData string `json:"machine_identifier_data,omitempty"`
// Optional restore source (snapshot machine state file path).
// When set, the shim restores instead of starting from cold boot.
RestoreMachineStatePath string `json:"restore_machine_state_path,omitempty"`
}
ShimConfig is the configuration passed from hypeman to the shim.
type SnapshotManifest ¶ added in v0.4.0
type SnapshotManifest struct {
Hypervisor string `json:"hypervisor"`
MachineStateFile string `json:"machine_state_file"`
ShimConfig ShimConfig `json:"shim_config"`
}
SnapshotManifest is persisted in snapshot directories to allow restore.