Skip to content

Commit

Permalink
modified CPU logic to support modification of number of vcpus per socket
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickstruyf3 committed Apr 3, 2020
1 parent c83a8b9 commit 6ebda75
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions nutanix/resource_nutanix_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -922,15 +922,17 @@ func resourceNutanixVirtualMachineRead(d *schema.ResourceData, meta interface{})
b := make([]string, 0)

if resp.Status.Resources.BootConfig != nil {
if resp.Status.Resources.BootConfig.BootDevice.DiskAddress != nil {
i := strconv.Itoa(int(utils.Int64Value(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.DeviceIndex)))
diskAddress["device_index"] = i
diskAddress["adapter_type"] = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.AdapterType)
if resp.Status.Resources.BootConfig.BootDevice != nil {
if resp.Status.Resources.BootConfig.BootDevice.DiskAddress != nil {
i := strconv.Itoa(int(utils.Int64Value(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.DeviceIndex)))
diskAddress["device_index"] = i
diskAddress["adapter_type"] = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.AdapterType)
}
mac = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.MacAddress)
}
if resp.Status.Resources.BootConfig.BootDeviceOrderList != nil {
b = utils.StringValueSlice(resp.Status.Resources.BootConfig.BootDeviceOrderList)
}
mac = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.MacAddress)
}

d.Set("boot_device_order_list", b)
Expand Down Expand Up @@ -1090,7 +1092,7 @@ func resourceNutanixVirtualMachineUpdate(d *schema.ResourceData, meta interface{
if d.HasChange("num_vcpus_per_socket") {
o, n := d.GetChange("num_vcpus_per_socket")
res.NumVcpusPerSocket = utils.Int64Ptr(int64(n.(int)))
if n.(int) < o.(int) {
if n.(int) < o.(int) || n.(int) > o.(int) {
hotPlugChange = false
}
}
Expand Down

0 comments on commit 6ebda75

Please sign in to comment.