qemu
This commit is contained in:
parent
9ad1676f20
commit
c5f7f56d9e
1 changed files with 2 additions and 23 deletions
25
power.sh
25
power.sh
|
@ -25,29 +25,8 @@ _graceful_shutdown(){
|
|||
echo "Received $1 signal, shutting down..."
|
||||
echo 0 > "${_QEMU_SHUTDOWN_COUNTER}"
|
||||
|
||||
# Don't send the powerdown signal because vDSM ignores ACPI signals
|
||||
# echo 'system_powerdown' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}">/dev/null
|
||||
|
||||
# Send shutdown command to guest agent tools instead via serial port
|
||||
RESPONSE=$(curl -s -m 2 -S http://127.0.0.1:2210/write?command=6 2>&1)
|
||||
|
||||
if [[ ! "${RESPONSE}" =~ "\"success\"" ]] ; then
|
||||
|
||||
echo "Could not send shutdown command to guest, error: $RESPONSE"
|
||||
|
||||
FILE="${IMG}/agent.ver"
|
||||
[ ! -f "$FILE" ] && echo "1" > "$FILE"
|
||||
AGENT_VERSION=$(cat "${FILE}")
|
||||
|
||||
if ((AGENT_VERSION < 2)); then
|
||||
echo "Please update the agent to allow gracefull shutdowns..."
|
||||
pkill -f qemu-system-x86_64
|
||||
else
|
||||
# Send a NMI interrupt which will be detected by the kernel
|
||||
echo 'nmi' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}">/dev/null
|
||||
fi
|
||||
|
||||
fi
|
||||
# Send the shutdown (system_powerdown) command to the QMP monitor
|
||||
echo 'system_powerdown' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}">/dev/null
|
||||
|
||||
while [ "$(cat ${_QEMU_SHUTDOWN_COUNTER})" -lt "${QEMU_POWERDOWN_TIMEOUT}" ]; do
|
||||
|
||||
|
|
Loading…
Reference in a new issue