Skip to content

Commit de6e08b

Browse files
jnsnowphilmd
authored andcommitted
python/machine.py: re-add sigkill warning suppression
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 <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Cleber Rosa <[email protected]> Message-Id: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
1 parent 193bf1c commit de6e08b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

python/qemu/machine.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import os
2323
import subprocess
2424
import shutil
25+
import signal
2526
import socket
2627
import tempfile
2728
from typing import Optional, Type
@@ -133,6 +134,7 @@ def __init__(self, binary, args=None, wrapper=None, name=None,
133134
self._console_address = None
134135
self._console_socket = None
135136
self._remove_files = []
137+
self._user_killed = False
136138
self._console_log_path = console_log
137139
if self._console_log_path:
138140
# In order to log the console, buffering needs to be enabled.
@@ -327,14 +329,16 @@ def _post_shutdown(self):
327329
self._remove_if_exists(self._remove_files.pop())
328330

329331
exitcode = self.exitcode()
330-
if exitcode is not None and exitcode < 0:
332+
if (exitcode is not None and exitcode < 0
333+
and not (self._user_killed and exitcode == -signal.SIGKILL)):
331334
msg = 'qemu received signal %i; command: "%s"'
332335
if self._qemu_full_args:
333336
command = ' '.join(self._qemu_full_args)
334337
else:
335338
command = ''
336339
LOG.warning(msg, -int(exitcode), command)
337340

341+
self._user_killed = False
338342
self._launched = False
339343

340344
def launch(self):
@@ -469,6 +473,7 @@ def shutdown(self, has_quit: bool = False,
469473

470474
try:
471475
if hard:
476+
self._user_killed = True
472477
self._hard_shutdown()
473478
else:
474479
self._do_shutdown(has_quit, timeout=timeout)

0 commit comments

Comments
 (0)