[libvirt-users] Why a max mem setting?

Peter Krempa pkrempa at redhat.com
Tue Aug 28 12:46:59 UTC 2012


On 08/28/12 13:55, Andreas Davour wrote:
>
> Hi

Hi Andreas,
>
> I have just started to investigate the possibilities of resizing memory for my kvm virtual machines on the fly. It works just fine with virsh setmem and that's great. Now, what I'm wondering about is the <memory> directive in the xml domain definition. Why would I not just set that to the size of available RAM in the host machine? Am I missing some nuance or finesse to the handling of memory? What would happen if I had three virtual machines with max set to physical max and then used setmem to give one of the virtual machines more than its third?

The <memory> directive contains the maximum amount of memory you are 
giving to the guest.

While the guest machine is running you can only change the allocation 
for the guest using the memballoon driver, but you can't increase it 
beyond what's set in <memory>. Please note that decreasing the amount 
for a guest works only if the memballoon driver is loaded in the guest. 
While the machine is booting the guest has access to all memory 
specified in <memory> so you might run low on memory when you try to 
start such guests in parallel. (Memory amount allocated to the guest 
using memballoon is stored in element <currentMemory>)

With this you might use this in a scenario, where you have multiple 
guests, but the guests only need large amounts of memory for short time 
and not at the same time. You can then specify that together the 
machines exceed memory of the host, but you return the memory to the 
host using the memballoon driver and assign it back only if you require it.
>
> Thank for any feedback. I could maybe just try the latter out, but I have no machine I could crash if that's the result...
>
> /andreas
>

Peter




More information about the libvirt-users mailing list