If another tool was trying to connect to the VM's TestAgent server when 'LibvirtTool monitor' powered off the VM, that other tool may mark the VM as offline right after it has been put back online. So wait for other tools to time out after monitor powers off a VM.
Signed-off-by: Francois Gouget fgouget@codeweavers.com ---
This last patch is not related to snapshot support but since it touches LibvirtTool.pl I'm sending it with that series.
testbot/bin/LibvirtTool.pl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl index 76ea70713..c0288e75a 100755 --- a/testbot/bin/LibvirtTool.pl +++ b/testbot/bin/LibvirtTool.pl @@ -285,7 +285,12 @@ sub Monitor() else { my $IsPoweredOn; - if (!defined $SnapshotName or $SnapshotName ne $VM->IdleSnapshot) + if (!defined $SnapshotName) + { + Debug("$VMKey has no snapshot (reverting?)\n"); + $IsPoweredOn = undef; + } + elsif (!defined $SnapshotName or $SnapshotName ne $VM->IdleSnapshot) { $IsPoweredOn = 0; } @@ -298,8 +303,16 @@ sub Monitor() if (defined $ErrMessage) { Error "$ErrMessage\n"; - $IsPoweredOn = undef; } + else + { + # Another process might have been trying to connect to the VM's + # TestAgent server. Wait for it to time out so it does not set the + # VM offline right after we have put it back online. + LogMsg "Powered off $VMKey. Sleep until all other processes accessing it are gone.\n"; + sleep(3 * $WaitForToolsInVM); + } + $IsPoweredOn = undef; } } if (defined $IsPoweredOn)