And adjust the TestAgent connection timeout accordingly.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/LibvirtTool.pl | 6 +++--- testbot/lib/WineTestBot/LibvirtDomain.pm | 13 +++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl index 7bd75d00e..0801c997f 100755 --- a/testbot/bin/LibvirtTool.pl +++ b/testbot/bin/LibvirtTool.pl @@ -379,7 +379,7 @@ sub Revert() # Revert the VM (and power it on if necessary) my $Domain = $VM->GetDomain(); Debug(Elapsed($Start), " Reverting $VMKey to ", $VM->IdleSnapshot, "\n"); - my $ErrMessage = $Domain->RevertToSnapshot(); + my ($ErrMessage, $Booting) = $Domain->RevertToSnapshot(); if (defined $ErrMessage) { # Libvirt/QEmu is buggy and cannot revert a running VM from one hardware @@ -393,7 +393,7 @@ sub Revert() }
Debug(Elapsed($Start), " Reverting $VMKey to ", $VM->IdleSnapshot, "... again\n"); - $ErrMessage = $Domain->RevertToSnapshot(); + ($ErrMessage, $Booting) = $Domain->RevertToSnapshot(); } if (defined $ErrMessage) { @@ -407,7 +407,7 @@ sub Revert() Debug(Elapsed($Start), " Verifying the TestAgent server\n"); LogMsg "Verifying the $VMKey TestAgent server\n"; my $TA = $VM->GetAgent(); - $TA->SetConnectTimeout(undef, undef, $WaitForBoot); + $TA->SetConnectTimeout(undef, undef, $WaitForBoot) if ($Booting); my $Success = $TA->Ping(); $TA->Disconnect(); if (!$Success) diff --git a/testbot/lib/WineTestBot/LibvirtDomain.pm b/testbot/lib/WineTestBot/LibvirtDomain.pm index 4e1c4ee07..bb2276820 100644 --- a/testbot/lib/WineTestBot/LibvirtDomain.pm +++ b/testbot/lib/WineTestBot/LibvirtDomain.pm @@ -315,11 +315,20 @@ sub RevertToSnapshot($)
my $SnapshotName = $self->{VM}->IdleSnapshot; my ($ErrMessage, $Domain, $Snapshot) = $self->_GetSnapshot($SnapshotName); - return $ErrMessage if (defined $ErrMessage); + return ($ErrMessage, undef) if (defined $ErrMessage);
# Note that if the snapshot was of a powered off domain, this boots it up eval { $Snapshot->revert_to(Sys::Virt::DomainSnapshot::REVERT_RUNNING) }; - return $@ ? $self->_Reset(_eval_err()) : undef; + return $self->_Reset(_eval_err(), undef) if ($@); + + my ($State, $Reason) = $Domain->get_state(); + if ($State != Sys::Virt::Domain::STATE_RUNNING) + { + return ($self->{VM}->Name ." is not running (". + _GetStateDescription($State, $Reason) + .") after revert to $SnapshotName", undef); + } + return (undef, $Reason != Sys::Virt::Domain::STATE_RUNNING_FROM_SNAPSHOT); }
sub CreateSnapshot($)