cloudhypervisor

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: 13 Imported by: 0

Documentation

Overview

Package cloudhypervisor implements the hypervisor.Hypervisor interface for Cloud Hypervisor VMM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewVsockDialer

func NewVsockDialer(vsockSocket string, vsockCID int64) hypervisor.VsockDialer

NewVsockDialer 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).

func ToVMConfig

func ToVMConfig(cfg hypervisor.VMConfig) vmm.VmConfig

ToVMConfig converts hypervisor.VMConfig to Cloud Hypervisor's vmm.VmConfig.

Types

type CloudHypervisor

type CloudHypervisor struct {
	// contains filtered or unexported fields
}

CloudHypervisor implements hypervisor.Hypervisor for Cloud Hypervisor VMM.

func New

func New(socketPath string) (*CloudHypervisor, error)

New creates a new Cloud Hypervisor client for an existing VMM socket.

func (*CloudHypervisor) Capabilities

func (c *CloudHypervisor) Capabilities() hypervisor.Capabilities

Capabilities returns the features supported by Cloud Hypervisor.

func (*CloudHypervisor) DeleteVM

func (c *CloudHypervisor) DeleteVM(ctx context.Context) error

DeleteVM removes the VM configuration from Cloud Hypervisor.

func (*CloudHypervisor) GetVMInfo

func (c *CloudHypervisor) GetVMInfo(ctx context.Context) (*hypervisor.VMInfo, error)

GetVMInfo returns current VM state.

func (*CloudHypervisor) Pause

func (c *CloudHypervisor) Pause(ctx context.Context) error

Pause suspends VM execution.

func (*CloudHypervisor) ResizeMemory

func (c *CloudHypervisor) ResizeMemory(ctx context.Context, bytes int64) error

ResizeMemory changes the VM's memory allocation.

func (*CloudHypervisor) ResizeMemoryAndWait

func (c *CloudHypervisor) ResizeMemoryAndWait(ctx context.Context, bytes int64, timeout time.Duration) error

ResizeMemoryAndWait 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.

func (*CloudHypervisor) Resume

func (c *CloudHypervisor) Resume(ctx context.Context) error

Resume continues VM execution.

func (*CloudHypervisor) Shutdown

func (c *CloudHypervisor) Shutdown(ctx context.Context) error

Shutdown stops the VMM process gracefully.

func (*CloudHypervisor) Snapshot

func (c *CloudHypervisor) Snapshot(ctx context.Context, destPath string) error

Snapshot creates a VM snapshot.

type Starter

type Starter struct{}

Starter implements hypervisor.VMStarter for Cloud Hypervisor.

func NewStarter

func NewStarter() *Starter

NewStarter creates a new Cloud Hypervisor starter.

func (*Starter) GetBinaryPath

func (s *Starter) GetBinaryPath(p *paths.Paths, version string) (string, error)

GetBinaryPath returns the path to the Cloud Hypervisor binary.

func (*Starter) GetVersion

func (s *Starter) GetVersion(p *paths.Paths) (string, error)

GetVersion returns the latest supported Cloud Hypervisor version. Cloud Hypervisor binaries are embedded, so we return the latest known version.

func (*Starter) RestoreVM

func (s *Starter) RestoreVM(ctx context.Context, p *paths.Paths, version string, socketPath string, snapshotPath string) (int, hypervisor.Hypervisor, error)

RestoreVM 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.

func (*Starter) SocketName

func (s *Starter) SocketName() string

SocketName returns the socket filename for Cloud Hypervisor.

func (*Starter) StartVM

func (s *Starter) StartVM(ctx context.Context, p *paths.Paths, version string, socketPath string, config hypervisor.VMConfig) (int, hypervisor.Hypervisor, error)

StartVM launches Cloud Hypervisor, configures the VM, and boots it. Returns the process ID and a Hypervisor client for subsequent operations.

type VsockDialer

type VsockDialer struct {
	// contains filtered or unexported fields
}

VsockDialer 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 ...).

func (*VsockDialer) DialVsock

func (d *VsockDialer) DialVsock(ctx context.Context, port int) (net.Conn, error)

DialVsock connects to the guest on the specified port. It connects to the Cloud Hypervisor Unix socket and performs the handshake protocol.

func (*VsockDialer) Key

func (d *VsockDialer) Key() string

Key returns a unique identifier for this dialer, used for connection pooling.

Jump to

Keyboard shortcuts

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