The --vm ensures the right TestAgent connection parameters will be used to connect to the specified VM.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- This partially reverts commit 206c7478dcb4 but with some important differences: - It does not parse the VM name to infer the locale to be used. Here --vm is purely a way to specify how to connect to that machine's TestAgentd server. - It does not add back the options for 'refreshing' snapshots, or creating new VMs for the specified locales. Those were not used and are not coming back. --- testbot/bin/SetWinLocale | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale index 670de4604..e41af2088 100755 --- a/testbot/bin/SetWinLocale +++ b/testbot/bin/SetWinLocale @@ -40,6 +40,7 @@ use WineTestBot::Config; use WineTestBot::Log; use WineTestBot::TestAgent; use WineTestBot::Utils; +use WineTestBot::VMs;
my $HKCU_INTERNATIONAL = "HKCU\Control Panel\International"; my $HKCU_GEO = "HKCU\Control Panel\International\Geo"; @@ -315,7 +316,7 @@ sub CheckLocale($$) return undef; }
-my ($OptHostName, $OptShow, $OptSysCopy, $OptDefCopy, $OptUseIntl, $OptReboot); +my ($OptVM, $OptHostName, $OptShow, $OptSysCopy, $OptDefCopy, $OptUseIntl, $OptReboot); my ($OptDefault, $OptLocale, $OptCountry, $OptSystem, $OptUTF8, $OptMUI, $OptKeyboard); while (@ARGV) { @@ -324,6 +325,10 @@ while (@ARGV) { $Usage = 0; } + elsif ($Arg eq "--vm") + { + $OptVM = CheckValue($Arg, $OptVM); + } elsif ($Arg eq "--show") { $OptShow = 1; @@ -415,10 +420,25 @@ while (@ARGV) }
# Check and untaint parameters -my ($Keyboard, $CountryId); +my ($VM, $Keyboard, $CountryId); if (!defined $Usage) { - if (!defined $OptHostName) + if (defined $OptVM) + { + my $VMs = CreateVMs(); + $VM = $VMs->GetItem($OptVM); + if (!$VM) + { + Error("could not find the '$OptVM' VM\n"); + $Usage = 2; + } + elsif (!$Debug and $VM->Role eq "deleted") + { + Error("'$OptVM' is marked for deletion\n"); + $Usage = 2; + } + } + elsif (!defined $OptHostName) { Error("you must specify the Windows machine to work on\n"); $Usage = 2; @@ -510,14 +530,16 @@ if (defined $Usage) Error("try '$name0 --help' for more information\n"); exit $Usage; } - print "Usage: $name0 [options] --show HOSTNAME\n"; - print "or $name0 [options] [--default DEF] [--locale LOC] [--country CTY] [--system SYS] [--utf8] [--mui MUI] [--keyboard KBD] [--no-sys-copy] [--no-def-copy] [--use-intl] [--no-reboot] HOSTNAME\n"; + print "Usage: $name0 [options] --show (HOSTNAME|--vm VM)\n"; + print "or $name0 [options] [--default DEF] [--locale LOC] [--country CTY] [--system SYS] [--utf8] [--mui MUI] [--keyboard KBD] [--no-sys-copy] [--no-def-copy] [--use-intl] [--no-reboot] (HOSTNAME|--vm VM)\n"; print "\n"; print "Sets the locale of the specified Windows machine.\n"; print "\n"; print "Where:\n"; print " HOSTNAME Work on the specified Windows host (must be running TestAgentd).\n"; print " --show Show the locale settings of the specified host and exit.\n"; + print " --vm VM Work on the specified TestBot VM, using its TestAgent\n"; + print " connection parameters.\n"; print " --default DEF Use this Windows locale as the default for the other options.\n"; print " The locale must be in a form suitable for Windows' intl.cpl\n"; print " control panel module, that is roughly ll-CC where ll is an\n"; @@ -604,7 +626,7 @@ if (defined $Usage) exit 0; }
-$TA = TestAgent->new($OptHostName, $AgentPort); +$TA = $VM ? $VM->GetAgent() : TestAgent->new($OptHostName, $AgentPort);
#
This ensures SetWinLocale will use the right options to connect to the VM's TestAgentd server.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- This fixes the deadlock that happened when using LibvirtTool to create the locale-specific snapshots. The reason was that passing just the hostname caused SetWinLocale try to establish a plain network connection which is blocked by the firewall. This is also why I could not reproduce the issue here: there's no firewall blocking access to my local VMs. --- testbot/bin/LibvirtTool.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl index bd676f03d..33760d365 100755 --- a/testbot/bin/LibvirtTool.pl +++ b/testbot/bin/LibvirtTool.pl @@ -719,7 +719,9 @@ sub CreateSnapshot($$$$) if (@Locale) { Debug(Elapsed($Start), " Setting up the @Locale locale on $VMKey\n"); - my @Cmd = ("$BinDir/SetWinLocale", $VM->Hostname); + # Use the --vm option to make sure SetWinLocale uses the right TestAgent + # connection parameters: port, ssh tunneling, etc. + my @Cmd = ("$BinDir/SetWinLocale", "--vm", $VMKey); if ($Config->{locale}) { push @Cmd, "--default", $Config->{locale};