[Engine-devel] Question about hasMemoryToRunVM() in RunVmCommandBase

ly pan plysab at gmail.com
Thu Oct 18 12:43:35 UTC 2012


Hi:

This is my test environment:
hardware: Dell PowerEdge 2710 ,Memory 48G
Software: OVirt engine 3.0 ,VDSM 4.9.4 ,kernel 2.6.32-279.2.1.el6.x86_64


I create 100 vms from pool(each vm has 512M memory and has
1M memory garanteed, with guest_overhead = 65 and reserved_mem = 256),
but only 83 vms
turn out to run. When I run the 84th vm, engine says there is not
enough memory. However at this time KSM is enabled and 15G free memory
is still left on the host.

I checked the code and found out that before running a vm, the
function hasMemoryToRunVM() in RunVmCommandBase would decide whether
there is enough memory in the selected host to run it.
The Algorithm in the function is like this:
mem_avaliable >= mem_required = curVds.getmem_commited() +
curVds.getpending_vmem_size()
     + curVds.getguest_overhead() + curVds.getreserved_mem() +
vm.getMinAllocatedMem();

And here is my question: curVds.getmem_commited() is caculated from
the memory of vm
assigned by user. But when the host is running with KSM enabled, the
actual memory of each
running vm would be smaller than the memory the user assigned to. In
this case, the following
may occur: engine says there be no more memroy to run any vm while the
host has much free
space to run more vms(in my case, 15G).


Therefore I think the actual memory size reported by vdsm(The KSM
shared memory) should be taken into account when calculating
curVds.getmem_commited(). Any ideas are welcome.



More information about the Devel mailing list