Merge pull request #74 from V-Paranoiaque/feature/cpu

Add CPU customization features and hotplug
This commit is contained in:
Grant Gongaware 2019-08-15 10:10:42 -07:00 committed by GitHub
commit 080c8ad2dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 0 deletions

View File

@ -121,10 +121,17 @@ resource "proxmox_vm_qemu" "prepprovision-test" {
cores = 3
sockets = 1
# Same CPU as the Physical host, possible to add cpu flags
# Ex: "host,flags=+md-clear;+pcid;+spec-ctrl;+ssbd;+pdpe1gb"
cpu = "host"
numa = false
memory = 2560
scsihw = "lsi"
# Boot from hard disk (c), CD-ROM (d), network (n)
boot = "cdn"
# It's possible to add this type of material and use it directly
# Possible values are: network,disk,cpu,memory,usb
hotplug = "network,disk,usb"
# Default boot disk
bootdisk = "virtio0"
network {

View File

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

View File

@ -97,6 +97,21 @@ func resourceVmQemu() *schema.Resource {
Optional: true,
Default: 1,
},
"cpu": {
Type: schema.TypeString,
Optional: true,
Default: "host",
},
"numa": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"hotplug": {
Type: schema.TypeString,
Optional: true,
Default: "network,disk,usb",
},
"scsihw": {
Type: schema.TypeString,
Optional: true,
@ -404,6 +419,9 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error {
Memory: d.Get("memory").(int),
QemuCores: d.Get("cores").(int),
QemuSockets: d.Get("sockets").(int),
QemuCpu: d.Get("cpu").(string),
QemuNuma: d.Get("numa").(bool),
Hotplug: d.Get("hotplug").(string),
Scsihw: d.Get("scsihw").(string),
QemuOs: d.Get("qemu_os").(string),
QemuNetworks: qemuNetworks,
@ -566,6 +584,9 @@ func resourceVmQemuUpdate(d *schema.ResourceData, meta interface{}) error {
Memory: d.Get("memory").(int),
QemuCores: d.Get("cores").(int),
QemuSockets: d.Get("sockets").(int),
QemuCpu: d.Get("cpu").(string),
QemuNuma: d.Get("numa").(bool),
Hotplug: d.Get("hotplug").(string),
Scsihw: d.Get("scsihw").(string),
QemuOs: d.Get("qemu_os").(string),
QemuNetworks: qemuNetworks,
@ -658,6 +679,9 @@ 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("cpu", config.QemuCpu)
d.Set("numa", config.QemuNuma)
d.Set("hotplug", config.Hotplug)
d.Set("scsihw", config.Scsihw)
d.Set("qemu_os", config.QemuOs)
// Cloud-init.