All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, Eduardo Habkost <ehabkost@redhat.com>,
	philmd@redhat.com, Markus Armbruster <armbru@redhat.com>,
	Cleber Rosa <crosa@redhat.com>, John Snow <jsnow@redhat.com>
Subject: [PATCH v3 3/3] python/machine.py: re-add sigkill warning suppression
Date: Thu,  4 Jun 2020 15:52:52 -0400	[thread overview]
Message-ID: <20200604195252.20739-4-jsnow@redhat.com> (raw)
In-Reply-To: <20200604195252.20739-1-jsnow@redhat.com>

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



  parent reply	other threads:[~2020-06-04 19:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-04 19:52 [PATCH v3 0/3] python/machine.py: refactor shutdown John Snow
2020-06-04 19:52 ` [PATCH v3 1/3] python/machine.py: consolidate _post_shutdown() John Snow
2020-06-04 19:52 ` [PATCH v3 2/3] python/machine.py: refactor shutdown John Snow
2020-06-04 19:52 ` John Snow [this message]
2020-06-05  9:34 ` [PATCH v3 0/3] " Kevin Wolf
2020-06-09 13:08 ` Philippe Mathieu-Daudé
2020-06-09 21:55   ` John Snow
2020-06-15 15:21     ` Philippe Mathieu-Daudé
2020-06-15 22:21       ` Eduardo Habkost
2020-06-16 15:06         ` John Snow
2020-06-16 15:36           ` Philippe Mathieu-Daudé
2020-06-16 21:49       ` Cleber Rosa
2020-06-17 17:13         ` Philippe Mathieu-Daudé
2020-06-20 10:14           ` Philippe Mathieu-Daudé
2020-06-22 17:51             ` John Snow
2020-06-22 17:55               ` Philippe Mathieu-Daudé
2020-06-22 18:08                 ` John Snow
2020-06-22 18:28                   ` Philippe Mathieu-Daudé
2020-06-26 17:28             ` John Snow
2020-06-17 17:15 ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200604195252.20739-4-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=armbru@redhat.com \
    --cc=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.