Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed the behavior of the use_hot_add attribute to reboot the VM correctly #149

Merged
merged 1 commit into from
Jul 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions nutanix/resource_nutanix_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,9 @@ func resourceNutanixVirtualMachineUpdate(d *schema.ResourceData, meta interface{
metadata = response.Metadata
}

if d.HasChange("use_hot_add") {
useHotAdd = d.Get("use_hot_add").(bool)
}
if d.HasChange("categories") {
metadata.Categories = expandCategories(d.Get("categories"))
}
Expand Down Expand Up @@ -1150,33 +1153,25 @@ func resourceNutanixVirtualMachineUpdate(d *schema.ResourceData, meta interface{
hotPlugChange = false
}
if d.HasChange("guest_os_id") {
_, n := d.GetChange("guest_os_id")
n := d.Get("guest_os_id")
res.GuestOsID = utils.StringPtr(n.(string))
hotPlugChange = false
}
if d.HasChange("num_vcpus_per_socket") {
o, n := d.GetChange("num_vcpus_per_socket")
n := d.Get("num_vcpus_per_socket")
res.NumVcpusPerSocket = utils.Int64Ptr(int64(n.(int)))
if n.(int) < o.(int) || n.(int) > o.(int) {
if !d.Get("use_hot_add").(bool) {
hotPlugChange = false
}
}
hotPlugChange = false
}
if d.HasChange("num_sockets") {
o, n := d.GetChange("num_sockets")
n := d.Get("num_sockets")
res.NumSockets = utils.Int64Ptr(int64(n.(int)))
if n.(int) < o.(int) {
hotPlugChange = false
}
hotPlugChange = false
}
if d.HasChange("memory_size_mib") {
o, n := d.GetChange("memory_size_mib")
n := d.Get("memory_size_mib")
res.MemorySizeMib = utils.Int64Ptr(int64(n.(int)))
if n.(int) < o.(int) {
if !d.Get("use_hot_add").(bool) {
hotPlugChange = false
}
if !d.Get("use_hot_add").(bool) {
hotPlugChange = false
}
}
if d.HasChange("hardware_clock_timezone") {
Expand Down