[virt-tools-list] [virt-manager PATCH 1/2] virtManager: object: domain: Fix snapshot run check

Michael Weiser michael.weiser at gmx.de
Wed Dec 18 22:26:11 UTC 2019


snap.is_running() returns a boolean and checking that against
VIR_DOMAIN_RUNNING worked by pure coincidence only. Just use the bool
value and give it a more speaking name while at it.

Signed-off-by: Michael Weiser <michael.weiser at gmx.de>
---
 virtManager/object/domain.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/virtManager/object/domain.py b/virtManager/object/domain.py
index bad7108e..778d1fee 100644
--- a/virtManager/object/domain.py
+++ b/virtManager/object/domain.py
@@ -1051,11 +1051,11 @@ class vmmDomain(vmmLibvirtObject):
     def revert_to_snapshot(self, snap):
         # no use trying to set the guest time if is going to be switched off
         # after reverting to the snapshot
-        target_run_state = snap.is_running()
+        will_be_running = snap.is_running()
         self._backend.revertToSnapshot(snap.get_backend())
         # looking at the domain state after revert will always come back as
         # paused, so look at the snapshot state instead
-        if target_run_state == libvirt.VIR_DOMAIN_RUNNING:
+        if will_be_running:
             self._set_time()
 
     def create_snapshot(self, xml, redefine=False):
-- 
2.24.1





More information about the virt-tools-list mailing list