Skip to content

Commit

Permalink
New feature, HA management
Browse files Browse the repository at this point in the history
  • Loading branch information
V-Paranoiaque committed Oct 29, 2019
1 parent 7a4a86f commit f4ce536
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ resource "proxmox_vm_qemu" "prepprovision-test" {
hotplug = "network,disk,usb"
# Default boot disk
bootdisk = "virtio0"
# HA, you need to use a shared disk for this feature (ex: rbd)
hastate = ""
network {
id = 0
model = "virtio"
Expand Down
7 changes: 7 additions & 0 deletions proxmox/resource_vm_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ func resourceVmQemu() *schema.Resource {
ForceNew: true,
Default: true,
},
"hastate": {
Type: schema.TypeString,
Optional: true,
},
"qemu_os": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -442,6 +446,7 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error {
QemuNuma: d.Get("numa").(bool),
Hotplug: d.Get("hotplug").(string),
Scsihw: d.Get("scsihw").(string),
HaState: d.Get("hastate").(string),
QemuOs: d.Get("qemu_os").(string),
QemuNetworks: qemuNetworks,
QemuDisks: qemuDisks,
Expand Down Expand Up @@ -615,6 +620,7 @@ func resourceVmQemuUpdate(d *schema.ResourceData, meta interface{}) error {
QemuNuma: d.Get("numa").(bool),
Hotplug: d.Get("hotplug").(string),
Scsihw: d.Get("scsihw").(string),
HaState: d.Get("hastate").(string),
QemuOs: d.Get("qemu_os").(string),
QemuNetworks: qemuNetworks,
QemuDisks: qemuDisks,
Expand Down Expand Up @@ -712,6 +718,7 @@ func resourceVmQemuRead(d *schema.ResourceData, meta interface{}) error {
d.Set("numa", config.QemuNuma)
d.Set("hotplug", config.Hotplug)
d.Set("scsihw", config.Scsihw)
d.Set("hastate", vmr.HaState())
d.Set("qemu_os", config.QemuOs)
// Cloud-init.
d.Set("ciuser", config.CIuser)
Expand Down

0 comments on commit f4ce536

Please sign in to comment.