cloudhypervisor

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalloonConfig

type BalloonConfig struct {
	DeflateOnOom      bool  `json:"deflate_on_oom,omitempty"`
	FreePageReporting bool  `json:"free_page_reporting,omitempty"`
	Size              int64 `json:"size"`
}

type Client

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

func NewClient

func NewClient(socketPath string) *Client

func (*Client) VmAddDevice

func (c *Client) VmAddDevice(ctx context.Context, arg *DeviceConfig) (*PciDeviceInfo, error)

Add a new device to the VM

func (*Client) VmAddDisk

func (c *Client) VmAddDisk(ctx context.Context, arg *DiskConfig) (*PciDeviceInfo, error)

Add a new disk to the VM

func (*Client) VmAddFs

func (c *Client) VmAddFs(ctx context.Context, arg *FsConfig) (*PciDeviceInfo, error)

Add a new virtio-fs device to the VM

func (*Client) VmAddNet

func (c *Client) VmAddNet(ctx context.Context, arg *NetConfig) (*PciDeviceInfo, error)

Add a new network device to the VM

func (*Client) VmAddPmem

func (c *Client) VmAddPmem(ctx context.Context, arg *PmemConfig) (*PciDeviceInfo, error)

Add a new pmem device to the VM

func (*Client) VmAddUserDevice added in v0.16.0

func (c *Client) VmAddUserDevice(ctx context.Context, arg *VmAddUserDevice) (*PciDeviceInfo, error)

Add a new userspace device to the VM

func (*Client) VmAddVdpa

func (c *Client) VmAddVdpa(ctx context.Context, arg *VdpaConfig) (*PciDeviceInfo, error)

Add a new vDPA device to the VM

func (*Client) VmAddVsock

func (c *Client) VmAddVsock(ctx context.Context, arg *VsockConfig) (*PciDeviceInfo, error)

Add a new vsock device to the VM

func (*Client) VmBoot

func (c *Client) VmBoot(ctx context.Context) error

Boot the previously created VM instance.

func (*Client) VmCoredump added in v0.10.0

func (c *Client) VmCoredump(ctx context.Context, arg *VmCoredumpData) error

Takes a VM coredump.

func (*Client) VmCounters

func (c *Client) VmCounters(ctx context.Context) (*VmCounters, error)

Get counters from the VM

func (*Client) VmCreate

func (c *Client) VmCreate(ctx context.Context, arg *VmConfig) error

Create the cloud-hypervisor Virtual Machine (VM) instance. The instance is not booted, only created.

func (*Client) VmDelete

func (c *Client) VmDelete(ctx context.Context) error

Delete the cloud-hypervisor Virtual Machine (VM) instance.

func (*Client) VmInfo

func (c *Client) VmInfo(ctx context.Context) (*VmInfo, error)

Returns general information about the cloud-hypervisor Virtual Machine (VM) instance.

func (*Client) VmPause

func (c *Client) VmPause(ctx context.Context) error

Pause a previously booted VM instance.

func (*Client) VmPowerButton

func (c *Client) VmPowerButton(ctx context.Context) error

Trigger a power button in the VM

func (*Client) VmReboot

func (c *Client) VmReboot(ctx context.Context) error

Reboot the VM instance.

func (*Client) VmReceiveMigration

func (c *Client) VmReceiveMigration(ctx context.Context, arg *ReceiveMigrationData) error

Receive a VM migration from URL

func (*Client) VmRemoveDevice

func (c *Client) VmRemoveDevice(ctx context.Context, arg *VmRemoveDevice) error

Remove a device from the VM

func (*Client) VmResize

func (c *Client) VmResize(ctx context.Context, arg *VmResize) error

Resize the VM

func (*Client) VmResizeZone

func (c *Client) VmResizeZone(ctx context.Context, arg *VmResizeZone) error

Resize a memory zone

func (*Client) VmRestore

func (c *Client) VmRestore(ctx context.Context, arg *RestoreConfig) error

Restore a VM from a snapshot.

func (*Client) VmResume

func (c *Client) VmResume(ctx context.Context) error

Resume a previously paused VM instance.

func (*Client) VmSendMigration

func (c *Client) VmSendMigration(ctx context.Context, arg *SendMigrationData) error

Send a VM migration to URL

func (*Client) VmShutdown

func (c *Client) VmShutdown(ctx context.Context) error

Shut the VM instance down.

func (*Client) VmSnapshot

func (c *Client) VmSnapshot(ctx context.Context, arg *VmSnapshotConfig) error

