[Kimchi-devel] [RFC] Memory HotPlug changes to fix issues

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Thu Feb 25 18:15:12 UTC 2016


Hi all,

with latest changes in Kimchi backend/frontend (enable Memory 
hotplug[UI] and support to update MaxMemory) I am facing
a new issue related to maxMemory:

How is done today:
- whenever a user adds memory when guest is running, Kimchi is going to 
add enough 1GiB Memory Device to guest XML;
- when user changes the Memory in a offline guest, Kimchi is going to 
change the value in  "NUMA -> Memory"  tag, which becomes 
"currentMemory" tag
- the value in "NUMA -> Memory" plus the sum of 1GiB Memory Devices 
(DIMM) added , become the "memory" tag

Problem:
- the memory devices added are persistent, once added user will never be 
able to remove them, except editing the guest XML;
- libvirt does not provide memory hot-unplug;
- so, when user turns off the guest that has memory devices and try to 
increase or decrease the amount of memory,
   the new value is going to be be sum with memory devices amount, 
causing most of the time to errors with value of "maxMemory" configured.

Example1:
- Guest has configured 4GB maxMemory,  2GB currentMemory|Numa->memory , 
0 Memory Devices, 2GB memory
- Run guest and add 2GB -> 4GB maxMemory,  2GB 
currentMemory|Numa->memory,  2x1GB Memory Devices, 4GB memory
- Stop guest and edit it. The memory field is going to show 4GB
- Change memory fileld to 3GB (decrease) -> 4GB maxMemory,  3GB 
currentMemory|Numa->memory,  2x1GB Memory Devices,  5GB memory
Notice the error: memory > maxMemory

Example2:
- Guest has configured 4GB maxMemory,  1GB currentMemory|Numa->memory , 
0 Memory Devices, 1GB memory
- Run guest and add 2GB -> 4GB maxMemory,  1GB 
currentMemory|Numa->memory,  2x1GB Memory Devices, 3GB memory
- Stop guest and edit it. The memory field is going to show 3GB
- Change memory field to 4GB (increase) -> 4GB maxMemory, 4GB 
currentMemory|Numa->memory,  2x1GB Memory Devices,  6GB memory
Notice the error: memory > maxMemory

------

Possible Solution 1:
- Make memory devices NOT persistent. Then when guest is turn off, 
memory back to lower values configured before the memory hotplug action;

Possible Solution 2:
- Change memory update function to check if there are memory devices 
configured and adjust the number of devices according to the new value 
passed.
Ex.:
- Stopped guest has:   6GB maxMemory,  2GB currentMemory|Numa->memory,  
2x1GB Memory Devices, 4GB memory
- Change memory field to 3GB (decrease) -> 4GB maxMemory, 2GB 
currentMemory|Numa->memory,  1x1GB Memory Devices,  3GB memory
Notice: memory device was removed instead of change the currentMemory


Solution 1 is simpler and quicker to implement.
Solution 2 seems to be the best, but will demand more time to code and 
specially test.

What you think ?

Rodrigo Trujillo





















More information about the Kimchi-devel mailing list