[Fedora-xen] freeing up memory back to Domain-0

Richard W.M. Jones rjones at redhat.com
Tue Aug 21 11:28:25 UTC 2007


Justin Conover wrote:

[These are a couple of frequently asked questions ... do we have an FAQ?]

> How can you free up memory when you shut a guest down?  Give back to 
> Domain-0 so you can start another one up?

Domain-0 doesn't recover the memory when a domain shuts down.  The 
assumption (within Xen) is that another domain will be starting up 
shortly, so there is no point wasting time returning the memory to Domain-0.

However the memory hasn't just gone away, as your question implies.  The 
hypervisor is still managing that free memory, and will give it to the 
next guest which starts up.

If you really want to give the free memory back to Domain-0, then I 
think you can do it by:

   virsh setmem Domain-0 <kb>

where <kb> is the total number of kilobytes that you want Domain-0 to 
have (ie. current size + size of freed guest -- you have to calculate 
this for yourself).

> Also, were are the profiles for xen stored?  For example I create all of 
> them under /vm/xen/blah if I decide to delete blah1 and create a new one 
> named blah1 it says it is already there, even though I removed it.

Since Xen 3.0.3 or 3.0.4, I forget exactly which, Xen manages the 
profiles in its own private place.  So there are no configuration files. 
  I agree that this is very annoying, but that's the way Xen forces us 
to do it.

To view or edit a configuration file, you now have to do:

   virsh dumpxml domain > domain.xml
   edit domain.xml
   virsh define domain.xml

('virsh define' only works if the domain has been shutdown, so if it is 
still running then shut it down first using 'virsh shutdown').

If you want to make a change to a running domain, there are some changes 
which you are allowed to do, basically adding and removing block and 
network devices, and adding and removing memory.  The commands to use are:

   virsh attach-device
   virsh attach-disk
   virsh attach-interface
   virsh detach-device
   virsh detach-disk
   virsh detach-interface
   virsh setmem
   virsh setmaxmem

(Just do 'virsh help command' to get help on each of those commands).

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/fedora-xen/attachments/20070821/84c5b541/attachment.bin>


More information about the Fedora-xen mailing list