[tools] testbot/LibvirtTool: Include the VM name in error messages.

Francois Gouget fgouget at codeweavers.com
Tue Feb 8 16:43:05 CST 2022


Multiple VMs may be reverted at the same time (either on the same VM
host or on separate hosts) so this is needed to know which VM the error
is about.

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

diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index b6b1fad581..681223f11c 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -132,7 +132,7 @@ if (!defined $Usage)
       $VM = CreateVMs()->GetItem($VMKey);
       if (!defined $VM)
       {
-        Error "VM $VMKey does not exist\n";
+        Error "The $VMKey VM does not exist\n";
         $Usage = 2;
       }
     }
@@ -301,7 +301,7 @@ sub ShutDown()
   my $PTA = GetPrivilegedTA($VM->GetAgent());
   if (!$PTA->Run($Cmd, 0))
   {
-    Error "Could not run @$Cmd: ". $PTA->GetLastError() ."\n";
+    Error "Could not run @$Cmd on $VMKey: ". $PTA->GetLastError() ."\n";
     $Success = 0;
   }
   else
@@ -469,14 +469,14 @@ sub SetupTestAgentd($$$)
     LogMsg "Upgrading the $VMKey TestAgent server from $Version\n";
     if ($Version !~ / ([0-9]+)\.([0-9]+)$/)
     {
-      FatalError("Unsupported TestAgent server version: $Version\n");
+      FatalError("Unsupported TestAgent server version on $VMKey: $Version\n");
     }
     # We want 'TestAgentd --detach --show-restarts' on Windows but this was
     # not supported before this version and changing how the server is started
     # is too complex.
     if (!$TA->HasMinVersion(1, 7))
     {
-      FatalError("The TestAgent server is too old to be upgraded: $Version\n");
+      FatalError("The $VMKey TestAgent server is too old to be upgraded: $Version\n");
     }
 
     if (!$TA->Upgrade("$DataDir/latest/TestAgentd.exe"))
@@ -506,10 +506,10 @@ sub SetupTestAgentd($$$)
   # HTTPS certificates), but also for the build (if the time moves forward
   # during the build some ccache versions will return a compilation error).
   my $PTA = GetPrivilegedTA($TA);
-  FatalError("Cannot set the VM system time\n") if (!$PTA);
+  FatalError("Cannot set the $VMKey VM system time\n") if (!$PTA);
   if (!$PTA->SetTime())
   {
-    FatalError("Setting the VM system time failed: ". $PTA->GetLastError() ."\n");
+    FatalError("Setting the $VMKey VM system time failed: ". $PTA->GetLastError() ."\n");
   }
 
   if ($Booting and $VM->Type eq "wine")
@@ -518,16 +518,16 @@ sub SetupTestAgentd($$$)
     Debug(Elapsed($Start), " Waiting for the X session\n");
     LogMsg "Waiting for the $VMKey X session\n";
     my $Pid = $TA->Run(["sh", "-c", "while ! xset -display :0.0 q >/dev/null; do sleep 1; done"], 0);
-    FatalError("Could not check for the X session on $VMKey\n") if (!$Pid);
+    FatalError("Could not check for the $VMKey X session\n") if (!$Pid);
 
     if (!defined $TA->Wait($Pid, $SleepAfterBoot))
     {
       my $ErrMessage = $TA->GetLastError();
       if ($ErrMessage =~ /timed out waiting for the child process/)
       {
-        FatalError("Timed out waiting for the X session\n");
+        FatalError("Timed out waiting for the $VMKey X session\n");
       }
-      FatalError("An error occurred while waiting for the X session: $ErrMessage\n");
+      FatalError("An error occurred while waiting for the $VMKey X session: $ErrMessage\n");
     }
   }
 
@@ -544,7 +544,7 @@ sub SetupTestAgentd($$$)
     my $Count = $TA->GetProperties("start.count");
     if (defined $Count and $Count > 1)
     {
-      FatalError("The VM has been rebooted too many times: start.count=$Count > 1");
+      FatalError("$VMKey has been rebooted too many times: start.count=$Count > 1");
     }
   }
   $PTA->Disconnect();
@@ -574,7 +574,7 @@ sub Revert()
 {
   if (!$Debug and $VM->Status ne "reverting")
   {
-    Error("The VM is not ready to be reverted (". $VM->Status .")\n");
+    Error("$VMKey is not ready to be reverted (". $VM->Status .")\n");
     return 1;
   }
   $CurrentStatus = "reverting";
-- 
2.30.2



More information about the wine-devel mailing list