Telmate/proxmox-api-go

Overhaul: QemuCpu

Closed this issue · 1 comments

Add support for all cpu settings.

Suggested schema:

type QemuCPU struct {
	Affinity     *[]uint          `json:"affinity,omitempty"`
	Cores        *QemuCpuCores    `json:"cores,omitempty"` // Required during creation
	Flags        *CpuFlags        `json:"flags,omitempty"`
	Limit        *CpuLimit        `json:"limit,omitempty"`
	Numa         *bool            `json:"numa,omitempty"`
	Sockets      *CpuSockets      `json:"sockets,omitempty"`
	Type         *CpuType         `json:"type,omitempty"`
	Units        *CpuUnits        `json:"units,omitempty"`
	VirtualCores *CpuVirtualCores `json:"vcores,omitempty"`
}

type QemuCpuCores uint8 // min value 1, max value of 128

type CpuFlags struct {
	AES        *TriBool `json:"aes,omitempty"`        // Activate AES instruction set for HW acceleration.
	AmdNoSSB   *TriBool `json:"amdnossb,omitempty"`   // Notifies guest OS that host is not vulnerable for Spectre on AMD CPUs.
	AmdSSBD    *TriBool `json:"amdssbd,omitempty"`    // Improves Spectre mitigation performance with AMD CPUs, best used with "VirtSSBD".
	HvEvmcs    *TriBool `json:"hvevmcs,omitempty"`    // Improve performance for nested virtualization. Only supported on Intel CPUs.
	HvTlbFlush *TriBool `json:"hvtlbflush,omitempty"` // Improve performance in overcommitted Windows guests. May lead to guest bluescreens on old CPUs.
	Ibpb       *TriBool `json:"ibpb,omitempty"`       // Allows improved Spectre mitigation with AMD CPUs.
	MdClear    *TriBool `json:"mdclear,omitempty"`    // Required to let the guest OS know if MDS is mitigated correctly.
	PCID       *TriBool `json:"pcid,omitempty"`       // Meltdown fix cost reduction on Westmere, Sandy-, and IvyBridge Intel CPUs.
	Pdpe1GB    *TriBool `json:"pdpe1gb,omitempty"`    // Allow guest OS to use 1GB size pages, if host HW supports it.
	SpecCtrl   *TriBool `json:"specctrl,omitempty"`   // Allows improved Spectre mitigation with Intel CPUs.
	SSBD       *TriBool `json:"ssbd,omitempty"`       // Protection for "Speculative Store Bypass" for Intel models.
	VirtSSBD   *TriBool `json:"cirtssbd,omitempty"`   // Basis for "Speculative Store Bypass" protection for AMD models.
}

type TriBool string // "true", "false", ""

type CpuLimit uint8 // min value 0 is unlimited, max value of 128

type CpuSockets uint8 // min value 1, max value 4

type CpuType string // enum

type CpuUnits uint32 // min value 0 is unset, max value of 262144

type CpuVirtualCores uint16 // min value 0 is unset, max value 512. is QemuCpuCores * CpuSockets