Documentation
¶
Index ¶
- Constants
- func DebugDiskCLIArgs(storageConfigs []*types.StorageConfig, cpuCount, diskQueueSize int, ...) []string
- func ReverseLayerSerials(storageConfigs []*types.StorageConfig) []string
- type CloudHypervisor
- func (ch *CloudHypervisor) Clone(ctx context.Context, vmID string, vmCfg *types.VMConfig, net types.NetSetup, ...) (*types.VM, error)
- func (ch *CloudHypervisor) Console(ctx context.Context, ref string) (io.ReadWriteCloser, error)
- func (ch *CloudHypervisor) Create(ctx context.Context, id string, vmCfg *types.VMConfig, ...) (*types.VM, error)
- func (ch *CloudHypervisor) Delete(ctx context.Context, refs []string, force bool) ([]string, error)
- func (ch *CloudHypervisor) DeviceAttach(ctx context.Context, vmRef string, spec vfio.Spec) (string, error)
- func (ch *CloudHypervisor) DeviceDetach(ctx context.Context, vmRef, id string) error
- func (ch *CloudHypervisor) DeviceList(ctx context.Context, vmRef string) ([]vfio.Attached, error)
- func (ch *CloudHypervisor) DirectClone(ctx context.Context, vmID string, vmCfg *types.VMConfig, net types.NetSetup, ...) (*types.VM, error)
- func (ch *CloudHypervisor) DirectRestore(ctx context.Context, vmRef string, vmCfg *types.VMConfig, srcDir string) (*types.VM, error)
- func (ch *CloudHypervisor) FsAttach(ctx context.Context, vmRef string, spec fs.Spec) (string, error)
- func (ch *CloudHypervisor) FsDetach(ctx context.Context, vmRef, tag string) error
- func (ch *CloudHypervisor) FsList(ctx context.Context, vmRef string) ([]fs.Attached, error)
- func (ch *CloudHypervisor) NetResize(ctx context.Context, vmRef string, spec netresize.Spec, ...) (netresize.Result, error)
- func (ch *CloudHypervisor) Restore(ctx context.Context, vmRef string, vmCfg *types.VMConfig, snapshot io.Reader) (*types.VM, error)
- func (ch *CloudHypervisor) Snapshot(ctx context.Context, ref string) (*types.SnapshotConfig, io.ReadCloser, error)
- func (ch *CloudHypervisor) Start(ctx context.Context, refs []string) ([]string, error)
- func (ch *CloudHypervisor) Stop(ctx context.Context, refs []string) ([]string, error)
- type Config
Constants ¶
const CowSerial = hypervisor.CowSerial
CowSerial is re-exported for backward compatibility.
Variables ¶
This section is empty.
Functions ¶
func DebugDiskCLIArgs ¶
func DebugDiskCLIArgs(storageConfigs []*types.StorageConfig, cpuCount, diskQueueSize int, noDirectIO bool) []string
DebugDiskCLIArgs uses the same storage-to-disk mapping as launch.
func ReverseLayerSerials ¶
func ReverseLayerSerials(storageConfigs []*types.StorageConfig) []string
ReverseLayerSerials extracts layer serials, reversed for overlayfs lowerdir.
Types ¶
type CloudHypervisor ¶
type CloudHypervisor struct {
*hypervisor.Backend
// contains filtered or unexported fields
}
CloudHypervisor implements hypervisor.Hypervisor.
func New ¶
func New(conf *config.Config) (*CloudHypervisor, error)
New creates a CloudHypervisor backend.
func (*CloudHypervisor) Console ¶
func (ch *CloudHypervisor) Console(ctx context.Context, ref string) (io.ReadWriteCloser, error)
Console connects to the VM's console output and returns a bidirectional stream.
For UEFI-boot VMs (cloudimg): connects to the serial socket (console.sock). For direct-boot VMs (OCI): opens the virtio-console PTY allocated by CH.
The console path is resolved lazily on first access via the CH API (OCI/PTY) or the deterministic socket path (UEFI), so callers like Clone and Start don't need to query it upfront. The caller is responsible for closing the returned ReadWriteCloser.
func (*CloudHypervisor) Create ¶
func (ch *CloudHypervisor) Create(ctx context.Context, id string, vmCfg *types.VMConfig, storageConfigs []*types.StorageConfig, net types.NetSetup, bootCfg *types.BootConfig) (*types.VM, error)
func (*CloudHypervisor) Delete ¶
Delete removes VMs. Running VMs require force=true (stops them first).
func (*CloudHypervisor) DeviceAttach ¶ added in v0.3.9
func (ch *CloudHypervisor) DeviceAttach(ctx context.Context, vmRef string, spec vfio.Spec) (string, error)
DeviceAttach hot-plugs a VFIO PCI passthrough device onto a running CH VM.
func (*CloudHypervisor) DeviceDetach ¶ added in v0.3.9
func (ch *CloudHypervisor) DeviceDetach(ctx context.Context, vmRef, id string) error
DeviceDetach removes a previously attached VFIO device by id.
func (*CloudHypervisor) DeviceList ¶ added in v0.3.9
DeviceList enumerates currently attached VFIO PCI passthrough devices.
func (*CloudHypervisor) DirectClone ¶
func (ch *CloudHypervisor) DirectClone(ctx context.Context, vmID string, vmCfg *types.VMConfig, net types.NetSetup, snapshotConfig *types.SnapshotConfig, srcDir string) (*types.VM, error)
DirectClone clones from a local snapshot dir. Per-type: hardlink memory-range-*, reflink/copy COW, plain copy metadata; cidata is regenerated.
func (*CloudHypervisor) DirectRestore ¶
func (*CloudHypervisor) FsAttach ¶ added in v0.3.9
func (ch *CloudHypervisor) FsAttach(ctx context.Context, vmRef string, spec fs.Spec) (string, error)
FsAttach hot-plugs a vhost-user-fs device onto a running CH VM.
func (*CloudHypervisor) FsDetach ¶ added in v0.3.9
func (ch *CloudHypervisor) FsDetach(ctx context.Context, vmRef, tag string) error
FsDetach removes a previously attached vhost-user-fs device by tag.
func (*CloudHypervisor) FsList ¶ added in v0.3.9
FsList enumerates currently attached vhost-user-fs devices.
func (*CloudHypervisor) NetResize ¶ added in v0.4.0
func (ch *CloudHypervisor) NetResize(ctx context.Context, vmRef string, spec netresize.Spec, plumbing netresize.Plumbing) (netresize.Result, error)
NetResize brings the VM's NIC count to spec.Target on a running CH VM.
func (*CloudHypervisor) Snapshot ¶
func (ch *CloudHypervisor) Snapshot(ctx context.Context, ref string) (*types.SnapshotConfig, io.ReadCloser, error)
Snapshot pauses, captures CH state+COW, resumes, and streams the result.
func (*CloudHypervisor) Stop ¶
Stop shuts down the Cloud Hypervisor process for each VM ref. Two modes are used depending on the VM's boot method:
- UEFI boot (cloudimg): ACPI power-button → poll → fallback SIGTERM/SIGKILL
- Direct boot (OCI): vm.shutdown API → SIGTERM → SIGKILL (no ACPI)
Returns the IDs that were successfully stopped.
type Config ¶
type Config struct {
hypervisor.BaseConfig
}
Config holds Cloud Hypervisor specific configuration.