qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"John Snow" <jsnow@redhat.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Aleksandar Markovic" <aleksandar.qemu.devel@gmail.com>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [PATCH v5 11/12] python/machine.py: re-add sigkill warning suppression
Date: Fri, 10 Jul 2020 01:06:48 -0400	[thread overview]
Message-ID: <20200710050649.32434-12-jsnow@redhat.com> (raw)
In-Reply-To: <20200710050649.32434-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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/python/qemu/machine.py b/python/qemu/machine.py
index b24ce8a268..02d66e3cff 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
@@ -128,6 +129,7 @@ def __init__(self, binary, args=None, wrapper=None, name=None,
         self._console_address = None
         self._console_socket = None
         self._remove_files = []
+        self._user_killed = False
 
     def __enter__(self):
         return self
@@ -316,7 +318,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._user_killed and exitcode == -signal.SIGKILL)):
             msg = 'qemu received signal %i; command: "%s"'
             if self._qemu_full_args:
                 command = ' '.join(self._qemu_full_args)
@@ -324,6 +327,7 @@ def _post_shutdown(self):
                 command = ''
             LOG.warning(msg, -int(exitcode), command)
 
+        self._user_killed = False
         self._launched = False
 
     def launch(self):
@@ -455,6 +459,7 @@ def shutdown(self, has_quit: bool = False,
 
         try:
             if hard:
+                self._user_killed = True
                 self._hard_shutdown()
             else:
                 self._do_shutdown(has_quit, timeout=timeout)
-- 
2.21.3



  parent reply	other threads:[~2020-07-10  5:15 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10  5:06 [PATCH v5 00/12] python/machine.py: refactor shutdown John Snow
2020-07-10  5:06 ` [PATCH v5 01/12] python/machine.py: consolidate _post_shutdown() John Snow
2020-07-13 15:11   ` Cleber Rosa
2020-07-13 17:23   ` Philippe Mathieu-Daudé
2020-07-10  5:06 ` [PATCH v5 02/12] python/machine.py: Close QMP socket in cleanup John Snow
2020-07-13  9:26   ` Philippe Mathieu-Daudé
2020-07-13 15:34   ` Cleber Rosa
2020-07-10  5:06 ` [PATCH v5 03/12] python/machine.py: Add _early_cleanup hook John Snow
2020-07-13 17:22   ` Philippe Mathieu-Daudé
2020-07-13 20:30   ` Cleber Rosa
2020-07-10  5:06 ` [PATCH v5 04/12] python/machine.py: Perform early cleanup for wait() calls, too John Snow
2020-07-13 17:24   ` Philippe Mathieu-Daudé
2020-07-13 20:31   ` Cleber Rosa
2020-07-10  5:06 ` [PATCH v5 05/12] python/machine.py: Prohibit multiple shutdown() calls John Snow
2020-07-13  9:27   ` Philippe Mathieu-Daudé
2020-07-14  2:48   ` Cleber Rosa
2020-07-14 18:09     ` John Snow
2020-07-14 18:47     ` John Snow
2020-07-10  5:06 ` [PATCH v5 06/12] python/machine.py: Add a configurable timeout to shutdown() John Snow
2020-07-13  9:28   ` Philippe Mathieu-Daudé
2020-07-14  2:50   ` Cleber Rosa
2020-07-10  5:06 ` [PATCH v5 07/12] python/machine.py: Make wait() call shutdown() John Snow
2020-07-13  9:29   ` Philippe Mathieu-Daudé
2020-07-14  3:05   ` Cleber Rosa
2020-07-10  5:06 ` [PATCH v5 08/12] tests/acceptance: wait() instead of shutdown() where appropriate John Snow
2020-07-13  9:57   ` Philippe Mathieu-Daudé
2020-07-14  3:37   ` Cleber Rosa
2020-07-10  5:06 ` [PATCH v5 09/12] tests/acceptance: Don't test reboot on cubieboard John Snow
2020-07-13  9:56   ` Philippe Mathieu-Daudé
2020-07-13 15:12     ` John Snow
2020-07-13 15:15       ` Philippe Mathieu-Daudé
2020-07-14  3:41   ` Cleber Rosa
2020-07-10  5:06 ` [PATCH v5 10/12] python/machine.py: split shutdown into hard and soft flavors John Snow
2020-07-13  9:54   ` Philippe Mathieu-Daudé
2020-07-14  4:13   ` Cleber Rosa
2020-07-14 18:13     ` John Snow
2020-07-14 19:10       ` Philippe Mathieu-Daudé
2020-07-10  5:06 ` John Snow [this message]
2020-07-13  9:30   ` [PATCH v5 11/12] python/machine.py: re-add sigkill warning suppression Philippe Mathieu-Daudé
2020-07-14  4:14   ` Cleber Rosa
2020-07-10  5:06 ` [PATCH v5 12/12] python/machine.py: change default wait timeout to 3 seconds John Snow
2020-07-13  9:30   ` Philippe Mathieu-Daudé
2020-07-14  4:20   ` Cleber Rosa
2020-07-14 18:15     ` John Snow
2020-07-14 19:17 ` [PATCH v5 00/12] python/machine.py: refactor shutdown 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=20200710050649.32434-12-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=aleksandar.qemu.devel@gmail.com \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=aurelien@aurel32.net \
    --cc=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wainersm@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).