Francois Gouget : testbot/LibvirtTool: Split off Halt() from ShutDown().
Alexandre Julliard
julliard at winehq.org
Thu Feb 17 15:31:28 CST 2022
Module: tools
Branch: master
Commit: f0d3ccebd11985d7e9ad0d29943aab43822c0922
URL: https://source.winehq.org/git/tools.git/?a=commit;h=f0d3ccebd11985d7e9ad0d29943aab43822c0922
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Thu Feb 17 18:52:22 2022 +0100
testbot/LibvirtTool: Split off Halt() from ShutDown().
Halt() does not wait for the VM to be powered off.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/bin/LibvirtTool.pl | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index 10af2f8..62008b5 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -279,6 +279,21 @@ sub GetPrivilegedTA($)
return $TA->SetTime() ? $TA : $VM->GetAgent(1);
}
+sub Halt()
+{
+ my $Cmd = $VM->Type =~ /^win(?:32|64)$/ ?
+ ["shutdown.exe", "/s", "/d", "00:00", "/t", "0"] :
+ ["/sbin/shutdown", "--poweroff", "now"];
+ Debug(Elapsed($Start), " Running: @$Cmd\n");
+ my $PTA = GetPrivilegedTA($VM->GetAgent());
+ if (!$PTA->Run($Cmd, 0))
+ {
+ Error "Could not run @$Cmd on $VMKey: ". $PTA->GetLastError() ."\n";
+ return 0;
+ }
+ return 1;
+}
+
=pod
=over 12
@@ -304,16 +319,7 @@ sub ShutDownIfOffSnapshot()
Debug(Elapsed($Start), " Performing a clean shutdown of $VMKey/$CurrentSnapshot\n");
LogMsg "Performing a clean shutdown of $VMKey/$CurrentSnapshot\n";
- my $Cmd = $VM->Type =~ /^win(?:32|64)$/ ?
- ["shutdown.exe", "/s", "/d", "00:00", "/t", "0"] :
- ["/sbin/shutdown", "--poweroff", "now"];
- Debug(Elapsed($Start), " Running @$Cmd\n");
- my $PTA = GetPrivilegedTA($VM->GetAgent());
- if (!$PTA->Run($Cmd, 0))
- {
- Error "Could not run @$Cmd on $VMKey: ". $PTA->GetLastError() ."\n";
- return 0;
- }
+ return 0 if (!Halt());
Debug(Elapsed($Start), " Waiting for the VM to shut down\n");
my $Deadline = time() + $WaitForShutdown;
More information about the wine-cvs
mailing list