@@ -367,7 +367,7 @@ class kvm_spawn:
return _locked(self.lock_server_running_filename)
- def close(self, sig=signal.SIGTERM):
+ def close(self, sig=signal.SIGKILL):
"""
Kill the child process if it's alive and remove temporary files.
@@ -375,10 +375,7 @@ class kvm_spawn:
"""
# Kill it if it's alive
if self.is_alive():
- try:
- os.kill(self.get_shell_pid(), sig)
- except:
- pass
+ kvm_utils.kill_process_tree(self.get_shell_pid(), sig)
# Wait for the server to exit
_wait(self.lock_server_running_filename)
# Call all cleanup routines
@@ -541,7 +541,7 @@ class VM:
# If the VM isn't dead yet...
logging.debug("Cannot quit normally; sending a kill to close the "
"deal...")
- kvm_utils.safe_kill(self.process.get_pid(), 9)
+ kvm_utils.kill_process_tree(self.process.get_pid(), 9)
# Wait for the VM to be really dead
if kvm_utils.wait_for(self.is_dead, 5, 0.5, 0.5):
logging.debug("VM is down")
This is safer than just killing the session leader because some processes seem to remain alive after their session leader has exited. Signed-off-by: Michael Goldish <mgoldish@redhat.com> --- client/tests/kvm/kvm_subprocess.py | 7 ++----- client/tests/kvm/kvm_vm.py | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-)