Returns a VM snapshot.

func (*Client) VmmPing

func (c *Client) VmmPing(ctx context.Context) (*VmmPingResponse, error)

Ping the VMM to check for API server availability

func (*Client) VmmShutdown

func (c *Client) VmmShutdown(ctx context.Context) error

Shuts the cloud-hypervisor VMM.

type ConsoleConfig

type ConsoleConfig struct {
	File   string `json:"file,omitempty"`
	Iommu  bool   `json:"iommu,omitempty"`
	Mode   string `json:"mode"`
	Socket string `json:"socket,omitempty"`
}

type CpuAffinity

type CpuAffinity struct {
	HostCpus []int `json:"host_cpus"`
	Vcpu     int   `json:"vcpu"`
}

type CpuFeatures

type CpuFeatures struct {
	Amx bool `json:"amx,omitempty"`
}

type CpuTopology

type CpuTopology struct {
	CoresPerDie    int `json:"cores_per_die,omitempty"`
	DiesPerPackage int `json:"dies_per_package,omitempty"`
	Packages       int `json:"packages,omitempty"`
	ThreadsPerCore int `json:"threads_per_core,omitempty"`
}

type CpusConfig

type CpusConfig struct {
	Affinity    []*CpuAffinity `json:"affinity,omitempty"`
	BootVcpus   int            `json:"boot_vcpus"`
	Features    *CpuFeatures   `json:"features,omitempty"`
	KvmHyperv   bool           `json:"kvm_hyperv,omitempty"`
	MaxPhysBits int            `json:"max_phys_bits,omitempty"`
	MaxVcpus    int            `json:"max_vcpus"`
	Topology    *CpuTopology   `json:"topology,omitempty"`
}

type DeviceConfig

type DeviceConfig struct {
	Id         string `json:"id,omitempty"`
	Iommu      bool   `json:"iommu,omitempty"`
	Path       string `json:"path"`
	PciSegment int16  `json:"pci_segment,omitempty"`
}

type DeviceNode

type DeviceNode struct {
	Children  []string                 `json:"children,omitempty"`
	Id        string                   `json:"id,omitempty"`
	PciBdf    string                   `json:"pci_bdf,omitempty"`
	Resources []map[string]interface{} `json:"resources,omitempty"`
}

type DiskConfig

type DiskConfig struct {
	Direct            bool               `json:"direct,omitempty"`
	Id                string             `json:"id,omitempty"`
	Iommu             bool               `json:"iommu,omitempty"`
	NumQueues         int                `json:"num_queues,omitempty"`
	Path              string             `json:"path"`
	PciSegment        int16              `json:"pci_segment,omitempty"`
	QueueSize         int                `json:"queue_size,omitempty"`
	RateLimiterConfig *RateLimiterConfig `json:"rate_limiter_config,omitempty"`
	Readonly          bool               `json:"readonly,omitempty"`
	Serial            string             `json:"serial,omitempty"`
	VhostSocket       string             `json:"vhost_socket,omitempty"`
	VhostUser         bool               `json:"vhost_user,omitempty"`
}

type FsConfig

type FsConfig struct {
	Id         string `json:"id,omitempty"`
	NumQueues  int    `json:"num_queues"`
	PciSegment int16  `json:"pci_segment,omitempty"`
	QueueSize  int    `json:"queue_size"`
	Socket     string `json:"socket"`
	Tag        string `json:"tag"`
}

type MemoryConfig

type MemoryConfig struct {
	HotplugMethod  string              `json:"hotplug_method,omitempty"`
	HotplugSize    int64               `json:"hotplug_size,omitempty"`
	HotpluggedSize int64               `json:"hotplugged_size,omitempty"`
	HugepageSize   int64               `json:"hugepage_size,omitempty"`
	Hugepages      bool                `json:"hugepages,omitempty"`
	Mergeable      bool                `json:"mergeable,omitempty"`
	Prefault       bool                `json:"prefault,omitempty"`
	Shared         bool                `json:"shared,omitempty"`
	Size           int64               `json:"size"`
	Thp            bool                `json:"thp,omitempty"`
	Zones          []*MemoryZoneConfig `json:"zones,omitempty"`
}

type MemoryZoneConfig

