How can I change memory resources from within the DomU?
For a certain job I sometimes need more memory in a DomU (CentOS 5). The trigger for the start of the job are some conditions that I can only check within that DomU: The DomU is waiting for an upload. Once it is finished it needs to process the received data - best suited would be a ram-disk.
For this scenario I have set up the DomU with a memory setting of 1 GB min and 16 GB max.
Now I am trying to find an elegant way to resize the memory to max/min from within the DomU.
The first solution for this would be using ssh from DomU to all possible Dom0s and then trigger the "xm mem-set" commands there (with sudo).
I've read some things about the xen-store. Triggers were mentioned... So this makes me think that there should be a better way. It turned out that memory balloning would be a better way.
This should work within the DomU:
echo $((4096*1024*1024)) >/proc/xen/balloon
Should resize the memory to 4 GB.
But: cat /proc/xen/ballon says:
Current allocation: 2165536 kB
Requested target: 4192256 kB
Low-mem balloon: 14611680 kB
High-mem balloon: 0 kB
Driver pages: 0 kB
Xen hard limit: 2165536 kB
Now where does that xen hard limit come from?
Result is now that my DomU has 2 GB RAM. xm list in Dom0 states that the DomU is still at 1 GB RAM...
What's going wrong here? And yes - since the DomU-version is below 3.0.4 I added "mem=16G" as kernel-boot-parameter to my DomU.
With Dom0 SLES11 SP1 (XEN 4.0.1) and CentOS 5.6 DomU (still XEN 3.0.3?) the
echo 4G >/proc/xen/ballon
did not do anything first - but after I did some successful xm mem-sets
from the Dom0 (up to 16 GB - which worked), the /proc/xen/ballon did work within the DomU, too.
Solution 1:
you can use the balloon driver that xen has with min memory and max memory ... it's all dynamic and built in