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

Roy Golan rgolan at redhat.com
Thu Oct 18 13:17:24 UTC 2012


On 10/18/2012 02:50 PM, Itamar Heim wrote:
> On 10/18/2012 02:43 PM, ly pan wrote:
>> 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
>
> iirc, getmem_committed is the amount of memory actually used on the 
> host, as vdsm reports.
its actually the sum of static memory per running VM on the host(as 
mentioned below)
>
>> 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.
>>

in short we rather depend on static resource allocation - for scheduling 
new VMs we have to guarantee the amount of memory defined for them is 
reserved.
Free Memory by KSM is subjected to reallocation - say you updated one of 
the VMs OS, the pages are no longer equal and more memory is allocated 
for them.
>
>
> _______________________________________________
> Engine-devel mailing list
> Engine-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/engine-devel




More information about the Engine-devel mailing list