type MemoryZoneConfig struct {
	File           string `json:"file,omitempty"`
	HostNumaNode   int    `json:"host_numa_node,omitempty"`
	HotplugSize    int64  `json:"hotplug_size,omitempty"`
	HotpluggedSize int64  `json:"hotplugged_size,omitempty"`
	HugepageSize   int64  `json:"hugepage_size,omitempty"`
	Hugepages      bool   `json:"hugepages,omitempty"`
	Id             string `json:"id"`
	Mergeable      bool   `json:"mergeable,omitempty"`
	Prefault       bool   `json:"prefault,omitempty"`
	Shared         bool   `json:"shared,omitempty"`
	Size           int64  `json:"size"`
}

type NetConfig

type NetConfig struct {
	HostMac           string             `json:"host_mac,omitempty"`
	Id                string             `json:"id,omitempty"`
	Iommu             bool               `json:"iommu,omitempty"`
	Ip                string             `json:"ip,omitempty"`
	Mac               string             `json:"mac,omitempty"`
	Mask              string             `json:"mask,omitempty"`
	Mtu               int                `json:"mtu,omitempty"`
	NumQueues         int                `json:"num_queues,omitempty"`
	PciSegment        int16              `json:"pci_segment,omitempty"`
	QueueSize         int                `json:"queue_size,omitempty"`
	RateLimiterConfig *RateLimiterConfig `json:"rate_limiter_config,omitempty"`
	Tap               string             `json:"tap,omitempty"`
	VhostMode         string             `json:"vhost_mode,omitempty"`
	VhostSocket       string             `json:"vhost_socket,omitempty"`
	VhostUser         bool               `json:"vhost_user,omitempty"`
}

type NumaConfig

type NumaConfig struct {
	Cpus           []int           `json:"cpus,omitempty"`
	Distances      []*NumaDistance `json:"distances,omitempty"`
	GuestNumaId    int             `json:"guest_numa_id"`
	MemoryZones    []string        `json:"memory_zones,omitempty"`
	PciSegments    []int           `json:"pci_segments,omitempty"`
	SgxEpcSections []string        `json:"sgx_epc_sections,omitempty"`
}

type NumaDistance

type NumaDistance struct {
	Destination int `json:"destination"`
	Distance    int `json:"distance"`
}

type PayloadConfig added in v0.10.0

type PayloadConfig struct {
	Cmdline   string `json:"cmdline,omitempty"`
	Firmware  string `json:"firmware,omitempty"`
	Initramfs string `json:"initramfs,omitempty"`
	Kernel    string `json:"kernel,omitempty"`
}

Payloads to boot in guest

type PciDeviceInfo

type PciDeviceInfo struct {
	Bdf string `json:"bdf"`
	Id  string `json:"id"`
}

Information about a PCI device

type PlatformConfig

type PlatformConfig struct {
	IommuSegments  []int16  `json:"iommu_segments,omitempty"`
	NumPciSegments int16    `json:"num_pci_segments,omitempty"`
	OemStrings     []string `json:"oem_strings,omitempty"`
	SerialNumber   string   `json:"serial_number,omitempty"`
	Tdx            bool     `json:"tdx,omitempty"`
	Uuid           string   `json:"uuid,omitempty"`
}

type PmemConfig

type PmemConfig struct {
	DiscardWrites bool   `json:"discard_writes,omitempty"`
	File          string `json:"file"`
	Id            string `json:"id,omitempty"`
	Iommu         bool   `json:"iommu,omitempty"`
	PciSegment    int16  `json:"pci_segment,omitempty"`
	Size          int64  `json:"size,omitempty"`
}

type RateLimiterConfig

type RateLimiterConfig struct {
	Bandwidth *TokenBucket `json:"bandwidth,omitempty"`
	Ops       *TokenBucket `json:"ops,omitempty"`
}

Defines an IO rate limiter with independent bytes/s and ops/s limits. Limits are defined by configuring each of the _bandwidth_ and _ops_ token buckets.

type ReceiveMigrationData

type ReceiveMigrationData struct {
	ReceiverUrl string `json:"receiver_url"`
}

type RestoreConfig

type RestoreConfig struct {
	Prefault  bool   `json:"prefault,omitempty"`
	SourceUrl string `json:"source_url"`
}

type RngConfig

type RngConfig struct {
	Iommu bool   `json:"iommu,omitempty"`
	Src   string `json:"src"`
}

type SendMigrationData

type SendMigrationData struct {
	DestinationUrl string `json:"destination_url"`
	Local          bool   `json:"local,omitempty"`
}

type SgxEpcConfig

type SgxEpcConfig struct {
	Id       string `json:"id"`
	Prefault bool   `json:"prefault,omitempty"`
	Size     int64  `json:"size"`
}

type TokenBucket

