Add vcpus feature

This commit is contained in:
Virgil 2019-12-05 14:41:10 +01:00
parent c4f2bac16b
commit 97ee971bbe
2 changed files with 9 additions and 0 deletions

View File

@ -26,6 +26,7 @@ resource "proxmox_vm_qemu" "cloudinit-test" {
os_type = "cloud-init"
cores = "2"
sockets = "1"
vcpus = "0"
cpu = "host"
memory = "2048"
scsihw = "lsi"

View File

@ -106,6 +106,11 @@ func resourceVmQemu() *schema.Resource {
Optional: true,
Default: 1,
},
"vcpus": {
Type: schema.TypeInt,
Optional: true,
Default: 0,
},
"cpu": {
Type: schema.TypeString,
Optional: true,
@ -446,6 +451,7 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error {
Memory: d.Get("memory").(int),
QemuCores: d.Get("cores").(int),
QemuSockets: d.Get("sockets").(int),
QemuVcpus: d.Get("vcpus").(int),
QemuCpu: d.Get("cpu").(string),
QemuNuma: d.Get("numa").(bool),
Hotplug: d.Get("hotplug").(string),
@ -636,6 +642,7 @@ func resourceVmQemuUpdate(d *schema.ResourceData, meta interface{}) error {
Memory: d.Get("memory").(int),
QemuCores: d.Get("cores").(int),
QemuSockets: d.Get("sockets").(int),
QemuVcpus: d.Get("vcpus").(int),
QemuCpu: d.Get("cpu").(string),
QemuNuma: d.Get("numa").(bool),
Hotplug: d.Get("hotplug").(string),
@ -734,6 +741,7 @@ func resourceVmQemuRead(d *schema.ResourceData, meta interface{}) error {
d.Set("memory", config.Memory)
d.Set("cores", config.QemuCores)
d.Set("sockets", config.QemuSockets)
d.Set("vcpus", config.QemuVcpus)
d.Set("cpu", config.QemuCpu)
d.Set("numa", config.QemuNuma)
d.Set("hotplug", config.Hotplug)