Skip to content

Commit

Permalink
Merge pull request Telmate#118 from claudusd/node_migration
Browse files Browse the repository at this point in the history
Node migration
  • Loading branch information
ggongaware committed Dec 2, 2019
2 parents 092372c + cbd4592 commit c4f2bac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/Telmate/terraform-provider-proxmox
go 1.13

require (
github.com/Telmate/proxmox-api-go v0.0.0-20191118163006-e19e15df9a1a
github.com/Telmate/proxmox-api-go v0.0.0-20191202165429-ba1b7dd050aa
github.com/hashicorp/terraform v0.12.10
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ github.com/Telmate/proxmox-api-go v0.0.0-20191014161547-75a2e0ff0773 h1:DZbCgi+0
github.com/Telmate/proxmox-api-go v0.0.0-20191014161547-75a2e0ff0773/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ=
github.com/Telmate/proxmox-api-go v0.0.0-20191104165655-ab21e7f8ad14 h1:5YRnEl50jAmeO/kZ/LJN/q3oPoXYcCD/IUGZfog5yN8=
github.com/Telmate/proxmox-api-go v0.0.0-20191104165655-ab21e7f8ad14/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ=
github.com/Telmate/proxmox-api-go v0.0.0-20191118163006-e19e15df9a1a h1:xnQrWYewKAFD1irU+dgktE3troeSnq2yE4XGqzoOIio=
github.com/Telmate/proxmox-api-go v0.0.0-20191118163006-e19e15df9a1a/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ=
github.com/Telmate/proxmox-api-go v0.0.0-20191202165429-ba1b7dd050aa h1:Ypr/7Agl67RX/6iQ3fW+tHJPul14xFwttXC0d5xNdxg=
github.com/Telmate/proxmox-api-go v0.0.0-20191202165429-ba1b7dd050aa/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ=
github.com/Unknwon/com v0.0.0-20151008135407-28b053d5a292/go.mod h1:KYCjqMOeHpNuTOiFQU6WEcTG7poCJrUs0YgyHNtn1no=
github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw=
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
Expand Down
13 changes: 12 additions & 1 deletion proxmox/resource_vm_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func resourceVmQemu() *schema.Resource {
"target_node": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"onboot": {
Type: schema.TypeBool,
Expand Down Expand Up @@ -614,6 +613,18 @@ func resourceVmQemuUpdate(d *schema.ResourceData, meta interface{}) error {
serials := d.Get("serial").(*schema.Set)
qemuSerials := DevicesSetToMap(serials)

d.Partial(true)
if d.HasChange("target_node") {
_, err := client.MigrateNode(vmr, d.Get("target_node").(string), true)
if err != nil {
pmParallelEnd(pconf)
return err
}
d.SetPartial("target_node")
vmr.SetNode(d.Get("target_node").(string))
}
d.Partial(false)

config := pxapi.ConfigQemu{
Name: d.Get("name").(string),
Description: d.Get("desc").(string),
Expand Down

0 comments on commit c4f2bac

Please sign in to comment.