Skip to content

Commit

Permalink
numa_memory_spread: Make sure enough memory for guest
Browse files Browse the repository at this point in the history
1. Decrease memory size from the neighbour
2. Drop caches first to make sure host has enough memory

Signed-off-by: Hu Shuai <[email protected]>
  • Loading branch information
hs0210 committed Jul 3, 2023
1 parent 83e7b5e commit 4a5998e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions libvirt/tests/src/numa/numa_memory_spread.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ def prepare_host_for_test(params, test):
format(numa_memory['nodeset'], nodeset_size))
logging.debug('Memory available on a neighbour node {} is {}'.
format(neighbour, nodeset_nb_size))
# Increase a size by 50% of neighbour node
oversize = int(nodeset_size + 0.5 * nodeset_nb_size)
# Increase a size by 25% of neighbour node
oversize = int(nodeset_size + 0.25 * nodeset_nb_size)
# Decrease nodeset size by 25%
undersize = int(nodeset_size * 0.25)
# Memory to eat is a whole nodeset + 10% of neighbour size
memory_to_eat = int(nodeset_size + 0.1 * nodeset_nb_size)
# Memory to eat is a whole nodeset + 5% of neighbour size
memory_to_eat = int(nodeset_size + 0.05 * nodeset_nb_size)
nodeset_string = '{},{}'.format(online_nodes[0], neighbour)
process.run("swapoff -a", shell=True)

Expand Down Expand Up @@ -246,6 +246,8 @@ def run(test, params, env):
nodeset_string = constants[5]
# Prepare VM XML
prepare_vm_xml_for_test(vm_name, numa_memory, oversize, undersize)
# Drop caches first to make sure host has enough memory
utils_memory.drop_caches()
# Start the VM
virsh.start(vm_name, ignore_status=False, debug=True)
session = vm.wait_for_login()
Expand Down

0 comments on commit 4a5998e

Please sign in to comment.