From 143a2151fbd0cc3f417f3d82264fa2e3118aeaf7 Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 6 Dec 2023 05:37:03 +0100 Subject: [PATCH] fix: Increase timeout (#431) * fix: Increase timeout --- src/check.sh | 2 +- src/power.sh | 9 ++++----- src/print.sh | 2 +- src/serial.sh | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/check.sh b/src/check.sh index 8fdab35..788d675 100644 --- a/src/check.sh +++ b/src/check.sh @@ -9,7 +9,7 @@ file="/run/dsm.url" if [ ! -f "$file" ]; then # Retrieve IP from guest VM for Docker healthcheck - RESPONSE=$(curl -s -m 16 -S http://127.0.0.1:2210/read?command=10 2>&1) + RESPONSE=$(curl -s -m 30 -S http://127.0.0.1:2210/read?command=10 2>&1) if [[ ! "${RESPONSE}" =~ "\"success\"" ]] ; then echo "Failed to connect to guest: $RESPONSE" && exit 1 diff --git a/src/power.sh b/src/power.sh index eda20bd..c95ab87 100644 --- a/src/power.sh +++ b/src/power.sh @@ -5,7 +5,6 @@ set -Eeuo pipefail QEMU_PORT=7100 QEMU_TIMEOUT=50 - QEMU_PID=/run/qemu.pid QEMU_COUNT=/run/qemu.count @@ -26,18 +25,18 @@ _graceful_shutdown() { [ ! -f "${QEMU_PID}" ] && exit 130 [ -f "${QEMU_COUNT}" ] && return - echo && info "Received $1 signal, shutting down..." echo 0 > "${QEMU_COUNT}" + echo && info "Received $1 signal, shutting down..." # Don't send the powerdown signal because vDSM ignores ACPI signals # echo 'system_powerdown' | nc -q 1 -w 1 localhost "${QEMU_PORT}" > /dev/null # Send shutdown command to guest agent via serial port - RESPONSE=$(curl -s -m 5 -S http://127.0.0.1:2210/read?command=6 2>&1) + RESPONSE=$(curl -s -m 30 -S http://127.0.0.1:2210/read?command=6 2>&1) - if [[ ! "${RESPONSE}" =~ "\"success\"" ]] ; then + if [[ ! "${RESPONSE}" =~ "\"success\"" ]]; then - echo && error "Could not send shutdown command to the guest ($RESPONSE)" + echo && error "Failed to send shutdown command ( ${RESPONSE} )." kill -15 "$(cat "${QEMU_PID}")" pkill -f qemu-system-x86_64 || true diff --git a/src/print.sh b/src/print.sh index 5049d95..2ff28f7 100644 --- a/src/print.sh +++ b/src/print.sh @@ -15,7 +15,7 @@ do # Retrieve IP from guest VM set +e - RESPONSE=$(curl -s -m 16 -S http://127.0.0.1:2210/read?command=10 2>&1) + RESPONSE=$(curl -s -m 30 -S http://127.0.0.1:2210/read?command=10 2>&1) set -e if [[ ! "${RESPONSE}" =~ "\"success\"" ]] ; then diff --git a/src/serial.sh b/src/serial.sh index c2ccb24..39a793d 100644 --- a/src/serial.sh +++ b/src/serial.sh @@ -45,7 +45,7 @@ fi cnt=0 sleep 0.2 -while ! nc -z -w1 127.0.0.1 2210 > /dev/null 2>&1; do +while ! nc -z -w2 127.0.0.1 2210 > /dev/null 2>&1; do sleep 0.1 cnt=$((cnt + 1)) (( cnt > 50 )) && error "Failed to connect to qemu-host.." && exit 58 @@ -53,7 +53,7 @@ done cnt=0 -while ! nc -z -w1 127.0.0.1 12345 > /dev/null 2>&1; do +while ! nc -z -w2 127.0.0.1 12345 > /dev/null 2>&1; do sleep 0.1 cnt=$((cnt + 1)) (( cnt > 50 )) && error "Failed to connect to qemu-host.." && exit 59