mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-11-02 16:04:52 +08:00
fix: Kill QEMU after 5 seconds when it hangs (#1086)
This commit is contained in:
parent
c05623f8af
commit
221b0242fa
11
src/power.sh
11
src/power.sh
@ -33,6 +33,7 @@ _trap() {
|
|||||||
finish() {
|
finish() {
|
||||||
|
|
||||||
local pid
|
local pid
|
||||||
|
local cnt=0
|
||||||
local reason=$1
|
local reason=$1
|
||||||
|
|
||||||
touch "$QEMU_END"
|
touch "$QEMU_END"
|
||||||
@ -44,10 +45,20 @@ finish() {
|
|||||||
{ kill -15 "$pid" || true; } 2>/dev/null
|
{ kill -15 "$pid" || true; } 2>/dev/null
|
||||||
|
|
||||||
while isAlive "$pid"; do
|
while isAlive "$pid"; do
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
cnt=$((cnt+1))
|
||||||
|
|
||||||
# Workaround for zombie pid
|
# Workaround for zombie pid
|
||||||
[ ! -s "$QEMU_PID" ] && break
|
[ ! -s "$QEMU_PID" ] && break
|
||||||
|
|
||||||
|
if [ "$cnt" == "5" ]; then
|
||||||
|
error "QEMU did not terminate itself, forcefully killing process..."
|
||||||
|
{ kill -9 "$pid" || true; } 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fKill "print.sh"
|
fKill "print.sh"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user