{"modulePath":"github.com/kernel/hypeman","version":"v0.4.0","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package cloudhypervisor\n\nPackage cloudhypervisor implements the hypervisor.Hypervisor interface for Cloud Hypervisor VMM.\n\n## Functions\n\n```go\nfunc CapabilitiesForVersion(v vmm.CHVersion) hypervisor.Capabilities\n```\nCapabilitiesForVersion returns capabilities for a specific CH version. Use version-specific capabilities when new features are introduced that aren't supported on previous versions.\n\n```go\nfunc GetDefaultVersion() vmm.CHVersion\n```\nGetDefaultVersion returns the configured default, falling back to vmm.DefaultVersion if no override is set.\n\n```go\nfunc NewVsockDialer(vsockSocket string, vsockCID int64) hypervisor.VsockDialer\n```\nNewVsockDialer creates a new VsockDialer for Cloud Hypervisor. The vsockSocket parameter is the path to the Unix socket file. The vsockCID parameter is unused for Cloud Hypervisor (it uses socket path instead).\n\n```go\nfunc SetDefaultVersion(v string) error\n```\nSetDefaultVersion overrides the default Cloud Hypervisor version for new instances. An empty string clears the override (vmm.DefaultVersion is used). Returns an error if the version is non-empty and not in SupportedVersions.\n\n```go\nfunc ToVMConfig(cfg hypervisor.VMConfig) vmm.VmConfig\n```\nToVMConfig converts hypervisor.VMConfig to Cloud Hypervisor's vmm.VmConfig.\n\n## Types\n\n```go\ntype CloudHypervisor struct {\n\t// contains filtered or unexported fields\n}\n```\nCloudHypervisor implements hypervisor.Hypervisor for Cloud Hypervisor VMM.\n\n```go\nfunc New(socketPath string) (*CloudHypervisor, error)\n```\nNew creates a new Cloud Hypervisor client for an existing VMM socket.\n\n```go\nfunc (c *CloudHypervisor) Capabilities() hypervisor.Capabilities\n```\nCapabilities returns the features supported by Cloud Hypervisor.\n\n```go\nfunc (c *CloudHypervisor) DeleteVM(ctx context.Context) error\n```\nDeleteVM removes the VM configuration from Cloud Hypervisor.\n\n```go\nfunc (c *CloudHypervisor) GetTargetGuestMemoryBytes(ctx context.Context) (int64, error)\n```\n\n```go\nfunc (c *CloudHypervisor) GetVMInfo(ctx context.Context) (*hypervisor.VMInfo, error)\n```\nGetVMInfo returns current VM state.\n\n```go\nfunc (c *CloudHypervisor) Pause(ctx context.Context) error\n```\nPause suspends VM execution.\n\n```go\nfunc (c *CloudHypervisor) ResizeMemory(ctx context.Context, bytes int64) error\n```\nResizeMemory changes the VM's memory allocation.\n\n```go\nfunc (c *CloudHypervisor) ResizeMemoryAndWait(ctx context.Context, bytes int64, timeout time.Duration) error\n```\nResizeMemoryAndWait changes the VM's memory allocation and waits for it to stabilize. It polls until the actual memory size stabilizes (stops changing) or timeout is reached.\n\n```go\nfunc (c *CloudHypervisor) Resume(ctx context.Context) error\n```\nResume continues VM execution.\n\n```go\nfunc (c *CloudHypervisor) SetTargetGuestMemoryBytes(ctx context.Context, bytes int64) error\n```\n\n```go\nfunc (c *CloudHypervisor) Shutdown(ctx context.Context) error\n```\nShutdown stops the VMM process gracefully.\n\n```go\nfunc (c *CloudHypervisor) Snapshot(ctx context.Context, destPath string) error\n```\nSnapshot creates a VM snapshot.\n\n```go\ntype Starter struct{}\n```\nStarter implements hypervisor.VMStarter for Cloud Hypervisor.\n\n```go\nfunc NewStarter() *Starter\n```\nNewStarter creates a new Cloud Hypervisor starter.\n\n```go\nfunc (s *Starter) GetBinaryPath(p *paths.Paths, version string) (string, error)\n```\nGetBinaryPath returns the path to the Cloud Hypervisor binary.\n\n```go\nfunc (s *Starter) GetVersion(p *paths.Paths) (string, error)\n```\nGetVersion returns the configured default Cloud Hypervisor version. This controls which version is used for new instances; existing instances use the version stored in their metadata.\n\n```go\nfunc (s *Starter) PrepareFork(ctx context.Context, req hypervisor.ForkPrepareRequest) (hypervisor.ForkPrepareResult, error)\n```\nPrepareFork prepares cloud-hypervisor fork state by rewriting snapshot config when a snapshot path is provided. For stopped forks (no snapshot), this is a no-op.\n\n```go\nfunc (s *Starter) ResolveVersion(p *paths.Paths, requested string) (string, error)\n```\n\n```go\nfunc (s *Starter) RestoreVM(ctx context.Context, p *paths.Paths, version string, socketPath string, snapshotPath string) (int, hypervisor.Hypervisor, error)\n```\nRestoreVM starts Cloud Hypervisor and restores VM state from a snapshot. The VM is in paused state after restore; caller should call Resume() to continue execution.\n\n```go\nfunc (s *Starter) SocketName() string\n```\nSocketName returns the socket filename for Cloud Hypervisor.\n\n```go\nfunc (s *Starter) StartVM(ctx context.Context, p *paths.Paths, version string, socketPath string, config hypervisor.VMConfig) (int, hypervisor.Hypervisor, error)\n```\nStartVM launches Cloud Hypervisor, configures the VM, and boots it. Returns the process ID and a Hypervisor client for subsequent operations.\n\n```go\nfunc (s *Starter) ValidateConfig(config hypervisor.VMConfig) error\n```\n\n```go\ntype VsockDialer struct {\n\t// contains filtered or unexported fields\n}\n```\nVsockDialer implements hypervisor.VsockDialer for Cloud Hypervisor. Cloud Hypervisor exposes vsock through a Unix socket file with a text-based handshake protocol (CONNECT {port}\\\\n / OK ...).\n\n```go\nfunc (d *VsockDialer) DialVsock(ctx context.Context, port int) (net.Conn, error)\n```\nDialVsock connects to the guest on the specified port. It connects to the Cloud Hypervisor Unix socket and performs the handshake protocol.\n\n```go\nfunc (d *VsockDialer) Key() string\n```\nKey returns a unique identifier for this dialer, used for connection pooling.\n\n","path":"github.com/kernel/hypeman/lib/hypervisor/cloudhypervisor","name":"cloudhypervisor","synopsis":"Package cloudhypervisor implements the hypervisor.Hypervisor interface for Cloud Hypervisor VMM.","isRedistributable":true}
