[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 GitHub
parent ece8297cf8
commit 9b2bc880de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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