kvmx86

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

API to manage KVM x86 compute instances (x86 VMs)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateBlankRequest

type CreateBlankRequest struct {
	// ID of the resource group, which will own this VM
	// Required: true
	RGID uint64 `url:"rgId" json:"rgId" validate:"required"`

	// Name of this VM.
	// Must be unique among all VMs (including those in DELETED state) in target resource group
	// Required: true
	Name string `url:"name" json:"name" validate:"required"`

	// Number CPUs to allocate to this VM
	// Required: true
	CPU uint64 `url:"cpu" json:"cpu" validate:"required"`

	// Volume of RAM in MB to allocate to this VM
	// Required: true
	RAM uint64 `url:"ram" json:"ram" validate:"required"`

	// If True, the imageId, bootDisk, sepId, pool parameters are ignored and the compute is created without a boot disk in the stopped state
	// Required: false
	WithoutBootDisk bool `url:"withoutBootDisk" json:"withoutBootDisk"`

	// Size of the boot disk in GB
	// Required: false
	BootDisk uint64 `url:"bootDisk,omitempty" json:"bootDisk,omitempty"`

	// ID of SEP to create boot disk on.
	// Uses images SEP ID if not set
	// Required: false
	SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`

	// Pool to use if sepId is set, can be also empty if needed to be chosen by system
	// Required: false
	Pool string `url:"pool,omitempty" json:"pool,omitempty"`

	// Slice of structs with data disk description. Each disk has parameters: required - diskName, size; optional - sepId, pool, desc and imageId.
	// If not specified, compute will be created without disks.
	// To create compute without disks, pass initialized empty slice .
	// Required: false
	DataDisks []DataDisk `url:"-" json:"dataDisks,omitempty" validate:"omitempty,dive"`

	// Slice of structs with net interface description.
	// If not specified, compute will be created with default interface from RG.
	// To create compute without interfaces, pass initialized empty slice .
	// Required: false
	Interfaces []Interface `url:"-" json:"interfaces,omitempty" validate:"omitempty,dive"`

	// Type of compute Stateful (KVM_X86) or Stateless (SVA_KVM_X86)
	// Required: false
	Driver string `url:"driver,omitempty" json:"driver,omitempty" validate:"omitempty,computeDriver"`

	// Type of the emulated system, Q35 or i440fx
	// Required: false
	Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"omitempty,chipset"`

	// Text description of this VM
	// Required: false
	Description string `url:"desc,omitempty" json:"desc,omitempty"`

	// Recommended isolated CPUs. Field is ignored if compute.cpupin=False or compute.pinned=False
	// Required: false
	PreferredCPU []int64 `url:"preferredCpu,omitempty" json:"preferredCpu,omitempty" validate:"omitempty,preferredCPU"`
}

CreateBlankRequest struct to create KVM x86 VM from scratch

func (CreateBlankRequest) GetRAM added in v1.8.0

func (r CreateBlankRequest) GetRAM() map[string]uint64

GetRAM returns RAM field values

type CreateRequest

