Check if any hugepages are allocated before unallocating them

master
Shoelaceman 4 years ago
parent 89ff109d24
commit 6e5d0ca3b1

@ -1,10 +1,10 @@
#! /bin/bash
#
# Author:
# Author:
#
# This hook automatically (un-)allocates static HugePages when starting/stopping a VM.
# This file depends on the Passthrough POST hook helper script found in this repo.
# Place this script in BOTH these directories (or symlink it):
# Place this script in BOTH these directories (or symlink it):
# $SYSCONFDIR/libvirt/hooks/qemu.d/your_vm/prepare/begin/
# $SYSCONFDIR/libvirt/hooks/qemu.d/your_vm/release/end/
# $SYSCONFDIR usually is /etc/libvirt.
@ -27,5 +27,7 @@ function unallocPages {
echo $HPG_NEW > $HPG_PATH
}
# Call function to unallocate HugePages
unallocPages
# Call function to unallocate HugePages if HugePage count is greater than 0
if [[ HPG_SIZE -gt 0 ]]; then
unallocPages
fi

Loading…
Cancel
Save