Yaniv Bronhaim has uploaded a new change for review.

Change subject: Adding parameters to delay fence based on host's load
......................................................................

Adding parameters to delay fence based on host's load

Before performing fencing to host, we wait TimeoutToResetVdsInSeconds.

This patch adds a formula based on vms count and SPM status that
calculates different timeout period before starting the fence.

Change-Id: I69c15b254cb5323416aaa33756866218870056d2
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=924801
Signed-off-by: Yaniv Bronhaim <[email protected]>
---
A backend/manager/dbscripts/upgrade/03_03_0110_delay_fence_parameters.sql
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
M backend/manager/tools/src/main/conf/engine-config.properties
4 files changed, 28 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/88/14288/1

diff --git 
a/backend/manager/dbscripts/upgrade/03_03_0110_delay_fence_parameters.sql 
b/backend/manager/dbscripts/upgrade/03_03_0110_delay_fence_parameters.sql
new file mode 100644
index 0000000..6321fc5
--- /dev/null
+++ b/backend/manager/dbscripts/upgrade/03_03_0110_delay_fence_parameters.sql
@@ -0,0 +1,2 @@
+select fn_db_add_config_value('DelayResetPerStatusInSeconds','10','general');
+select fn_db_add_config_value('DelayResetPerVmInSeconds','3','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 20346a2..e7a039d 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
@@ -1356,6 +1356,16 @@
     @DefaultValueAttribute("false")
     MigrationNetworkEnabled(502),
 
+    @Reloadable
+    @TypeConverterAttribute(Double.class)
+    @DefaultValueAttribute("10")
+    DelayResetPerStatusInSeconds(503),
+
+    @Reloadable
+    @TypeConverterAttribute(Double.class)
+    @DefaultValueAttribute("3")
+    DelayResetPerVmInSeconds(504),
+
     Invalid(65535);
 
     private int intValue;
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
index eb0bd2c..556711e 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
@@ -19,6 +19,7 @@
 import org.ovirt.engine.core.common.businessentities.VDSDomainsData;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.VdsDynamic;
+import org.ovirt.engine.core.common.businessentities.VdsSpmStatus;
 import org.ovirt.engine.core.common.businessentities.VdsStatistics;
 import org.ovirt.engine.core.common.businessentities.VmDynamic;
 import org.ovirt.engine.core.common.config.Config;
@@ -594,6 +595,16 @@
         }
     }
 
+    private double calcTimeoutToFence(Integer vmCount, VdsSpmStatus spmStatus) 
{
+        Integer spmIndicator = 0;
+        if (spmStatus == VdsSpmStatus.SPM) {
+            spmIndicator = 1;
+        }
+        return TimeUnit.SECONDS.toMillis(
+                Config.<Integer> 
GetValue(ConfigValues.TimeoutToResetVdsInSeconds) +
+                (Config.<Integer> 
GetValue(ConfigValues.DelayResetPerStatusInSeconds) * spmIndicator) +
+                (Config.<Integer> 
GetValue(ConfigValues.DelayResetPerVmInSeconds) * vmCount));
+    }
     /**
      * Handle network exception, return true if save vdsDynamic to DB is 
needed.
      *
@@ -604,7 +615,7 @@
         if (vds.getStatus() != VDSStatus.Down) {
             if (mUnrespondedAttempts.get() < Config.<Integer> 
GetValue(ConfigValues.VDSAttemptsToResetCount)
                     || lastUpdate
-                            + (TimeUnit.SECONDS.toMillis(Config.<Integer> 
GetValue(ConfigValues.TimeoutToResetVdsInSeconds))) > 
System.currentTimeMillis()) {
+                            + calcTimeoutToFence(vds.getVmCount(), 
vds.getSpmStatus()) > System.currentTimeMillis()) {
                 boolean result = false;
                 if (vds.getStatus() != VDSStatus.Connecting && vds.getStatus() 
!= VDSStatus.PreparingForMaintenance
                         && vds.getStatus() != VDSStatus.NonResponsive) {
diff --git a/backend/manager/tools/src/main/conf/engine-config.properties 
b/backend/manager/tools/src/main/conf/engine-config.properties
index fcfe103..26be2d2 100644
--- a/backend/manager/tools/src/main/conf/engine-config.properties
+++ b/backend/manager/tools/src/main/conf/engine-config.properties
@@ -150,6 +150,10 @@
 SysPrepXPPath.description="Path to a Windows XP machine Sys-Prep file."
 TimeoutToResetVdsInSeconds.description="Communication timeout in seconds 
before trying to reset"
 TimeoutToResetVdsInSeconds.type=Integer
+DelayResetPerStatusInSeconds.description="Delay timeout before reset if host 
runs as SPM"
+DelayResetPerStatusInSeconds.type=Double
+DelayResetPerVmInSeconds.description="Delay timeout for running vm before 
reset"
+DelayResetPerVmInSeconds.type=Double
 TimeToReduceFailedRunOnVdsInMinutes.description="Time to Reduce Failed Run on 
Host (in minutes)"
 TimeToReduceFailedRunOnVdsInMinutes.type=Integer
 UserDefinedVMProperties.description="User defined VM properties"


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

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

Reply via email to