XCP Tutorial - Memory Issues with New VMs
As a continuation on my previous XCP Tutorial, I wanted to share some experiences with memory problems that have been a hindrance in my successful installation of new VMs on XCP.
1) Too much memory is taken up in my local storage repository (SR) – with each attempt to create a new VM, memory is put aside on your machine, Virtual Disk Image (VDI), and if you don’t use the VM you will need to release that memory. I discovered that I had about 15 extra VDIs on my machine that was taking memory. Here is what I did:
a) Run xe sr-list type=lvm
RETURN:
uuid ( RO)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â : 07ec20ab-5088-67b1-50fe-a46cc689bc98
name-label ( RW): Local storage
name-description ( RW):
host ( RO): xenserver-reiazupz
type ( RO): lvm
content-type ( RO): user
b) Run xe vdi-list sr-uuid=07ec20ab-5088-67b1-50fe-a46cc689bc98
RETURN: ** In my case I had 15 different uuid (RO) that were listed, I only present 1 example
uuid ( RO)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â : f3ace49e-6afe-4d96-befb-3b86910ea4b0
name-label ( RW): 0
name-description ( RW): Created by template provisioner
sr-uuid ( RO): 07ec20ab-5088-67b1-50fe-a46cc689bc98
virtual-size ( RO): 8589934592
sharable ( RO): false
read-only ( RO): false
c) Run xe vdi-destroy uuid=xxx for each uuid (RO) that you wish to destroy
2) Not enough free memory to run the VM – each server only has so much available memory for each additional VM that you try and start. Here are some commands you can run to determine how much memory is available, how much memory your VM is requesting, and how you can adjust the VM memory request.
a) Determine Amount of Memory Available on Machine
Run xe host-compute-free-memory
RETURN: 664014848
In my example, I only had 664 MB of memory available for a new VM to run in
b) Determine Amount of Memory VM is requesting (use your VM uuid)
Run xe vm-param-list uuid=f0ddc908-79a9-ea0f-7a22-17c8c4bd983c | grep ” memory-”
RETURN:
memory-actual ( RO): 0
memory-target ( RO): 0
memory-overhead ( RO): 1048576
memory-static-max ( RW): 1073741824
memory-dynamic-max ( RW): 1073741824
memory-dynamic-min ( RW): 1073741824
memory-static-min ( RW): 536870912
In this example, my VM was requesting 1 GB of memory so I needed to adjust the VM memory sizes as I only had 664 MB available. The following commands allow you to update the memory for your individual VM.
c) Update VM Memory Requirements
Run these four commands in the order listed below for specfic VM uuid and in this example for 512 MB:
xe vm-param-set uuid=fc84c8f0-3be0-8b05-95db-966b9460d3ac memory-static-min=512000000
xe vm-param-set uuid=fc84c8f0-3be0-8b05-95db-966b9460d3ac memory-dynamic-min=512000000
xe vm-param-set uuid=fc84c8f0-3be0-8b05-95db-966b9460d3ac memory-dynamic-max=512000000
xe vm-param-set uuid=fc84c8f0-3be0-8b05-95db-966b9460d3ac memory-static-max=512000000
After these commands I checked my VM memory requirements and got the following:
xe vm-param-list uuid=f0ddc908-79a9-ea0f-7a22-17c8c4bd983c | grep ” memory-”
memory-actual ( RO): 0
memory-target ( RO): 0
memory-overhead ( RO): 1048576
memory-static-max ( RW): 512000000
memory-dynamic-max ( RW): 512000000
memory-dynamic-min ( RW): 512000000
memory-static-min ( RW): 512000000