Francois Gouget : testbot: Base LibvirtDomain::IsPoweredOn() on get_state( ).

Alexandre Julliard julliard at winehq.org
Fri Oct 20 01:38:21 CDT 2017


Module: tools
Branch: master
Commit: bfb23ab81b1bd15ba180fcc05a9d4ef0624134f8
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=bfb23ab81b1bd15ba180fcc05a9d4ef0624134f8

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Oct 19 14:54:16 2017 +0200

testbot: Base LibvirtDomain::IsPoweredOn() on get_state().

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>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 20d619a..1b74315 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($$)




More information about the wine-cvs mailing list