Francois Gouget : testbot: Check the current snapshot in LibvirtTool monitor.

Alexandre Julliard julliard at winehq.org
Wed Feb 28 15:22:31 CST 2018


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Feb 28 01:54:45 2018 +0100

testbot: Check the current snapshot in LibvirtTool monitor.

If the snapshot does not match when the hypervisor domain becomes
accessible again, then don't try to power if off and just mark the
VM instance as off.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/bin/LibvirtTool.pl | 44 ++++++++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 14 deletions(-)

diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index 12eaa66..0293bae 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -277,23 +277,39 @@ sub Monitor()
       return 0;
     }
 
-    my $IsPoweredOn = $VM->GetDomain()->IsPoweredOn();
-    if ($IsPoweredOn)
+    my ($ErrMessage, $SnapshotName) = $VM->GetDomain()->GetSnapshotName();
+    if (defined $ErrMessage)
     {
-      my $ErrMessage = $VM->GetDomain()->PowerOff();
-      if (defined $ErrMessage)
-      {
-        Error "$ErrMessage\n";
-        $IsPoweredOn = undef;
-      }
+      Error "$ErrMessage\n";
     }
-    if (defined $IsPoweredOn)
+    else
     {
-      return 1 if (ChangeStatus("offline", "off", "done"));
-      NotifyAdministrator("The $VMKey VM is working again",
-                          "The $VMKey VM started working again after ".
-                          Elapsed($Start) ." seconds.");
-      return 0;
+      my $IsPoweredOn;
+      if (!defined $SnapshotName or $SnapshotName ne $VM->IdleSnapshot)
+      {
+        $IsPoweredOn = 0;
+      }
+      else
+      {
+        $IsPoweredOn = $VM->GetDomain()->IsPoweredOn();
+        if ($IsPoweredOn)
+        {
+          $ErrMessage = $VM->GetDomain()->PowerOff();
+          if (defined $ErrMessage)
+          {
+            Error "$ErrMessage\n";
+            $IsPoweredOn = undef;
+          }
+        }
+      }
+      if (defined $IsPoweredOn)
+      {
+        return 1 if (ChangeStatus("offline", "off", "done"));
+        NotifyAdministrator("The $VMKey VM is working again",
+                            "The $VMKey VM started working again after ".
+                            Elapsed($Start) ." seconds.");
+        return 0;
+      }
     }
 
     Debug(Elapsed($Start), " $VMKey is still unreachable\n");




More information about the wine-cvs mailing list