[PATCH] testbot/LibvirtTool: Only power off the VM if needed for the revert.
Francois Gouget
fgouget at codeweavers.com
Wed Jul 11 04:35:42 CDT 2018
Reverting from a powered off state is sometimes ten times longer than
reverting from the current state.
But Libvirt/QEmu is buggy and fails to revert if the VM configuration
changes. So try the revert first and, if it fails (which is fast),
power off + re-revert the VM.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
testbot/bin/LibvirtTool.pl | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index 91fe05358..3805c2bcf 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -411,19 +411,25 @@ sub Revert()
}
$CurrentStatus = "reverting";
- # Some QEmu/KVM versions are buggy and cannot revert a running VM
- Debug(Elapsed($Start), " Powering off the VM\n");
+ # Revert the VM (and power it on if necessary)
my $Domain = $VM->GetDomain();
- my $ErrMessage = $Domain->PowerOff();
+ Debug(Elapsed($Start), " Reverting $VMKey to ", $VM->IdleSnapshot, "\n");
+ my $ErrMessage = $Domain->RevertToSnapshot();
if (defined $ErrMessage)
{
- LogMsg "Could not power off $VMKey: $ErrMessage\n";
- LogMsg "Trying the revert anyway...\n";
- }
+ # Libvirt/QEmu is buggy and cannot revert a running VM from one hardware
+ # configuration to another. So try again after powering off the VM, though
+ # this can be much slower.
+ Debug(Elapsed($Start), " Powering off the VM\n");
+ $ErrMessage = $Domain->PowerOff();
+ if (defined $ErrMessage)
+ {
+ FatalError("Could not power off $VMKey: $ErrMessage\n");
+ }
- # Revert the VM (and power it on if necessary)
- Debug(Elapsed($Start), " Reverting $VMKey to ", $VM->IdleSnapshot, "\n");
- $ErrMessage = $Domain->RevertToSnapshot();
+ Debug(Elapsed($Start), " Reverting $VMKey to ", $VM->IdleSnapshot, "... again\n");
+ $ErrMessage = $Domain->RevertToSnapshot();
+ }
if (defined $ErrMessage)
{
FatalError("Could not revert $VMKey to ". $VM->IdleSnapshot .": $ErrMessage\n");
--
2.18.0
More information about the wine-devel
mailing list