@@ -44,18 +44,17 @@ def run_boot(test, params, env):
120, 0, 1):
raise error.TestFail("Guest refuses to go down")
+ finally:
session.close()
- logging.info("Guest is down; waiting for it to go up again...")
-
- session = kvm_utils.wait_for(vm.remote_login, 240, 0, 2)
- if not session:
- raise error.TestFail("Could not log into guest after reboot")
+ logging.info("Guest is down; waiting for it to go up again...")
- logging.info("Guest is up again")
+ session = kvm_utils.wait_for(vm.remote_login, 240, 0, 2)
+ if not session:
+ raise error.TestFail("Could not log into guest after reboot")
+ session.close()
- finally:
- session.close()
+ logging.info("Guest is up again")
def run_shutdown(test, params, env):
It's possible for the test to fail when there's no shell session to close, and then session.close() in the finally clause raises a TypeError. Signed-off-by: Michael Goldish <mgoldish@redhat.com> --- client/tests/kvm/kvm_tests.py | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-)