[GH-ISSUE #318] Overhaul: QemuCpu #74

Closed
opened 2026-02-28 00:40:28 +03:00 by kerem · 1 comment
Owner

Originally created by @Tinyblargon on GitHub (Mar 7, 2024).
Original GitHub issue: https://github.com/Telmate/proxmox-api-go/issues/318

Originally assigned to: @Tinyblargon on GitHub.

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
Originally created by @Tinyblargon on GitHub (Mar 7, 2024). Original GitHub issue: https://github.com/Telmate/proxmox-api-go/issues/318 Originally assigned to: @Tinyblargon on GitHub. Add support for all cpu settings. Suggested schema: ```go 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 ```
kerem 2026-02-28 00:40:28 +03:00
Author
Owner

@Tinyblargon commented on GitHub (Mar 7, 2024):

https://github.com/Telmate/terraform-provider-proxmox/issues/833

<!-- gh-comment-id:1983333961 --> @Tinyblargon commented on GitHub (Mar 7, 2024): https://github.com/Telmate/terraform-provider-proxmox/issues/833
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmox-api-go#74
No description provided.