brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [5/8] brooklyn-server git commit: WinRM operationTimeout parameter
Date Mon, 07 Mar 2016 08:46:57 GMT
WinRM operationTimeout parameter

- WinRM set default execTries
  This enables easier debugging and immidiate feedback when a problem occurs.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c7bab3e3
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c7bab3e3
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c7bab3e3

Branch: refs/heads/master
Commit: c7bab3e35686186b89b57ef4542bb6513625df90
Parents: 975a599
Author: Valentin Aitken <bostko@gmail.com>
Authored: Tue Mar 1 11:08:24 2016 +0200
Committer: Valentin Aitken <bostko@gmail.com>
Committed: Sat Mar 5 19:58:28 2016 +0200

----------------------------------------------------------------------
 pom.xml                                                          | 2 +-
 .../org/apache/brooklyn/location/winrm/WinRmMachineLocation.java | 2 +-
 .../org/apache/brooklyn/util/core/internal/winrm/WinRmTool.java  | 4 +++-
 .../brooklyn/util/core/internal/winrm/winrm4j/Winrm4jTool.java   | 3 +++
 4 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c7bab3e3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f710b91..ab23398 100644
--- a/pom.xml
+++ b/pom.xml
@@ -151,7 +151,7 @@
         <jax-rs-api.version>2.0.1</jax-rs-api.version>
         <maxmind.version>0.8.1</maxmind.version>
         <jna.version>4.0.0</jna.version>
-        <winrm4j.version>0.3.1</winrm4j.version>
+        <winrm4j.version>0.3.2</winrm4j.version>
         <!-- Transitive dependencies, declared explicitly to avoid version mismatch -->
         <clojure.version>1.4.0</clojure.version>
         <zookeeper.version>3.3.4</zookeeper.version>

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c7bab3e3/software/winrm/src/main/java/org/apache/brooklyn/location/winrm/WinRmMachineLocation.java
----------------------------------------------------------------------
diff --git a/software/winrm/src/main/java/org/apache/brooklyn/location/winrm/WinRmMachineLocation.java
b/software/winrm/src/main/java/org/apache/brooklyn/location/winrm/WinRmMachineLocation.java
index fefc1ba..394facb 100644
--- a/software/winrm/src/main/java/org/apache/brooklyn/location/winrm/WinRmMachineLocation.java
+++ b/software/winrm/src/main/java/org/apache/brooklyn/location/winrm/WinRmMachineLocation.java
@@ -77,6 +77,7 @@ public class WinRmMachineLocation extends AbstractLocation implements MachineLoc
             "Address of the remote machine");
 
     public static final ConfigKey<Integer> WINRM_CONFIG_PORT = newConfigKeyWithPrefix(BrooklynConfigKeys.BROOKLYN_WINRM_CONFIG_KEY_PREFIX,
WinRmTool.PROP_PORT);
+    public static final ConfigKey<String> OPERATION_TIMEOUT = newConfigKeyWithPrefix(BrooklynConfigKeys.BROOKLYN_WINRM_CONFIG_KEY_PREFIX,
WinRmTool.OPERATION_TIMEOUT);
     public static final ConfigKey<Boolean> USE_HTTPS_WINRM = WinRmTool.USE_HTTPS_WINRM;
 
 
@@ -339,7 +340,6 @@ public class WinRmMachineLocation extends AbstractLocation implements
MachineLoc
             args.putAll(props);
             args.configure(SshTool.PROP_HOST, getAddress().getHostAddress());
             args.configure(WinRmTool.USE_NTLM, getConfig(WinRmMachineLocation.USE_NTLM));
-            args.configure(WinRmTool.USE_HTTPS_WINRM, getConfig(WinRmMachineLocation.USE_HTTPS_WINRM));
             args.configure(WinRmTool.PROP_PORT, getPort());
 
             if (LOG.isTraceEnabled()) LOG.trace("creating WinRM session for "+Sanitizer.sanitize(args));

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c7bab3e3/software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/WinRmTool.java
----------------------------------------------------------------------
diff --git a/software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/WinRmTool.java
b/software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/WinRmTool.java
index 6e6bcf1..6d9007d 100644
--- a/software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/WinRmTool.java
+++ b/software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/WinRmTool.java
@@ -57,12 +57,14 @@ public interface WinRmTool {
     ConfigKey<Boolean> USE_NTLM = ConfigKeys.newBooleanConfigKey("winrm.useNtlm", "The
parameter configures tells the machine sensors whether the winrm port is over https. If the
parameter is true then 5986 will be used as a winrm port.", true);
     ConfigKey<String> PROP_USER = newStringConfigKey("user", "User to connect as",
null);
     ConfigKey<String> PROP_PASSWORD = newStringConfigKey("password", "Password to use
to connect", null);
+    ConfigKey<String> OPERATION_TIMEOUT = newStringConfigKey("winrm.operationTimeout",
"WinRM OperationTimeout. If no output is available before the wsman:OperationTimeout expires,
" +
+            "the server MUST return a WSManFault with the Code attribute equal to \"2150858793\".
When the client receives this fault, it will issue another Receive request. winrm4j also sets
the tcp socket timeout to a rounded up value", "1m");
 
     // TODO See SshTool#PROP_SSH_TRIES, where it was called "sshTries"; remove duplication?
Merge into one well-named thing?
     ConfigKey<Integer> PROP_EXEC_TRIES = ConfigKeys.newIntegerConfigKey(
             "execTries", 
             "Max number of times to attempt WinRM operations", 
-            10);
+            1);
 
     ConfigKey<Duration> PROP_EXEC_RETRY_DELAY = newConfigKey(
             Duration.class,

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c7bab3e3/software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/winrm4j/Winrm4jTool.java
----------------------------------------------------------------------
diff --git a/software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/winrm4j/Winrm4jTool.java
b/software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/winrm4j/Winrm4jTool.java
index 2de8c39..64dc670 100644
--- a/software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/winrm4j/Winrm4jTool.java
+++ b/software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/winrm4j/Winrm4jTool.java
@@ -70,6 +70,7 @@ public class Winrm4jTool implements org.apache.brooklyn.util.core.internal.winrm
     private final boolean logCredentials;
     private final Boolean useSecureWinrm;
     private final String authenticationScheme;
+    private final String operationTimeout;
     
     public Winrm4jTool(Map<String,?> config) {
         this(ConfigBag.newInstance(config));
@@ -86,6 +87,7 @@ public class Winrm4jTool implements org.apache.brooklyn.util.core.internal.winrm
         execTries = getRequiredConfig(config, PROP_EXEC_TRIES);
         execRetryDelay = getRequiredConfig(config, PROP_EXEC_RETRY_DELAY);
         logCredentials = getRequiredConfig(config, LOG_CREDENTIALS);
+        operationTimeout = config.get(OPERATION_TIMEOUT);
     }
     
     @Override
@@ -149,6 +151,7 @@ public class Winrm4jTool implements org.apache.brooklyn.util.core.internal.winrm
             Duration execTimestamp = null;
             try {
                 WinRmTool tool = connect();
+                tool.setOperationTimeout(Duration.of(operationTimeout).toMilliseconds());
                 connectTimestamp = Duration.of(stopwatch);
                 WinRmToolResponse result = task.apply(tool);
                 execTimestamp = Duration.of(stopwatch);


Mime
View raw message