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

Change subject: core: Execute FenceVdsManually after host kdumping detected
......................................................................

core: Execute FenceVdsManually after host kdumping detected

Adds execution of FenceVdsManuallyCommand when host kdumping is
detected, so selecting the new SPM host is faster then wait for host to
fisnish kdumping and reboot.

Change-Id: I957b7e98fb8e909a1b1747816e888f03d0d850ca
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/VdsKdumpDetectionCommand.java
1 file changed, 32 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/37/28737/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsKdumpDetectionCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsKdumpDetectionCommand.java
index d9b2789..db491aa 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsKdumpDetectionCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsKdumpDetectionCommand.java
@@ -2,9 +2,13 @@
 
 import java.util.Calendar;
 import java.util.List;
+import java.util.Map;
 
+import org.ovirt.engine.core.bll.context.CommandContext;
 import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.ExternalVariable;
+import org.ovirt.engine.core.common.action.FenceVdsManualyParameters;
+import org.ovirt.engine.core.common.action.VdcActionType;
 import org.ovirt.engine.core.common.action.VdsActionParameters;
 import org.ovirt.engine.core.common.businessentities.KdumpFlowStatus;
 import org.ovirt.engine.core.common.businessentities.KdumpStatus;
@@ -14,12 +18,14 @@
 import org.ovirt.engine.core.common.config.Config;
 import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
+import org.ovirt.engine.core.common.utils.Pair;
 import 
org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters;
 import 
org.ovirt.engine.core.common.vdscommands.UpdateVdsVMsClearedVDSCommandParameters;
 import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
 import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector;
 import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase;
 import org.ovirt.engine.core.utils.ThreadUtils;
+import org.ovirt.engine.core.utils.lock.EngineLock;
 
 /**
  * Tries to detect if host is kdumping.
@@ -78,6 +84,29 @@
         }
     }
 
+    @Override
+    protected Map<String, Pair<String, String>> getExclusiveLocks() {
+        return FenceVdsBaseCommand.createFenceExclusiveLocksMap(getVdsId());
+    }
+
+    private void executeFenceVdsManuallyAction() {
+        FenceVdsManualyParameters fenceVdsManuallyParams = new 
FenceVdsManualyParameters(false);
+        fenceVdsManuallyParams.setStoragePoolId(getVds().getStoragePoolId());
+        fenceVdsManuallyParams.setVdsId(getVdsId());
+        fenceVdsManuallyParams.setSessionId(getParameters().getSessionId());
+        fenceVdsManuallyParams.setParentCommand(VdcActionType.RestartVds);
+
+        // if fencing succeeded, call to reset irs in order to try select new 
spm
+        Backend.getInstance().runInternalAction(
+                VdcActionType.FenceVdsManualy,
+                fenceVdsManuallyParams,
+                new CommandContext(
+                        getExecutionContext(),
+                        new EngineLock(getExclusiveLocks(), null)
+                )
+        );
+    }
+
     private KdumpDetectionResult detectHostKdumping() {
         VdsKdumpStatus kdumpStatus;
         int messageInterval = 
Config.<Integer>getValue(ConfigValues.FenceKdumpMessageInterval) * 1000;
@@ -118,6 +147,9 @@
 
                     // restart VMs running on Vds
                     restartVdsVms();
+
+                    // execute all actions needed to manual fence the host 
(without PM fencing)
+                    executeFenceVdsManuallyAction();
                 }
 
                 if (kdumpStatus.getStatus() == KdumpFlowStatus.FINISHED) {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I957b7e98fb8e909a1b1747816e888f03d0d850ca
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