nutanix / terraform-provider-nutanix

Terraform Nutanix Provider
https://www.terraform.io/docs/providers/nutanix/
Mozilla Public License 2.0
101 stars 112 forks source link

Memory MiB quantity value shows discrepancy in terraform plugin and Prism. #654

Closed abhimutant closed 10 months ago

abhimutant commented 11 months ago

Affected Resource(s)

Steps to reproduce:

  1. Create vm resource with 2044 MiB of RAM
  2. Change TF file to 4096 MiB
  3. Apply the updated TF file and it works fine.
  4. Reapply the same TF file : a change is requested, current RAM value is equal to Prism info
  5. Again, reapply the TF, it works as expected.

On Analysis, seems GET API /v3/vms/<vm_uuid> shows updated value of RAM which is different from TF config. This results a change requested in the current TF config.

abhimutant commented 10 months ago

As per discussion with Prism team, If VM is powered ON then adding memory to VMs can only be done in 1GB increments else rounding up happens automatically. A ticket is tracked to mention this behaviour in API reference doc.

mbilel commented 10 months ago

Hello,

The solution does not seem to be good, I entered multiple values of 1024 for my machines, but nutanix modified them:

Value in code predicted on nutanix actually allocated by nutanix memory_size_mib : 2048mib # =1024 x 2 2Gib 2.95Gib memory_size_mib : 16384mib # = 1024 x 16 16Gib 16.625 Gib

Best regards,

Golgautier commented 10 months ago

Hello,

I did additional tests, here are the results :

TEST 1 I created a VM with TF, then updated memory values with these ones : 2000 -> 2048 -> 3072 -> 4096 Result was : 2000 -> 3024 -> 4048 -> 5072

TEST 2 I created a VM with TF, then updated memory values with these ones : 2048 -> 3072 -> 4000 -> 4096 Result was : 2048 -> 3072 -> 4096 -> 4096

My understanding :

Note : update VM creation feature to enforce 1024 multiple value for memory could be a kind of fix, but we will still have a problem for existing VM with a memory with a non 1024 multiple value for memory.