Alon Bar-Lev has uploaded a new change for review.

Change subject: bootstrap: introduce soft timeouts for operations
......................................................................

bootstrap: introduce soft timeouts for operations

The only place non default ssh timeout was enforced is when getting node
id.
 AddVdsCommand::canDoAction()

So it relatively simple to add soft timeout / hard timeout support by
just modify the defaults.

Hard timeout - maximum duration of command.
Soft timeout - maximum duration since last network activity.

Reduce the default of SSHInactivityTimoutSeconds to 5 minutes, it is now
the soft timeout limit.

Add a new configuration parameter of SSHInactivityHardTimoutSeconds
which is 30 minutes.

Change-Id: Ic37e4384fda412f92bffd7a8aa809d0dfd4d8157
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/hostinstall/VdsInstallerSSH.java
M 
backend/manager/tools/engine-config/src/main/resources/engine-config.properties
4 files changed, 35 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/34/7734/1

diff --git a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
index b0a8a14..536f79f 100644
--- a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -383,7 +383,8 @@
 select fn_db_add_config_value('SQLServerPagingSyntax',E' WHERE RowNum BETWEEN 
%1$s AND %2$s','general');
 select fn_db_add_config_value('SQLServerPagingType','Range','general');
 select fn_db_add_config_value('SQLServerSearchTemplate',E'SELECT * FROM 
(SELECT *, ROW_NUMBER() OVER(%1$s) as RowNum FROM (%2$s)) as T1) as T2 
%3$s','general');
-select fn_db_add_config_value('SSHInactivityTimoutSeconds','600','general');
+select fn_db_add_config_value('SSHInactivityTimoutSeconds','300','general');
+select 
fn_db_add_config_value('SSHInactivityHardTimoutSeconds','1800','general');
 --Handling SPICE SSL Enabled
 select fn_db_add_config_value('SSLEnabled','true','general');
 select 
fn_db_add_config_value('StorageDomainFalureTimeoutInMinutes','5','general');
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
index 2059b36..31096cc 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
@@ -383,7 +383,7 @@
     EnableUSBAsDefault(110),
     @Reloadable
     @TypeConverterAttribute(Integer.class)
-    @DefaultValueAttribute("600")
+    @DefaultValueAttribute("300")
     SSHInactivityTimoutSeconds(111),
     @Reloadable
     @TypeConverterAttribute(Integer.class)
@@ -1463,6 +1463,11 @@
     @DefaultValueAttribute("true")
     EnableMACAntiSpoofingFilterRules(381),
 
+    @Reloadable
+    @TypeConverterAttribute(Integer.class)
+    @DefaultValueAttribute("1800")
+    SSHInactivityHardTimoutSeconds(382),
+
     Invalid(65535);
 
     private int intValue;
diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/hostinstall/VdsInstallerSSH.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/hostinstall/VdsInstallerSSH.java
index 9d5e212..c8f6091 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/hostinstall/VdsInstallerSSH.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/hostinstall/VdsInstallerSSH.java
@@ -82,6 +82,9 @@
             keyStore,
             keyStorePassword,
             Config.<Integer>GetValue(
+                ConfigValues.SSHInactivityHardTimoutSeconds
+            ) * 1000,
+            Config.<Integer>GetValue(
                 ConfigValues.SSHInactivityTimoutSeconds
             ) * 1000
         );
@@ -93,17 +96,19 @@
         String userPassword,
         String keyStore,
         String keyStorePassword,
-        long timeout
+        long hardTimeout,
+        long softTimeout
     ) {
         log.debug(
             String.format(
-                "_doConnect enter (%1$s, %2$s, %3$s, %4$s, %5$s, %6$d)",
+                "_doConnect enter (%1$s, %2$s, %3$s, %4$s, %5$s, %6$d, %7$d)",
                 server,
                 user,
                 userPassword,
                 keyStore,
                 keyStorePassword,
-                timeout
+                hardTimeout,
+                softTimeout
             )
         );
 
@@ -112,8 +117,8 @@
 
         try {
             this.client = new SSHClient();
-            this.client.setHardTimeout(timeout);
-            this.client.setSoftTimeout(timeout);
+            this.client.setHardTimeout(hardTimeout);
+            this.client.setSoftTimeout(softTimeout);
             this.client.setHost(this.host, this.port);
             this.client.setUser(user);
 
@@ -272,14 +277,27 @@
         );
     }
 
-    public final boolean connect(String server, String rootPassword, long 
timeout) {
+    public final boolean connect(String server, String rootPassword, long 
hardTimeout) {
         return _doConnect(
             server,
             "root",
             rootPassword,
             null,
             null,
-            timeout
+            hardTimeout,
+            hardTimeout
+        );
+    }
+
+    public final boolean connect(String server, String rootPassword, long 
hardTimeout, long softTimeout) {
+        return _doConnect(
+            server,
+            "root",
+            rootPassword,
+            null,
+            null,
+            hardTimeout,
+            softTimeout
         );
     }
 
diff --git 
a/backend/manager/tools/engine-config/src/main/resources/engine-config.properties
 
b/backend/manager/tools/engine-config/src/main/resources/engine-config.properties
index caab5b1..ab9994b 100644
--- 
a/backend/manager/tools/engine-config/src/main/resources/engine-config.properties
+++ 
b/backend/manager/tools/engine-config/src/main/resources/engine-config.properties
@@ -127,6 +127,8 @@
 SpmVCpuConsumption.type=Integer
 SSHInactivityTimoutSeconds.description="SSH Inactivity Timeout (in seconds)"
 SSHInactivityTimoutSeconds.type=Integer
+SSHInactivityHardTimoutSeconds.description="SSH Inactivity Hard Timeout (in 
seconds)"
+SSHInactivityHardTimoutSeconds.type=Integer
 NumberOfUSBSlots.description="Number of USB slots in VMs with native USB 
support"
 NumberOfUSBSlots.type=Integer
 NumberOfUSBSlots.validValues=0..6


--
To view, visit http://gerrit.ovirt.org/7734
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic37e4384fda412f92bffd7a8aa809d0dfd4d8157
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to