diff options
| -rwxr-xr-x | recipes-containers/vcontainer/files/vrunner.sh | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/recipes-containers/vcontainer/files/vrunner.sh b/recipes-containers/vcontainer/files/vrunner.sh index 92db55d2..680fe509 100755 --- a/recipes-containers/vcontainer/files/vrunner.sh +++ b/recipes-containers/vcontainer/files/vrunner.sh | |||
| @@ -633,7 +633,23 @@ daemon_stop() { | |||
| 633 | done | 633 | done |
| 634 | fi | 634 | fi |
| 635 | 635 | ||
| 636 | # If still running after the graceful window, escalate. | 636 | # If still running after the graceful window, escalate via QMP quit. |
| 637 | # Functionally similar to SIGTERM at the QEMU-process level (both | ||
| 638 | # converge on qemu_system_killed and a block-layer flush), but goes | ||
| 639 | # through QEMU's monitor interface — the same path hv_idle_shutdown() | ||
| 640 | # uses. Keeps the two escalation paths consistent. | ||
| 641 | if kill -0 "$pid" 2>/dev/null; then | ||
| 642 | local qmp_sock="$DAEMON_SOCKET_DIR/qmp.sock" | ||
| 643 | if [ -S "$qmp_sock" ]; then | ||
| 644 | log "INFO" "Sending QMP quit..." | ||
| 645 | echo '{"execute":"qmp_capabilities"}{"execute":"quit"}' | \ | ||
| 646 | socat - "UNIX-CONNECT:$qmp_sock" >/dev/null 2>&1 || true | ||
| 647 | sleep 2 | ||
| 648 | fi | ||
| 649 | fi | ||
| 650 | |||
| 651 | # If QMP quit didn't take (or no QMP socket — older configs), fall | ||
| 652 | # back to SIGTERM. | ||
| 637 | if kill -0 "$pid" 2>/dev/null; then | 653 | if kill -0 "$pid" 2>/dev/null; then |
| 638 | log "INFO" "Sending SIGTERM..." | 654 | log "INFO" "Sending SIGTERM..." |
| 639 | kill "$pid" 2>/dev/null || true | 655 | kill "$pid" 2>/dev/null || true |
