Skip to content

Memory hot-plug increase causing VM power off when using nutanix_virtual_machine_v2 resource #1105

@bbiegun-te

Description

@bbiegun-te

On an attempt of increase memory on a VM which supports hot-plug addition the VM is being powered off when using the nutanix_virtual_machine_v2 resource.

The Nutanix documentation claims, that such operation is supported:

You can increase the memory allocation and (...) the number of vCPUs (sockets) while the VMs are powered on.

Ref: https://portal.nutanix.com/page/documents/details?targetId=AHV-Admin-Guide-v11_0:ahv-vm-memory-and-cpu-configuration-c.html

Recycling the VM is caused by incorrect condition under resource_nutanix_virtual_machine_v2.checkForHotPlugChanges() function.

There is no indication coming from the provider that a VM will be restarted on applying the changes.

Same change in UI doesn't cause the VM to be restarted.

Nutanix Cluster Information

  • Nutanix Cluster (Prism Element / AOS): 7.3.1.1
  • Nutanix Prism Central: pc.7.3.1.1

Terraform Version

Terraform v1.14.7 on linux_amd64
nutanix/nutanix v2.3.4
I'm unable to use the newest version of the provider as it is incompatible with PC. Mentioned code haven't changed between the versions.

Affected Resource(s)

  • nutanix_virtual_machine_v2

Terraform Configuration Files

resource "nutanix_virtual_machine_v2" "compute" {
  memory_size_bytes    = var.computes_memory_size_mb * 1024 * 1024
  num_cores_per_socket = 1
  num_sockets          = var.computes_num_vcpus
  ...
}

Debug Output

Panic Output

Expected Behavior

VM memory is updated without power cycling the VM.

Actual Behavior

VM is being power cycled on increasing memory for hot-plug enabled VM.

Steps to Reproduce

  1. create a VM with 1GB of memory using nutanix_virtual_machine_v2 resource
  2. terraform apply
  3. set VM memory to 2GB in terraform
  4. terraform apply

Important Factors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions