qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v5 00/12] python/machine.py: refactor shutdown


From: John Snow
Subject: [PATCH v5 00/12] python/machine.py: refactor shutdown
Date: Fri, 10 Jul 2020 01:06:37 -0400

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]