[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 3/3] python/machine.py: re-add sigkill warning suppression
From: |
John Snow |
Subject: |
[PATCH v3 3/3] python/machine.py: re-add sigkill warning suppression |
Date: |
Thu, 4 Jun 2020 15:52:52 -0400 |
If the user kills QEMU on purpose, we don't need to warn them about that
having happened: they know already.
Signed-off-by: John Snow <jsnow@redhat.com>
---
python/qemu/machine.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/python/qemu/machine.py b/python/qemu/machine.py
index a2abd2c35e3..99bcb499878 100644
--- a/python/qemu/machine.py
+++ b/python/qemu/machine.py
@@ -22,6 +22,7 @@
import os
import subprocess
import shutil
+import signal
import socket
import tempfile
from typing import Optional, Type
@@ -122,6 +123,7 @@ def __init__(self, binary, args=None, wrapper=None,
name=None,
self._console_address = None
self._console_socket = None
self._remove_files = []
+ self._killed = False
def __enter__(self):
return self
@@ -282,7 +284,7 @@ def _post_launch(self):
if self._qmp:
self._qmp.accept()
- def _post_shutdown(self):
+ def _post_shutdown(self) -> None:
self._load_io_log()
if self._qemu_log_file is not None:
@@ -299,7 +301,8 @@ def _post_shutdown(self):
self._remove_if_exists(self._remove_files.pop())
exitcode = self.exitcode()
- if exitcode is not None and exitcode < 0:
+ if (exitcode is not None and exitcode < 0
+ and not (self._killed and exitcode == -signal.SIGKILL)):
msg = 'qemu received signal %i; command: "%s"'
if self._qemu_full_args:
command = ' '.join(self._qemu_full_args)
@@ -307,6 +310,7 @@ def _post_shutdown(self):
command = ''
LOG.warning(msg, -int(exitcode), command)
+ self._killed = False
self._launched = False
def launch(self):
@@ -414,6 +418,7 @@ def shutdown(self, has_quit: bool = False, hard: bool =
False) -> None:
try:
if hard:
+ self._killed = True
self._hard_shutdown()
else:
self._do_shutdown(has_quit)
--
2.21.3
- [PATCH v3 0/3] python/machine.py: refactor shutdown, John Snow, 2020/06/04
- [PATCH v3 1/3] python/machine.py: consolidate _post_shutdown(), John Snow, 2020/06/04
- [PATCH v3 2/3] python/machine.py: refactor shutdown, John Snow, 2020/06/04
- [PATCH v3 3/3] python/machine.py: re-add sigkill warning suppression,
John Snow <=
- Re: [PATCH v3 0/3] python/machine.py: refactor shutdown, Kevin Wolf, 2020/06/05
- Re: [PATCH v3 0/3] python/machine.py: refactor shutdown, Philippe Mathieu-Daudé, 2020/06/09
- Re: [PATCH v3 0/3] python/machine.py: refactor shutdown, Cleber Rosa, 2020/06/16
- Re: [PATCH v3 0/3] python/machine.py: refactor shutdown, Philippe Mathieu-Daudé, 2020/06/17
- Re: [PATCH v3 0/3] python/machine.py: refactor shutdown, Philippe Mathieu-Daudé, 2020/06/20