From 25556f4ee7590938df804977747d29c5f968011f Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Sun, 9 Aug 2015 17:53:55 -0300 Subject: [PATCH] VM Plugin: no need to gracefully shutdown VM if it's state will be reverted Let's be practical and simply destroy (pull the plug on the VM) that will have its state (snapshot reverted). Not shutting down (or powering off/destroying) the VM has the side effect of not reverting the state of the (still running) VM on a couple of platforms, including EL7. This fixed issue #396. Signed-off-by: Cleber Rosa --- avocado/core/remote/result.py | 6 ++++-- selftests/all/unit/avocado/vm_unittest.py | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/avocado/core/remote/result.py b/avocado/core/remote/result.py index d657a810..5aec4eb5 100644 --- a/avocado/core/remote/result.py +++ b/avocado/core/remote/result.py @@ -145,5 +145,7 @@ class VMTestResult(RemoteTestResult): def tear_down(self): super(VMTestResult, self).tear_down() - if self.args.vm_cleanup is True and self.vm.snapshot is not None: - self.vm.restore_snapshot() + if self.args.vm_cleanup is True: + self.vm.stop() + if self.vm.snapshot is not None: + self.vm.restore_snapshot() diff --git a/selftests/all/unit/avocado/vm_unittest.py b/selftests/all/unit/avocado/vm_unittest.py index a416eb0c..e8dac433 100644 --- a/selftests/all/unit/avocado/vm_unittest.py +++ b/selftests/all/unit/avocado/vm_unittest.py @@ -52,6 +52,7 @@ class VMTestResultTest(unittest.TestCase): self.remote = VMTestResult(Stream, Args) # vm.RemoteTestResult.tear_down() RemoteTestResult.should_receive('tear_down').once().ordered() + mock_vm.should_receive('stop').once().ordered() mock_vm.should_receive('restore_snapshot').once().ordered() def tearDown(self): -- GitLab