Martin Peřina has uploaded a new change for review.

Change subject: core: Recover kdumping host after engine restart
......................................................................

core: Recover kdumping host after engine restart

Recovers all hosts with status Kdumping after engine startup by
scheduling execution of VdsNotRespondingTreatment for host after
DisableFenceAtStartupInSec period passed.

Change-Id: Icc815a113a703c96cdbe52f28da732f13e96085d
Bug-Url: https://bugzilla.redhat.com/1079821
Signed-off-by: Martin Perina <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsValidator.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/pm/PmHealthCheckManager.java
2 files changed, 50 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/32/28932/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsValidator.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsValidator.java
index 9e3e949..b8198e7 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsValidator.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsValidator.java
@@ -44,6 +44,7 @@
         case Maintenance:
         case NonOperational:
         case NonResponsive:
+        case Kdumping:  // it should happen only after restart when host is 
stuck in status Kdumping
             result = true;
             break;
 
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/pm/PmHealthCheckManager.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/pm/PmHealthCheckManager.java
index 507dae0..ff9c379 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/pm/PmHealthCheckManager.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/pm/PmHealthCheckManager.java
@@ -1,8 +1,13 @@
 package org.ovirt.engine.core.bll.pm;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
 import org.ovirt.engine.core.bll.Backend;
 import org.ovirt.engine.core.bll.FenceExecutor;
 import org.ovirt.engine.core.bll.RestartVdsCommand;
+import org.ovirt.engine.core.bll.job.ExecutionHandler;
 import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.action.FenceVdsActionParameters;
 import org.ovirt.engine.core.common.action.VdcActionType;
@@ -25,9 +30,6 @@
 import org.ovirt.engine.core.utils.threadpool.ThreadPoolUtil;
 import org.ovirt.engine.core.utils.timer.OnTimerMethodAnnotation;
 import org.ovirt.engine.core.utils.timer.SchedulerUtilQuartzImpl;
-
-import java.util.List;
-import java.util.concurrent.TimeUnit;
 
 /**
  * Responsible for checking PM enabled hosts by sending a status command to 
each host configured PM agent cards and
@@ -117,11 +119,14 @@
     }
 
     /**
-     * recovers from engine crash
-     * @param hostsWithPMInReboot
+     * Recovers hosts with status Reboot or Kdumping from engine crash
+     *
+     * @param hosts
+     *            all existing hosts
      */
     public void recover(List<VDS> hosts) {
         startHostsWithPMInReboot(hosts);
+        recoverKdumpingHosts(hosts);
     }
 
     private void startHostsWithPMInReboot(List<VDS> hosts) {
@@ -170,6 +175,45 @@
         }
     }
 
+    private void recoverKdumpingHosts(List<VDS> hosts) {
+        final List<VDS> kdumpingHosts = new ArrayList<>();
+        for (VDS host : hosts) {
+            if (host.getStatus() == VDSStatus.Kdumping) {
+                kdumpingHosts.add(host);
+            }
+        }
+        if (!kdumpingHosts.isEmpty()) {
+            ThreadPoolUtil.execute(new Runnable() {
+                @Override
+                public void run() {
+                    // wait the quiet time from engine start in which we skip 
fencing operations
+                    int mSecToWait = 
Config.<Integer>getValue(ConfigValues.DisableFenceAtStartupInSec) * 1000;
+                    ThreadUtils.sleep(mSecToWait);
+                    executeNotRespondingTreatment(kdumpingHosts);
+                }
+            });
+        }
+    }
+
+    private void executeNotRespondingTreatment(List<VDS> hosts) {
+        for (VDS host : hosts) {
+            final FenceVdsActionParameters params = new 
FenceVdsActionParameters(
+                    host.getId(),
+                    FenceActionType.Restart
+            );
+            ThreadPoolUtil.execute(new Runnable() {
+                @Override
+                public void run() {
+                    Backend.getInstance().runInternalAction(
+                            VdcActionType.VdsNotRespondingTreatment,
+                            params,
+                            ExecutionHandler.createInternalJobContext()
+                    );
+                }
+            });
+        }
+    }
+
     public static PmHealthCheckManager getInstance() {
         return instance;
     }


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

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

Reply via email to