Documentation
¶
Overview ¶
Package cloudhypervisor implements the hypervisor.Hypervisor interface for Cloud Hypervisor VMM.
Index ¶
- func NewVsockDialer(vsockSocket string, vsockCID int64) hypervisor.VsockDialer
- func ToVMConfig(cfg hypervisor.VMConfig) vmm.VmConfig
- type CloudHypervisor
- func (c *CloudHypervisor) Capabilities() hypervisor.Capabilities
- func (c *CloudHypervisor) DeleteVM(ctx context.Context) error
- func (c *CloudHypervisor) GetVMInfo(ctx context.Context) (*hypervisor.VMInfo, error)
- func (c *CloudHypervisor) Pause(ctx context.Context) error
- func (c *CloudHypervisor) ResizeMemory(ctx context.Context, bytes int64) error
- func (c *CloudHypervisor) ResizeMemoryAndWait(ctx context.Context, bytes int64, timeout time.Duration) error
- func (c *CloudHypervisor) Resume(ctx context.Context) error
- func (c *CloudHypervisor) Shutdown(ctx context.Context) error
- func (c *CloudHypervisor) Snapshot(ctx context.Context, destPath string) error
- type Starter
- func (s *Starter) GetBinaryPath(p *paths.Paths, version string) (string, error)
- func (s *Starter) GetVersion(p *paths.Paths) (string, error)
- func (s *Starter) RestoreVM(ctx context.Context, p *paths.Paths, version string, socketPath string, ...) (int, hypervisor.Hypervisor, error)
- func (s *Starter) SocketName() string
- func (s *Starter) StartVM(ctx context.Context, p *paths.Paths, version string, socketPath string, ...) (int, hypervisor.Hypervisor, error)
- type VsockDialer
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.
type Starter ¶
type Starter struct{}
Starter implements hypervisor.VMStarter for Cloud Hypervisor.
func (*Starter) GetBinaryPath ¶
GetBinaryPath returns the path to the Cloud Hypervisor binary.
func (*Starter) GetVersion ¶
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 ¶
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 ¶
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.