Nutanix – Increase/Decrease CVM Memory Allocation CE1/CE2

Decrease/Increase memory allocation of the CVM on Community Edition 1.0 (CE1)

You can attempt different memory allocations, however the lowest I was able to put it at without experiencing issues with the CVM, was 12GB.

1. ssh to root@{AHV_IP}

2. Type the following in the shell: virsh list –all

[root@NTNX-84e038f2-A ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 1     NTNX-84e038f2-A-CVM            running

3. Attempt to shutdown the CVM by running: virsh shutdown NTNX-84e038f2-A-CVM

[root@NTNX-84e038f2-A ~]# virsh shutdown NTNX-84e038f2-A-CVM

Domain NTNX-84e038f2-A-CVM is being shutdown

If the CVM will not shut down due to running VMs, you can shut them down nicely with this command:

for i in $(acli vm.list power_state=on | grep -v NTNX | awk 'NR!=1 {print $NF}');do acli vm.shutdown $i ; done

Confirm the power status of the VMs with this command:

acli vm.list power_state=on

4. Once the CVM is offline, you can run the following commands to adjust the memory allocation

virsh setmem NTNX-84e038f2-A-CVM 12G --config
virsh setmaxmem NTNX-84e038f2-A-CVM 12G --config

5. Once the new allocation is defined, start up your CVM again and verify from UI or using dominfo:

virsh start NTNX-84e038f2-A-CVM
virsh dominfo NTNX-84e038f2-A-CVM

Decrease/Increase memory allocation of the CVM on Community Edition 2.0 (CE2)

As the above procedure would fail on CE2, we will use a different approach, which is as follows:

1. SSH to root@{AHV_IP}

2. Type the following to get the CVM name of which you want to change the memory:

[root@NTNX-1872f42b-A ~]# virsh list --all

 Id   Name                                   State
------------------------------------------------------
 1    NTNX-1872f42b-A-CVM                    running
 2    08fe9bd1-6180-4a58-9c5a-46fb19e330f3   running
 4    5ea7bae8-57da-4943-8915-13248d365505   running
 5    93ca3d8a-87f1-4566-901a-7e403fcab078   running
 6    42a09496-5d26-4ef4-875f-a1fc9829bddd   running
 10   8fe10513-5c9c-46e8-bff3-6abe14e2865a   running
 11   bc9675dd-8045-47c9-8991-2e83513ab593   running
 12   8745b3bc-7f42-4881-b627-2548c180e09c   running

Make sure to shutdown the CVM. If you are having trouble shutting it down, refer to step 3 above.

3. Now that we have the CVM name, edit the dominfo XML, by typing the following:

virsh edit NTNX-1872f42b-A-CVM

4. The file will open in a vi editor, and will look as described below. I have put mine down to 18G of memory. This will be the 18874368 value below, listed at memory unit, currentMemory unit=’KiB’ and memory in cpu and memory tags.

<domain type='kvm'>
  <name>NTNX-1872f42b-A-CVM</name>
  <uuid>46351276-270a-4228-bda0-fa65dd41f42b</uuid>
  <memory unit='KiB'>18874368</memory>
  <currentMemory unit='KiB'>18874368</currentMemory>
  <memoryBacking>
    <hugepages/>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static' cpuset='0-23'>6</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.6.0' max_ram_below_4g='536870912'>hvm</type>
    <boot dev='cdrom'/>
    <bootmenu enable='no'/>
  </os>
  <features>
    <acpi/>
    <apic eoi='on'/>
    <pae/>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='6' threads='1'/>
    <numa>
      <cell id='0' cpus='0-5' memory='18874368' unit='KiB' memAccess='shared'/>
    </numa>
  </cpu>

Hints: In order to edit the file, press I to insert the new values – press ESCAPE followed by :wq to write and quit the editor.

5. Confirm the changes in the dominfo and start the CVM again:

[root@NTNX-1872f42b-A ~]# virsh dominfo NTNX-1872f42b-A-CVM

Id:             1
Name:           NTNX-1872f42b-A-CVM
UUID:           46351276-270a-4228-bda0-fa65dd41f42b
OS Type:        hvm
State:          running
CPU(s):         6
CPU time:       79411.6s
Max memory:     18874368 KiB
Used memory:    18874368 KiB
Persistent:     yes
Autostart:      enable
Managed save:   no
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c339,c822 (enforcing)
[root@NTNX-1872f42b-A ~]# virsh start NTNX-1872f42b-A-CVM

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *