{"id":425,"date":"2024-05-20T12:09:02","date_gmt":"2024-05-20T10:09:02","guid":{"rendered":"https:\/\/binaryvikings.io\/?p=425"},"modified":"2024-05-20T12:09:02","modified_gmt":"2024-05-20T10:09:02","slug":"nutanix-increase-decrease-cvm-memory-allocation-ce1-ce2","status":"publish","type":"post","link":"https:\/\/binaryvikings.io\/?p=425","title":{"rendered":"Nutanix &#8211; Increase\/Decrease CVM Memory Allocation CE1\/CE2"},"content":{"rendered":"<div class=\"wp-block-table-of-contents-block-table-of-contents-block\"><div class=\"eb-parent-wrapper eb-parent-eb-toc-x52ib \"><div class=\"eb-toc-container eb-toc-x52ib  eb-toc-is-not-sticky eb-toc-not-collapsible eb-toc-initially-not-collapsed eb-toc-scrollToTop style-1 list-style-none\" data-scroll-top=\"false\" data-scroll-top-icon=\"fas fa-angle-up\" data-collapsible=\"false\" data-sticky-hide-mobile=\"false\" data-sticky=\"false\" data-scroll-target=\"scroll_to_toc\" data-copy-link=\"false\" data-editor-type=\"\" data-hide-desktop=\"false\" data-hide-tab=\"false\" data-hide-mobile=\"false\" data-itemCollapsed=\"false\"><div class=\"eb-toc-header\"><div class=\"eb-toc-title\">Table of Contents<\/div><\/div><div class=\"eb-toc-wrapper \" data-headers=\"[{&quot;level&quot;:3,&quot;content&quot;:&quot;Decrease\\\/Increase memory allocation of the CVM on Community Edition 1.0 (CE1)&quot;,&quot;text&quot;:&quot;Decrease\\\/Increase memory allocation of the CVM on Community Edition 1.0 (CE1)&quot;,&quot;link&quot;:&quot;decreaseincrease-memory-allocation-of-the-cvm-on-community-edition-10-ce1&quot;},{&quot;level&quot;:3,&quot;content&quot;:&quot;Decrease\\\/Increase memory allocation of the CVM on Community Edition 2.0 (CE2)&quot;,&quot;text&quot;:&quot;Decrease\\\/Increase memory allocation of the CVM on Community Edition 2.0 (CE2)&quot;,&quot;link&quot;:&quot;decreaseincrease-memory-allocation-of-the-cvm-on-community-edition-20-ce2&quot;}]\" data-visible=\"[true,true,true,true,true,true]\" data-delete-headers=\"[{&quot;label&quot;:&quot;Decrease\\\/Increase memory allocation of the CVM on Community Edition 1.0 (CE1)&quot;,&quot;value&quot;:&quot;decreaseincrease-memory-allocation-of-the-cvm-on-community-edition-10-ce1&quot;,&quot;isDelete&quot;:false},{&quot;label&quot;:&quot;Decrease\\\/Increase memory allocation of the CVM on Community Edition 2.0 (CE2)&quot;,&quot;value&quot;:&quot;decreaseincrease-memory-allocation-of-the-cvm-on-community-edition-20-ce2&quot;,&quot;isDelete&quot;:false}]\" data-smooth=\"true\" data-top-offset=\"\"><div class=\"eb-toc__list-wrap\"><ul class='eb-toc__list'><li><a href=\"#decreaseincrease-memory-allocation-of-the-cvm-on-community-edition-10-ce1\">Decrease\/Increase memory allocation of the CVM on Community Edition 1.0 (CE1)<\/a><li><a href=\"#decreaseincrease-memory-allocation-of-the-cvm-on-community-edition-20-ce2\">Decrease\/Increase memory allocation of the CVM on Community Edition 2.0 (CE2)<\/a><\/ul><\/div><\/div><\/div><\/div><\/div>\n\n\n<h3 class=\"wp-block-heading\">Decrease\/Increase memory allocation of the CVM on Community Edition 1.0 (CE1)<\/h3>\n\n\n\n<p>You can attempt different memory allocations, however the lowest I was able to put it at without experiencing issues with the CVM, was 12GB.<\/p>\n\n\n\n<p>1. ssh to root@{AHV_IP}<\/p>\n\n\n\n<p>2. Type the following in the shell: <strong>virsh list &#8211;all<\/strong><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>[root@NTNX-84e038f2-A ~]# virsh list --all\n Id    Name                           State\n----------------------------------------------------\n 1     NTNX-84e038f2-A-CVM            running<\/code><\/pre><\/div>\n\n\n\n<p>3. Attempt to shutdown the CVM by running: <strong>virsh shutdown NTNX-84e038f2-A-CVM<\/strong><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>[root@NTNX-84e038f2-A ~]# virsh shutdown NTNX-84e038f2-A-CVM\n\nDomain NTNX-84e038f2-A-CVM is being shutdown<\/code><\/pre><\/div>\n\n\n\n<p><em>If the CVM will not shut down due to running VMs, you can shut them down nicely with this command:<\/em><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>for i in $(acli vm.list power_state=on | grep -v NTNX | awk &#39;NR!=1 {print $NF}&#39;);do acli vm.shutdown $i ; done<\/code><\/pre><\/div>\n\n\n\n<p><em>Confirm the power status of the VMs with this command:<\/em><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>acli vm.list power_state=on<\/code><\/pre><\/div>\n\n\n\n<p>4. Once the CVM is offline, you can run the following commands to adjust the memory allocation<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>virsh setmem NTNX-84e038f2-A-CVM 12G --config\nvirsh setmaxmem NTNX-84e038f2-A-CVM 12G --config<\/code><\/pre><\/div>\n\n\n\n<p>5. Once the new allocation is defined, start up your CVM again and verify from UI or using <em>dominfo<\/em>:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>virsh start NTNX-84e038f2-A-CVM\nvirsh dominfo NTNX-84e038f2-A-CVM<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Decrease\/Increase memory allocation of the CVM on Community Edition 2.0 (CE2)<\/h3>\n\n\n\n<p>As the above procedure would fail on CE2, we will use a different approach, which is as follows:<\/p>\n\n\n\n<p>1. SSH to root@{AHV_IP}<\/p>\n\n\n\n<p>2. Type the following to get the CVM name of which you want to change the memory:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>[root@NTNX-1872f42b-A ~]# virsh list --all\n\n Id   Name                                   State\n------------------------------------------------------\n 1    NTNX-1872f42b-A-CVM                    running\n 2    08fe9bd1-6180-4a58-9c5a-46fb19e330f3   running\n 4    5ea7bae8-57da-4943-8915-13248d365505   running\n 5    93ca3d8a-87f1-4566-901a-7e403fcab078   running\n 6    42a09496-5d26-4ef4-875f-a1fc9829bddd   running\n 10   8fe10513-5c9c-46e8-bff3-6abe14e2865a   running\n 11   bc9675dd-8045-47c9-8991-2e83513ab593   running\n 12   8745b3bc-7f42-4881-b627-2548c180e09c   running<\/code><\/pre><\/div>\n\n\n\n<p><em>Make sure to shutdown the CVM. If you are having trouble shutting it down, refer to <strong>step 3<\/strong> above.<\/em><\/p>\n\n\n\n<p>3. Now that we have the CVM name, edit the dominfo XML, by typing the following:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>virsh edit NTNX-1872f42b-A-CVM<\/code><\/pre><\/div>\n\n\n\n<p>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 <strong>18874368 <\/strong>value below, listed at <strong><em>memory unit<\/em><\/strong>, <strong><em>currentMemory unit=&#8217;KiB&#8217;<\/em><\/strong> and <strong><em>memory<\/em><\/strong> in <em>cpu<\/em> and <em>memory<\/em> tags.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-html\" data-lang=\"HTML\"><code>&lt;domain type=&#39;kvm&#39;&gt;\n  &lt;name&gt;NTNX-1872f42b-A-CVM&lt;\/name&gt;\n  &lt;uuid&gt;46351276-270a-4228-bda0-fa65dd41f42b&lt;\/uuid&gt;\n  &lt;memory unit=&#39;KiB&#39;&gt;18874368&lt;\/memory&gt;\n  &lt;currentMemory unit=&#39;KiB&#39;&gt;18874368&lt;\/currentMemory&gt;\n  &lt;memoryBacking&gt;\n    &lt;hugepages\/&gt;\n    &lt;nosharepages\/&gt;\n  &lt;\/memoryBacking&gt;\n  &lt;vcpu placement=&#39;static&#39; cpuset=&#39;0-23&#39;&gt;6&lt;\/vcpu&gt;\n  &lt;resource&gt;\n    &lt;partition&gt;\/machine&lt;\/partition&gt;\n  &lt;\/resource&gt;\n  &lt;os&gt;\n    &lt;type arch=&#39;x86_64&#39; machine=&#39;pc-i440fx-rhel7.6.0&#39; max_ram_below_4g=&#39;536870912&#39;&gt;hvm&lt;\/type&gt;\n    &lt;boot dev=&#39;cdrom&#39;\/&gt;\n    &lt;bootmenu enable=&#39;no&#39;\/&gt;\n  &lt;\/os&gt;\n  &lt;features&gt;\n    &lt;acpi\/&gt;\n    &lt;apic eoi=&#39;on&#39;\/&gt;\n    &lt;pae\/&gt;\n  &lt;\/features&gt;\n  &lt;cpu mode=&#39;host-passthrough&#39; check=&#39;none&#39; migratable=&#39;on&#39;&gt;\n    &lt;topology sockets=&#39;1&#39; dies=&#39;1&#39; cores=&#39;6&#39; threads=&#39;1&#39;\/&gt;\n    &lt;numa&gt;\n      &lt;cell id=&#39;0&#39; cpus=&#39;0-5&#39; memory=&#39;18874368&#39; unit=&#39;KiB&#39; memAccess=&#39;shared&#39;\/&gt;\n    &lt;\/numa&gt;\n  &lt;\/cpu&gt;\n<\/code><\/pre><\/div>\n\n\n\n<p><em>Hints: <\/em>In order to edit the file, press<strong> I <\/strong>to insert the new values &#8211; press <strong>ESCAPE<\/strong> followed by <strong>:wq<\/strong> to write and quit the editor.<\/p>\n\n\n\n<p>5. Confirm the changes in the dominfo and start the CVM again:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>[root@NTNX-1872f42b-A ~]# virsh dominfo NTNX-1872f42b-A-CVM\n\nId:             1\nName:           NTNX-1872f42b-A-CVM\nUUID:           46351276-270a-4228-bda0-fa65dd41f42b\nOS Type:        hvm\nState:          running\nCPU(s):         6\nCPU time:       79411.6s\nMax memory:     18874368 KiB\nUsed memory:    18874368 KiB\nPersistent:     yes\nAutostart:      enable\nManaged save:   no\nSecurity model: selinux\nSecurity DOI:   0\nSecurity label: system_u:system_r:svirt_t:s0:c339,c822 (enforcing)<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>[root@NTNX-1872f42b-A ~]# virsh start NTNX-1872f42b-A-CVM<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>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<\/p>\n","protected":false},"author":1,"featured_media":243,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","footnotes":""},"categories":[34,17],"tags":[],"class_list":["post-425","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nutanix","category-virtual-machines"],"_links":{"self":[{"href":"https:\/\/binaryvikings.io\/index.php?rest_route=\/wp\/v2\/posts\/425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/binaryvikings.io\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/binaryvikings.io\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/binaryvikings.io\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/binaryvikings.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=425"}],"version-history":[{"count":5,"href":"https:\/\/binaryvikings.io\/index.php?rest_route=\/wp\/v2\/posts\/425\/revisions"}],"predecessor-version":[{"id":491,"href":"https:\/\/binaryvikings.io\/index.php?rest_route=\/wp\/v2\/posts\/425\/revisions\/491"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/binaryvikings.io\/index.php?rest_route=\/wp\/v2\/media\/243"}],"wp:attachment":[{"href":"https:\/\/binaryvikings.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/binaryvikings.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/binaryvikings.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}