Eli Mesika has uploaded a new change for review. Change subject: core: Add proxy agent support verification ......................................................................
core: Add proxy agent support verification When a proxy Host is selected, there is no check if the Host supports the requested PM agent. If for example a Host H1 in Cluster C1 need fencing and has agent A1, if we have Host H2 in Cluster C2 that does not support A1 and a Host H3 in Cluster C3 that supports A1, the current implementation may select H2 as a proxy, this will fail because A1 is not supported on C2 and all proxy retries will be done on H2 while we have H3 that should succeed to fence H1 since H3 is in C# which supports A1. This patch adds a check to the proxy selection algorithm that insures that the selected proxy supports the required PM agent. In case of dual agents, support for both agents is required since in concurrent PM devices we need both, and in sequential PM devices Primary might fail and then Secondary PM agent should attempt to fence the Host. Change-Id: I6e6610e1e7be660c894c879288d9df9b0956eda5 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1036365 Signed-off-by: Eli Mesika <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java M backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/VdsFenceOptions.java 2 files changed, 49 insertions(+), 11 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/23/22423/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java index ff8d09f..85be960 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java @@ -288,21 +288,26 @@ if (filterSelf) { return !vds.getId().equals(_vds.getId()) && vds.getVdsGroupId().equals(_vds.getVdsGroupId()) - && vds.getStatus() == VDSStatus.Up; + && vds.getStatus() == VDSStatus.Up + && isAgentSupported(vds); } else { return vds.getStatus() == VDSStatus.Up - && vds.getVdsGroupId().equals(_vds.getVdsGroupId()); + && vds.getVdsGroupId().equals(_vds.getVdsGroupId()) + && isAgentSupported(vds); } } else { if (filterSelf) { return !isHostNetworkUnreacable(vds) && - !vds.getId().equals(_vds.getId()) && vds.getVdsGroupId().equals(_vds.getVdsGroupId()); + !vds.getId().equals(_vds.getId()) + && vds.getVdsGroupId().equals(_vds.getVdsGroupId()) + && isAgentSupported(vds); } else { - return !isHostNetworkUnreacable(vds) && - vds.getVdsGroupId().equals(_vds.getVdsGroupId()); + return !isHostNetworkUnreacable(vds) + && vds.getVdsGroupId().equals(_vds.getVdsGroupId()) + && isAgentSupported(vds); } } @@ -312,27 +317,49 @@ if (filterSelf) { return !vds.getId().equals(_vds.getId()) && vds.getStoragePoolId().equals(_vds.getStoragePoolId()) - && vds.getStatus() == VDSStatus.Up; + && vds.getStatus() == VDSStatus.Up + && isAgentSupported(vds); } else { return vds.getStatus() == VDSStatus.Up - && vds.getStoragePoolId().equals(_vds.getStoragePoolId()); + && vds.getStoragePoolId().equals(_vds.getStoragePoolId()) + && isAgentSupported(vds); } } else { if (filterSelf) { - return !isHostNetworkUnreacable(vds) && - !vds.getId().equals(_vds.getId()) && vds.getStoragePoolId().equals(_vds.getStoragePoolId()); + return !isHostNetworkUnreacable(vds) + && !vds.getId().equals(_vds.getId()) + && vds.getStoragePoolId().equals(_vds.getStoragePoolId()) + && isAgentSupported(vds); } else { - return !isHostNetworkUnreacable(vds) && - vds.getStoragePoolId().equals(_vds.getStoragePoolId()); + return !isHostNetworkUnreacable(vds) + && vds.getStoragePoolId().equals(_vds.getStoragePoolId()) + && isAgentSupported(vds); } } } return false; } + + private boolean isAgentSupported(VDS vds) { + boolean ret = false; + // Checks if the requested _vds PM agent is supported by the candidate proxy (vds) + VdsFenceOptions options = new VdsFenceOptions(vds.getVdsGroupCompatibilityVersion().getValue()); + if (!StringUtils.isEmpty(_vds.getManagementIp())) { + ret = options.isAgentSupported(_vds.getPmType()); + } + // In a case that a secondary agent is defined, require the proxy host to be + // in a cluster that supports both Primary & Secondary agents since in concurrent + // PM devices we need both, and in sequential PM devices Primary might fail and then + // Secondary PM agent should attempt to fence the Host + if (!StringUtils.isEmpty(_vds.getPmSecondaryIp())) { + ret = options.isAgentSupported(_vds.getPmSecondaryType()); + } + return ret; + } }); return proxyHost; } diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/VdsFenceOptions.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/VdsFenceOptions.java index 7fccf7d..34ec6dc 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/VdsFenceOptions.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/VdsFenceOptions.java @@ -414,6 +414,17 @@ } /** + * Checks if the agent is supported on the version that was set in object constructor + * @param agent + * The agent. + * @return <c>true</c> if the specified agent is supported; otherwise, <c>false</c>. + */ + + public boolean isAgentSupported(String agent) { + return fencingOptionMapping.containsKey(agent); + } + + /** * Gets the current agent supported options. * * @return -- To view, visit http://gerrit.ovirt.org/22423 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6e6610e1e7be660c894c879288d9df9b0956eda5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
