Skip to content

Commit 6ebda75

Browse files
modified CPU logic to support modification of number of vcpus per socket
1 parent c83a8b9 commit 6ebda75

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

nutanix/resource_nutanix_virtual_machine.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -922,15 +922,17 @@ func resourceNutanixVirtualMachineRead(d *schema.ResourceData, meta interface{})
922922
b := make([]string, 0)
923923

924924
if resp.Status.Resources.BootConfig != nil {
925-
if resp.Status.Resources.BootConfig.BootDevice.DiskAddress != nil {
926-
i := strconv.Itoa(int(utils.Int64Value(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.DeviceIndex)))
927-
diskAddress["device_index"] = i
928-
diskAddress["adapter_type"] = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.AdapterType)
925+
if resp.Status.Resources.BootConfig.BootDevice != nil {
926+
if resp.Status.Resources.BootConfig.BootDevice.DiskAddress != nil {
927+
i := strconv.Itoa(int(utils.Int64Value(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.DeviceIndex)))
928+
diskAddress["device_index"] = i
929+
diskAddress["adapter_type"] = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.AdapterType)
930+
}
931+
mac = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.MacAddress)
929932
}
930933
if resp.Status.Resources.BootConfig.BootDeviceOrderList != nil {
931934
b = utils.StringValueSlice(resp.Status.Resources.BootConfig.BootDeviceOrderList)
932935
}
933-
mac = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.MacAddress)
934936
}
935937

936938
d.Set("boot_device_order_list", b)
@@ -1090,7 +1092,7 @@ func resourceNutanixVirtualMachineUpdate(d *schema.ResourceData, meta interface{
10901092
if d.HasChange("num_vcpus_per_socket") {
10911093
o, n := d.GetChange("num_vcpus_per_socket")
10921094
res.NumVcpusPerSocket = utils.Int64Ptr(int64(n.(int)))
1093-
if n.(int) < o.(int) {
1095+
if n.(int) < o.(int) || n.(int) > o.(int) {
10941096
hotPlugChange = false
10951097
}
10961098
}

0 commit comments

Comments
 (0)