type TokenBucket struct {
	OneTimeBurst int64 `json:"one_time_burst,omitempty"`
	RefillTime   int64 `json:"refill_time"`
	Size         int64 `json:"size"`
}

Defines a token bucket with a maximum capacity (_size_), an initial burst size (_one_time_burst_) and an interval for refilling purposes (_refill_time_). The refill-rate is derived from _size_ and _refill_time_, and it is the constant rate at which the tokens replenish. The refill process only starts happening after the initial burst budget is consumed. Consumption from the token bucket is unbounded in speed which allows for bursts bound in size by the amount of tokens available. Once the token bucket is empty, consumption speed is bound by the refill-rate.

type TpmConfig added in v0.13.0

type TpmConfig struct {
	Socket string `json:"socket"`
}

type VdpaConfig

type VdpaConfig struct {
	Id         string `json:"id,omitempty"`
	Iommu      bool   `json:"iommu,omitempty"`
	NumQueues  int    `json:"num_queues"`
	Path       string `json:"path"`
	PciSegment int16  `json:"pci_segment,omitempty"`
}

type VmAddUserDevice added in v0.16.0

type VmAddUserDevice struct {
	Socket string `json:"socket"`
}

type VmConfig

type VmConfig struct {
	Balloon  *BalloonConfig  `json:"balloon,omitempty"`
	Console  *ConsoleConfig  `json:"console,omitempty"`
	Cpus     *CpusConfig     `json:"cpus,omitempty"`
	Devices  []*DeviceConfig `json:"devices,omitempty"`
	Disks    []*DiskConfig   `json:"disks,omitempty"`
	Fs       []*FsConfig     `json:"fs,omitempty"`
	Iommu    bool            `json:"iommu,omitempty"`
	Memory   *MemoryConfig   `json:"memory,omitempty"`
	Net      []*NetConfig    `json:"net,omitempty"`
	Numa     []*NumaConfig   `json:"numa,omitempty"`
	Payload  *PayloadConfig  `json:"payload"`
	Platform *PlatformConfig `json:"platform,omitempty"`
	Pmem     []*PmemConfig   `json:"pmem,omitempty"`
	Rng      *RngConfig      `json:"rng,omitempty"`
	Serial   *ConsoleConfig  `json:"serial,omitempty"`
	SgxEpc   []*SgxEpcConfig `json:"sgx_epc,omitempty"`
	Tpm      *TpmConfig      `json:"tpm,omitempty"`
	Vdpa     []*VdpaConfig   `json:"vdpa,omitempty"`
	Vsock    *VsockConfig    `json:"vsock,omitempty"`
	Watchdog bool            `json:"watchdog,omitempty"`
}

Virtual machine configuration

type VmCoredumpData added in v0.10.0

type VmCoredumpData struct {
	DestinationUrl string `json:"destination_url,omitempty"`
}

type VmCounters

type VmCounters struct {
}

type VmInfo

type VmInfo struct {
	Config           *VmConfig              `json:"config"`
	DeviceTree       map[string]*DeviceNode `json:"device_tree,omitempty"`
	MemoryActualSize int64                  `json:"memory_actual_size,omitempty"`
	State            string                 `json:"state"`
}

Virtual Machine information

type VmRemoveDevice

type VmRemoveDevice struct {
	Id string `json:"id,omitempty"`
}

type VmResize

type VmResize struct {
	DesiredBalloon int64 `json:"desired_balloon,omitempty"`
	DesiredRam     int64 `json:"desired_ram,omitempty"`
	DesiredVcpus   int   `json:"desired_vcpus,omitempty"`
}

type VmResizeZone

type VmResizeZone struct {
	DesiredRam int64  `json:"desired_ram,omitempty"`
	Id         string `json:"id,omitempty"`
}

type VmSnapshotConfig

type VmSnapshotConfig struct {
	DestinationUrl string `json:"destination_url,omitempty"`
}

type VmmPingResponse

type VmmPingResponse struct {
	BuildVersion string   `json:"build_version,omitempty"`
	Features     []string `json:"features,omitempty"`
	Pid          int64    `json:"pid,omitempty"`
	Version      string   `json:"version"`
}

Virtual Machine Monitor information

type VsockConfig

type VsockConfig struct {
	Cid        int64  `json:"cid"`
	Id         string `json:"id,omitempty"`
	Iommu      bool   `json:"iommu,omitempty"`
	PciSegment int16  `json:"pci_segment,omitempty"`
	Socket     string `json:"socket"`
}

Jump to

Keyboard shortcuts

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