[tools 2/3] testbot/LibvirtTool: Skip creating the intermediate -live snapshot.

Francois Gouget fgouget at codeweavers.com
Mon Feb 14 22:03:19 CST 2022


Basing the localized snapshots on the plain -live snapshot is not very
useful and skipping this intermediate step makes the code simpler.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/bin/LibvirtTool.pl | 43 +++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 24 deletions(-)

diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index 1fc7dc1d4c..90df848df1 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -604,6 +604,7 @@ sub Revert()
     # Add some extra time to set up the VM locale and reboot it
     $ExtraTimeout += $VMToolTimeout;
     $SetLocale = "$1-$2";
+    $CreateSnapshot = 1;
     Debug(Elapsed($Start), " $VMKey does not yet have a $DomainSnapshot-$SetLocale snapshot\n");
   }
   if (!$Domain->HasSnapshot($DomainSnapshot) and $DomainSnapshot =~ s/-live$//)
@@ -656,7 +657,7 @@ sub Revert()
   # Mark the VM as sleeping which allows the scheduler to abort the revert in
   # favor of higher priority tasks. But don't allow interruptions in the
   # middle of snapshot creation!
-  if (!$CreateSnapshot and !$SetLocale)
+  if (!$CreateSnapshot)
   {
     return 1 if (ChangeStatus("reverting", "sleeping"));
   }
@@ -665,10 +666,22 @@ sub Revert()
   # reboot so reset start.count in that case.
   SetupTestAgentd($Booting, ($CreateSnapshot or $SetLocale), $SetLocale);
 
+  # Set up the VM locale
+  if ($SetLocale)
+  {
+    Debug(Elapsed($Start), " Setting up the $SetLocale locale on $VMKey\n");
+    my @Cmd = ("$BinDir/SetWinLocale", $VM->Hostname, "--default", $SetLocale);
+    push @Cmd, "--debug" if ($Debug);
+    if (system(@Cmd))
+    {
+      FatalError("Could not set the $VMKey locale to $SetLocale\n");
+    }
+    $Booting = 1;
+  }
+
   if ($CreateSnapshot)
   {
-    $DomainSnapshot .= "-live";
-    CreateSnapshot($Domain, $DomainSnapshot);
+    CreateSnapshot($Domain, $VM->IdleSnapshot);
 
     if ($VM->Type eq "build" or $VM->Type eq "wine")
     {
@@ -687,23 +700,11 @@ sub Revert()
         Debug(Elapsed($Start), " Added a job to update and rebuild Wine on $VMKey\n");
       }
     }
-  }
 
-  # Set up the VM locale
-  if ($SetLocale)
-  {
-    Debug(Elapsed($Start), " Setting up the $SetLocale locale on $VMKey\n");
-    my @Cmd = ("$BinDir/SetWinLocale", $VM->Hostname, "--default", $SetLocale);
-    push @Cmd, "--debug" if ($Debug);
-    if (system(@Cmd))
-    {
-      FatalError("Could not set the $VMKey locale to $SetLocale\n");
-    }
-
-    $DomainSnapshot .= "-$SetLocale";
-    CreateSnapshot($Domain, $DomainSnapshot);
+    # The activity monitor does not like it when VMs skip the sleeping step
+    return 1 if (ChangeStatus("reverting", "sleeping"));
   }
-  elsif (!$CreateSnapshot)
+  else
   {
     my $Sleep = ($Booting and $SleepAfterBoot > $SleepAfterRevert) ?
                 $SleepAfterBoot : $SleepAfterRevert;
@@ -712,12 +713,6 @@ sub Revert()
     sleep($Sleep);
   }
 
-  if ($CreateSnapshot or $SetLocale)
-  {
-    # The activity monitor does not like it when VMs skip the sleeping step
-    return 1 if (ChangeStatus("reverting", "sleeping"));
-  }
-
   return ChangeStatus($CurrentStatus, "idle", "done");
 }
 
-- 
2.30.2




More information about the wine-devel mailing list