[Users] hot add ram to a vm

Doron Fediuck dfediuck at redhat.com
Mon Dec 16 13:41:31 UTC 2013



----- Original Message -----
> From: "Andrew Cathrow" <acathrow at redhat.com>
> To: "Sander Grendelman" <sander at grendelman.com>
> Cc: users at ovirt.org
> Sent: Monday, December 16, 2013 2:05:00 PM
> Subject: Re: [Users] hot add ram to a vm
> 
> 
> 
> ----- Original Message -----
> > From: "Sander Grendelman" <sander at grendelman.com>
> > To: "Michal Skrivanek" <michal.skrivanek at redhat.com>
> > Cc: users at ovirt.org
> > Sent: Friday, December 13, 2013 8:52:42 AM
> > Subject: Re: [Users] hot add ram to a vm
> > 
> > On Fri, Dec 13, 2013 at 1:42 PM, Michal Skrivanek
> > <michal.skrivanek at redhat.com> wrote:
> > > Too bad QEMU doesn't support it. So it's still a long way.
> > 
> > qemu/libvirt "kind of" supports it (at least in F19).
> > 
> > In virt-manager you can define "current" and "maximum" memory
> > allocation.
> > 
> > The VM only sees the current allocation and you can hot add memory up
> > to the maximum allocation.
> 
> 
> It isn't really hot-plug.
> This allows you to statically set the physical ram but then use the balloon
> device to "borrow" some ram from the guest.
> If max memory was 4gb and we set current memory to 2gb the VM would still see
> 4gb of physical memory but the balloon driver would be taking up 2gb of
> memory in the guest, this memory would be returned to the host for other VMs
> to use.
> 
> 

Right, currentMemory is how you manipulate the balloon:
http://libvirt.org/formatdomain.html#elementsMemoryAllocation

Note that is requires an agent, a driver and cooperation from the guest.

> > 
> > Example from the xml definition:
> > 
> >   <memory unit='KiB'>3145728</memory>
> >   <currentMemory unit='KiB'>1048576</currentMemory>
> > 
> > After booting:
> > 
> > [root at grkvm201 ~]# uname -a
> > Linux grkvm201.plusine.intern 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed
> > Oct 16 18:37:12 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
> > [root at grkvm201 ~]# free -lm
> >              total       used       free     shared    buffers
> >                  cached
> > Mem:           837        296        540          0          8
> >         84
> > Low:           837        296        540
> > High:            0          0          0
> > -/+ buffers/cache:        203        634
> > Swap:          511          0        511
> > [root at grkvm201 ~]#
> > 
> > memory increased to 2GB through virt-manager:
> > 
> > [root at grkvm201 ~]# free -lm
> >              total       used       free     shared    buffers
> >                  cached
> > Mem:          1861        295       1565          0          8
> >         84
> > Low:          1861        295       1565
> > High:            0          0          0
> > -/+ buffers/cache:        202       1659
> > Swap:          511          0        511
> > [root at grkvm201 ~]# cat /proc/meminfo
> > MemTotal:        1906176 kB
> > MemFree:         1603456 kB
> > Buffers:            9140 kB
> > Cached:            86860 kB
> > SwapCached:            0 kB
> > Active:            92564 kB
> > Inactive:          68064 kB
> > Active(anon):      68692 kB
> > Inactive(anon):       12 kB
> > Active(file):      23872 kB
> > Inactive(file):    68052 kB
> > Unevictable:       21600 kB
> > Mlocked:           11380 kB
> > SwapTotal:        524280 kB
> > SwapFree:         524280 kB
> > Dirty:                12 kB
> > Writeback:             0 kB
> > AnonPages:         86232 kB
> > Mapped:            20436 kB
> > Shmem:               288 kB
> > Slab:              75132 kB
> > SReclaimable:      14576 kB
> > SUnreclaim:        60556 kB
> > KernelStack:        1464 kB
> > PageTables:         4224 kB
> > NFS_Unstable:          0 kB
> > Bounce:                0 kB
> > WritebackTmp:          0 kB
> > CommitLimit:     1477368 kB
> > Committed_AS:     547624 kB
> > VmallocTotal:   34359738367 kB
> > VmallocUsed:       20040 kB
> > VmallocChunk:   34359688500 kB
> > HardwareCorrupted:     0 kB
> > AnonHugePages:     18432 kB
> > HugePages_Total:       0
> > HugePages_Free:        0
> > HugePages_Rsvd:        0
> > 
> > Memory decreased to 1,5GB through virt-manager:
> > [root at grkvm201 ~]# free -lm
> >              total       used       free     shared    buffers
> >                  cached
> > Mem:          1349        295       1054          0          8
> >         84
> > Low:          1349        295       1054
> > High:            0          0          0
> > -/+ buffers/cache:        201       1147
> > Swap:          511          0        511
> > [root at grkvm201 ~]#
> > _______________________________________________
> > Users mailing list
> > Users at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/users
> > 
> > 
> > 
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 



More information about the Users mailing list