All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/12] python/machine.py: refactor shutdown
@ 2020-07-10  5:06 John Snow
  2020-07-10  5:06 ` [PATCH v5 01/12] python/machine.py: consolidate _post_shutdown() John Snow
                   ` (12 more replies)
  0 siblings, 13 replies; 45+ messages in thread
From: John Snow @ 2020-07-10  5:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: kwolf, Aleksandar Rikalo, Eduardo Habkost, John Snow,
	Wainer dos Santos Moschetta, Aleksandar Markovic, Cleber Rosa,
	Philippe Mathieu-Daudé,
	Aurelien Jarno

v5: More or less rewritten.

This series is motivated by a desire to move python/qemu onto a strict
mypy/pylint regime to help prevent regressions in the python codebase.

1. Remove the "bare except" pattern in the existing shutdown code, which
   can mask problems and make debugging difficult.

2. Ensure that post-shutdown cleanup is always performed, even when
   graceful termination fails.

3. Unify cleanup paths such that no matter how the VM is terminated, the
   same functions and steps are always taken to reset the object state.

4. Rewrite shutdown() such that any error encountered when attempting a
   graceful shutdown will be raised as an AbnormalShutdown exception.
   The pythonic idiom is to allow the caller to decide if this is a
   problem or not.

Previous versions of this series did not engage the fourth goal, and ran
into race conditions. When I was trying to allow shutdown to succeed if
QEMU was already closed, it became impossible to tell in which cases
QEMU not being present was "OK" and in which cases it was evidence of a
problem.

This refactoring is even more explicit. If a graceful shutdown is
requested and cannot be performed, an exception /will/ be raised.

In cases where the test writer expects QEMU to already have exited,
vm.wait() should be used in preference to vm.shutdown(). In cases where
a graceful shutdown is not interesting or necessary to the test,
vm.kill() should be used.

John Snow (12):
  python/machine.py: consolidate _post_shutdown()
  python/machine.py: Close QMP socket in cleanup
  python/machine.py: Add _early_cleanup hook
  python/machine.py: Perform early cleanup for wait() calls, too
  python/machine.py: Prohibit multiple shutdown() calls
  python/machine.py: Add a configurable timeout to shutdown()
  python/machine.py: Make wait() call shutdown()
  tests/acceptance: wait() instead of shutdown() where appropriate
  tests/acceptance: Don't test reboot on cubieboard
  python/machine.py: split shutdown into hard and soft flavors
  python/machine.py: re-add sigkill warning suppression
  python/machine.py: change default wait timeout to 3 seconds

 python/qemu/machine.py                   | 166 ++++++++++++++++++-----
 tests/acceptance/boot_linux_console.py   |  14 +-
 tests/acceptance/linux_ssh_mips_malta.py |   2 +
 3 files changed, 141 insertions(+), 41 deletions(-)

-- 
2.21.3



^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2020-07-14 19:35 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v5 11/12] python/machine.py: re-add sigkill warning suppression John Snow
2020-07-13  9:30   ` 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é

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.