[kvm]: add debug cmd for build_kvm_image.sh (#6472)

dump netstat info on error

Signed-off-by: Guohan Lu <lguohan@gmail.com>
This commit is contained in:
lguohan 2021-01-17 11:05:33 -08:00 committed by Guohan Lu
parent c7058a6d15
commit 17148d70fc

View File

@ -22,6 +22,7 @@ on_exit()
on_error()
{
netstat -antp
echo "============= kvm_log =============="
cat $kvm_log
}
@ -51,12 +52,12 @@ create_disk
prepare_installer_disk
echo "Prepare memory for KVM build: $vs_build_prepare_mem"
sudo mount proc /proc -t proc || true
mount proc /proc -t proc || true
free -m
if [[ "$vs_build_prepare_mem" == "yes" ]]; then
# Force o.s. to drop cache and compact memory so that KVM can get 2G memory
sudo bash -c 'echo 1 > /proc/sys/vm/drop_caches'
sudo bash -c 'echo 1 > /proc/sys/vm/compact_memory'
bash -c 'echo 1 > /proc/sys/vm/drop_caches'
bash -c 'echo 1 > /proc/sys/vm/compact_memory'
free -m
fi