[PATCH 1/4] testbot: Check the current snapshot in LibvirtTool checkidle.

Francois Gouget fgouget at codeweavers.com
Tue Feb 27 18:54:29 CST 2018


If the snapshot does not match then the current VM instance is not
actually using the hypervisor domain so mark it off.

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

This set of patches paves the way for allowing the TestBot to use more 
than one snapshot per VM (i.e. more than one test configuration per VM). 
But they can make sense even without it.

For instance here if the snapshot does not match then one can consider 
that maybe the administrator decided to do something with the VM so it 
makes sense for the TestBot to leave it alone for now. But it's 
definitely the administrator's fault for not setting the VM status to 
'maintenance' if the TestBot later reverts the VM from under his feet.


 testbot/bin/LibvirtTool.pl     | 7 +++++--
 testbot/lib/WineTestBot/VMs.pm | 6 +++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index 670c55359..12eaa669f 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -320,9 +320,12 @@ sub CheckIdle()
 
   my ($ErrMessage, $SnapshotName) = $VM->GetDomain()->GetSnapshotName();
   FatalError("$ErrMessage\n") if (defined $ErrMessage);
-  return PowerOff() if ($SnapshotName ne $VM->IdleSnapshot);
 
-  return ChangeStatus("dirty", "idle", "done");
+  # If the snapshot does not match then the virtual machine may be used by
+  # another VM instance. So don't touch it. All that counts is that this
+  # VM instance is not running.
+  my $NewStatus = ($SnapshotName eq $VM->IdleSnapshot) ? "idle" : "off";
+  return ChangeStatus("dirty", $NewStatus, "done");
 }
 
 sub Revert()
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index d893e4966..f09863996 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -433,9 +433,9 @@ sub _RunVMTool($$$)
 
 =item C<RunCheckIdle()>
 
-If the virtual machine state matches that of this VM instance, sets its status
-to idle. If not the VM is simply marked as off. While this is happening the
-VM status is set to dirty so the job scheduler does not try to use it.
+If the hypervisor domain state matches that of this VM instance, sets its
+status to idle. If not the VM is simply marked as off. While this is happening
+the VM status is set to dirty so the job scheduler does not try to use it.
 
 This operation can take a long time so it is performed in a separate process.
 
-- 
2.16.1




More information about the wine-devel mailing list