Martin Peřina has uploaded a new change for review. Change subject: core: Fix skip fencing if host connected to storage ......................................................................
core: Fix skip fencing if host connected to storage Fixes skip fencing if host connected to storage which was broken due to refactoring done in 31cd7918c9c5eb5c2d6ddf5526b366fdb2d0f4bc Change-Id: I84fa56e75adf988ce36b1154269dab8974cf05bf Signed-off-by: Martin Perina <mper...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestartVdsCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java 3 files changed, 21 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/81/36581/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java index f3769d3..c884ce0 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java @@ -138,9 +138,11 @@ // when fencing is skipped due to policy we want to suppress command result logging, because // we fire an alert in VdsNotRespondingTreatment setCommandShouldBeLogged(false); + setSucceeded(false); + } else { + setSucceeded(result.getSucceeded()); } setActionReturnValue(result); - setSucceeded(result.getSucceeded()); } /** @@ -203,8 +205,10 @@ log.info("Attemp to {} VDS using fence agent{} skipped: Host is already at the requested state.", getAction().name().toLowerCase(), fenceAgent.getId()); - } - else { + } else if (wasSkippedDueToPolicy(fenceExecutionResult)) { + // fencing execution was skipped due to fencing policy + return fenceExecutionResult; + } else { if (fenceExecutionResult.getSucceeded()) { boolean requiredStatusAchieved = waitForStatus(); int i = 0; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestartVdsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestartVdsCommand.java index ae85991..3f91eb0 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestartVdsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestartVdsCommand.java @@ -30,6 +30,7 @@ import org.ovirt.engine.core.common.utils.Pair; import org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.VDSCommandType; +import org.ovirt.engine.core.common.vdscommands.VDSFenceReturnValue; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dal.dbbroker.DbFacade; @@ -50,6 +51,9 @@ public class RestartVdsCommand<T extends FenceVdsActionParameters> extends VdsCommand<T> { private static final String INTERNAL_FENCE_USER = "Engine"; + + protected boolean skippedDueToFencingPolicy; + /** * Constructor for command creation when compensation is applied on startup * @@ -57,6 +61,7 @@ */ protected RestartVdsCommand(Guid commandId) { super(commandId); + skippedDueToFencingPolicy = false; } public RestartVdsCommand(T parameters) { @@ -65,6 +70,7 @@ public RestartVdsCommand(T parameters, CommandContext commandContext) { super(parameters, commandContext); + skippedDueToFencingPolicy = false; } @Override @@ -123,6 +129,7 @@ } if (wasSkippedDueToPolicy(returnValue)) { // fence execution was skipped due to fencing policy, host should be alive + skippedDueToFencingPolicy = true; setSucceeded(false); runVdsCommand(VDSCommandType.SetVdsStatus, new SetVdsStatusVDSCommandParameters(vdsId, VDSStatus.NonResponsive)); @@ -198,11 +205,14 @@ * to policy. */ protected boolean wasSkippedDueToPolicy(VdcReturnValueBase result) { - if (result.getActionReturnValue() instanceof FenceStatusReturnValue) { - return ((FenceStatusReturnValue) result.getActionReturnValue()).getIsSkipped(); - } else { - return false; + boolean skipped = false; + if (result.getActionReturnValue() instanceof VDSFenceReturnValue) { + VDSFenceReturnValue fenceReturnValue = result.getActionReturnValue(); + if (fenceReturnValue.getReturnValue() instanceof FenceStatusReturnValue) { + skipped = ((FenceStatusReturnValue) fenceReturnValue.getReturnValue()).getIsSkipped(); + } } + return skipped; } @Override diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java index 4d6b04e..c56e817 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java @@ -80,7 +80,6 @@ */ @Override protected void executeCommand() { - boolean skippedDueToFencingPolicy = false; setVds(null); if (getVds() == null) { setCommandShouldBeLogged(false); -- To view, visit http://gerrit.ovirt.org/36581 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I84fa56e75adf988ce36b1154269dab8974cf05bf Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Peřina <mper...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches