[Tools 1/3] testbot: Base LibvirtDomain::IsPoweredOn() on get_state().

Francois Gouget fgouget at codeweavers.com
Thu Oct 19 07:54:16 CDT 2017


is_active() returns true even if the VM is in the process of being
reverted (i.e. it uses resources) which is not what we are after.
So use get_state() which provides more detailed information.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---

Note that this patchset is independent from the offline VM monitoring 
patch.

 testbot/lib/WineTestBot/LibvirtDomain.pm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/testbot/lib/WineTestBot/LibvirtDomain.pm b/testbot/lib/WineTestBot/LibvirtDomain.pm
index 20d619ac..1b74315f 100644
--- a/testbot/lib/WineTestBot/LibvirtDomain.pm
+++ b/testbot/lib/WineTestBot/LibvirtDomain.pm
@@ -273,9 +273,10 @@ sub IsPoweredOn($)
     return undef;
   }
 
-  my $IsActive;
-  eval { $IsActive = $Domain->is_active() };
-  return $@ ? $self->_Reset(undef) : $IsActive;
+  my ($State, $_Reason);
+  eval { ($State, $_Reason) = $Domain->get_state() };
+  return $self->_Reset(undef) if ($@);
+  return ($State == Sys::Virt::Domain::STATE_RUNNING);
 }
 
 sub PowerOff($$)
-- 
2.14.2




More information about the wine-patches mailing list