type CreateRequest struct {
	// ID of the resource group, which will own this VM
	// Required: true
	RGID uint64 `url:"rgId" json:"rgId" validate:"required"`

	// Name of this VM.
	// Must be unique among all VMs (including those in DELETED state) in target resource group
	// Required: true
	Name string `url:"name" json:"name" validate:"required"`

	// Number CPUs to allocate to this VM
	// Required: true
	CPU uint64 `url:"cpu" json:"cpu" validate:"required"`

	// Volume of RAM in MB to allocate to this VM
	// Required: true
	RAM uint64 `url:"ram" json:"ram" validate:"required"`

	// If True, the imageId, bootDisk, sepId, pool parameters are ignored and the compute is created without a boot disk in the stopped state
	// Required: false
	WithoutBootDisk bool `url:"withoutBootDisk" json:"withoutBootDisk"`

	// ID of the OS image to base this VM on;
	// Could be boot disk image or CD-ROM image
	// Required: false
	ImageID uint64 `url:"imageId,omitempty" json:"imageId,omitempty"`

	// Size of the boot disk in GB
	// Required: false
	BootDisk uint64 `url:"bootDisk,omitempty" json:"bootDisk,omitempty"`

	// ID of SEP to create boot disk on.
	// Uses images SEP ID if not set
	// Required: false
	SepID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`

	// Pool to use if sepId is set, can be also empty if needed to be chosen by system
	// Required: false
	Pool string `url:"pool,omitempty" json:"pool,omitempty"`

	// Slice of structs with data disk description. Each disk has parameters: required - diskName, size; optional - sepId, pool, desc and imageId.
	// If not specified, compute will be created without disks.
	// To create compute without disks, pass initialized empty slice .
	// Required: false
	DataDisks []DataDisk `url:"-" json:"dataDisks,omitempty" validate:"omitempty,dive"`

	// Slice of structs with net interface description.
	// If not specified, compute will be created with default interface from RG.
	// To create compute without interfaces, pass initialized empty slice .
	// Required: false
	Interfaces []Interface `url:"-" json:"interfaces,omitempty" validate:"omitempty,dive"`

	// Input data for cloud-init facility
	// Required: false
	Userdata string `url:"userdata,omitempty" json:"userdata,omitempty"`

	// Text description of this VM
	// Required: false
	Description string `url:"desc,omitempty" json:"desc,omitempty"`

	// Start VM upon success
	// Required: false
	Start bool `url:"start" json:"start"`

	// System name
	// Required: false
	IS string `url:"IS,omitempty" json:"IS,omitempty"`

	// Compute purpose
	// Required: false
	IPAType string `url:"ipaType,omitempty" json:"ipaType,omitempty"`

	// Custom fields for compute. Must be a dict
	// Required: false
	CustomFields string `url:"customFields,omitempty" json:"customFields,omitempty"`

	// Type of compute Stateful (KVM_X86) or Stateless (SVA_KVM_X86)
	// Required: false
	Driver string `url:"driver,omitempty" json:"driver,omitempty" validate:"omitempty,computeDriver"`

	// Rule for VM placement with NUMA affinity.
	// Possible values - none (placement without NUMA affinity),
	// strict (strictly with NUMA affinity, if not possible - do not start VM),
	// loose (use NUMA affinity if possible)
	// Required: false
	// Default: none
	NumaAffinity string `url:"numaAffinity,omitempty" json:"numaAffinity,omitempty" validate:"omitempty,numaAffinity"`

	// Run VM on dedicated CPUs. To use this feature, the system must be pre-configured by allocating CPUs on the physical node
	// Required: false
	// Default: false
	CPUPin bool `url:"cpupin" json:"cpupin"`

	// Type of the emulated system, Q35 or i440fx
	// Required: false
	Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"omitempty,chipset"`

	// Use Huge Pages to allocate RAM of the virtual machine. The system must be pre-configured by allocating Huge Pages on the physical node
	// Required: false
	// Default: false
	HPBacked bool `url:"hpBacked" json:"hpBacked"`

	// Recommended isolated CPUs. Field is ignored if compute.cpupin=False or compute.pinned=False
	// Required: false
	PreferredCPU []int64 `url:"preferredCpu,omitempty" json:"preferredCpu,omitempty" validate:"omitempty,preferredCPU"`
}

CreateRequest struct to create KVM x86 VM

func (CreateRequest) GetRAM added in v1.8.0

func (r CreateRequest) GetRAM() map[string]uint64

GetRAM returns RAM field values

type DataDisk added in v1.8.0

type DataDisk struct {
	// Name for disk
	// Required: true
	DiskName string `url:"diskName" json:"diskName" validate:"required"`

	// Disk size in GB
	// Required: true
	Size uint64 `url:"size" json:"size" validate:"required"`

	// Storage endpoint provider ID
	// By default the same with boot disk
	// Required: false
	SepID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`

	// Pool name
	// By default will be chosen automatically
	// Required: false
	Pool string `url:"pool,omitempty" json:"pool,omitempty"`

	// Optional description
	// Required: false
	Description string `url:"desc,omitempty" json:"desc,omitempty"`

	// Specify image id for create disk from template
	// Required: false
	ImageID uint64 `url:"imageId,omitempty" json:"imageId,omitempty"`
}

DataDisk detailed struct for DataDisks field in CreateRequest and CreateBlankRequest

type Interface added in v1.5.0

type Interface struct {
	// Network type
	// Should be one of:
	//	- VINS
	//	- EXTNET
	//  - VFNIC
	//  - DPDK
	NetType string `url:"netType" json:"netType" validate:"required,kvmx86NetType"`

	// Network ID for connect to,
	// for EXTNET - external network ID,
	// for VINS - VINS ID,
	NetID uint64 `url:"netId" json:"netId" validate:"required"`

	// IP address to assign to this VM when connecting to the specified network
	// Required: false
	IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`

	// Maximum transmission unit, must be 1-9216
	// Used only to DPDK net type
	// Required: false
	MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
}

type KVMX86

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

Structure for creating request to KVMX86

func New

func New(client interfaces.Caller) *KVMX86

Builder for KVMX86 endpoints

func (KVMX86) Create

func (k KVMX86) Create(ctx context.Context, req CreateRequest) (uint64, error)

Create creates KVM x86 VM based on specified OS image

func (KVMX86) CreateBlank

func (k KVMX86) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64, error)

CreateBlank creates KVM x86 VM from scratch

Jump to

Keyboard shortcuts

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