mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-02-24 05:20:02 +08:00
PID
This commit is contained in:
parent
e112956c9d
commit
8e42acae58
19
run/power.sh
19
run/power.sh
@ -21,13 +21,12 @@ _trap(){
|
|||||||
|
|
||||||
_graceful_shutdown() {
|
_graceful_shutdown() {
|
||||||
|
|
||||||
|
set +e
|
||||||
|
|
||||||
[ ! -f "${_QEMU_PID}" ] && return
|
[ ! -f "${_QEMU_PID}" ] && return
|
||||||
[ -f "${_QEMU_SHUTDOWN_COUNTER}" ] && return
|
[ -f "${_QEMU_SHUTDOWN_COUNTER}" ] && return
|
||||||
|
|
||||||
set +e
|
echo && echo "Received $1 signal, shutting down..."
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Received $1 signal, shutting down..."
|
|
||||||
echo 0 > "${_QEMU_SHUTDOWN_COUNTER}"
|
echo 0 > "${_QEMU_SHUTDOWN_COUNTER}"
|
||||||
|
|
||||||
# Don't send the powerdown signal because vDSM ignores ACPI signals
|
# Don't send the powerdown signal because vDSM ignores ACPI signals
|
||||||
@ -38,8 +37,7 @@ _graceful_shutdown() {
|
|||||||
|
|
||||||
if [[ ! "${RESPONSE}" =~ "\"success\"" ]] ; then
|
if [[ ! "${RESPONSE}" =~ "\"success\"" ]] ; then
|
||||||
|
|
||||||
echo
|
echo && echo "ERROR: Could not send shutdown command to the guest ($RESPONSE)"
|
||||||
echo "ERROR: Could not send shutdown command to the guest ($RESPONSE)"
|
|
||||||
|
|
||||||
# If we cannot shutdown the usual way, fallback to the NMI method
|
# If we cannot shutdown the usual way, fallback to the NMI method
|
||||||
|
|
||||||
@ -53,11 +51,9 @@ _graceful_shutdown() {
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
echo
|
echo && echo "Please update the VirtualDSM Agent to allow for gracefull shutdowns..."
|
||||||
echo "Please update the VirtualDSM Agent to allow for gracefull shutdowns..."
|
|
||||||
|
|
||||||
PID=$(cat "${_QEMU_PID}")
|
kill -15 "$(cat "${_QEMU_PID}")"
|
||||||
kill -15 "${PID}"
|
|
||||||
pkill -f qemu-system-x86_64
|
pkill -f qemu-system-x86_64
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@ -78,8 +74,7 @@ _graceful_shutdown() {
|
|||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
echo
|
echo && echo "Quitting..."
|
||||||
echo "Quitting..."
|
|
||||||
echo 'quit' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}" > /dev/null || true
|
echo 'quit' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}" > /dev/null || true
|
||||||
|
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user