Eli Mesika has uploaded a new change for review. Change subject: core: skip failing proxy when waiting for status ......................................................................
core: skip failing proxy when waiting for status This patch fix a bug when we have a preferred proxy (in 6the same cluster as the fenced host) that failed to perform the desired operation. In this case, we should remember the failed proxy inside the "get status" loop and use the one that had succeeded (if exists) Change-Id: I2b846444ff795e7099b61f6d0be8909402b7bfa1 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1141514 Signed-off-by: Eli Mesika <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java 1 file changed, 17 insertions(+), 16 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/80/34780/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 30067b5..645e322 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 @@ -69,6 +69,10 @@ } public boolean findProxyHost() { + return findProxyHost(skippedProxyHostId); + } + + public boolean findProxyHost(Guid exclude) { PMProxyOptions proxyOption=null; final Guid NO_VDS = Guid.Empty; int count; @@ -104,10 +108,10 @@ // available on new host. if (_vds.getId().equals(NO_VDS)) { // try first to find a Host in UP status - proxyHost = getFenceProxy(true, false, proxyOption); + proxyHost = getFenceProxy(true, false, proxyOption, exclude); // trying other Hosts that are not in UP since they can be a proxy for fence operations if (proxyHost == null) { - proxyHost = getFenceProxy(false, false, proxyOption); + proxyHost = getFenceProxy(false, false, proxyOption, exclude); } if (proxyHost != null) { proxyHostId = proxyHost.getId(); @@ -118,9 +122,9 @@ // If can not find a proxy host retry and delay between retries // as configured. while (count < retries) { - proxyHost = getFenceProxy(true, true, proxyOption); + proxyHost = getFenceProxy(true, true, proxyOption, exclude); if (proxyHost == null) { - proxyHost = getFenceProxy(false, true, proxyOption); + proxyHost = getFenceProxy(false, true, proxyOption, exclude); } if (proxyHost != null) { proxyHostId = proxyHost.getId(); @@ -152,13 +156,6 @@ logProxySelection(proxyHost.getName(), proxyOption.createLogEntry(proxyHost), _action.name()); } return !NO_VDS.equals(proxyHostId); - } - - private synchronized boolean findProxyHostExcluding(Guid exludedHostId) { - skippedProxyHostId = exludedHostId; - boolean res = findProxyHost(); - skippedProxyHostId=null; - return res; } private void logProxySelection(String proxy, String origin, String command) { @@ -196,9 +193,13 @@ // if fence failed, retry with another proxy if (!retValue.getSucceeded()) { log.warnFormat("Fencing operation failed with proxy host {0}, trying another proxy...", proxyHostId); - if (!findProxyHostExcluding(proxyHostId)) { + Guid failedProxyHostId = proxyHostId; + if (!findProxyHost(proxyHostId)) { log.warnFormat("Failed to find other proxy to re-run failed fence operation, retrying with the same proxy..."); findProxyHost(); + } + else { + skippedProxyHostId = failedProxyHostId; } retValue = runFenceAction(_action, order); } @@ -322,14 +323,14 @@ || vdsDynamic.getStatus() == VDSStatus.NonResponsive); } - private VDS getFenceProxy(final boolean onlyUpHost, final boolean filterSelf, final PMProxyOptions proxyOptions) { + private VDS getFenceProxy(final boolean onlyUpHost, final boolean filterSelf, final PMProxyOptions proxyOptions, Guid exclude) { List<VDS> hosts = DbFacade.getInstance().getVdsDao().getAll(); synchronized (this) { - // If a skippedProxyHostId was given, try to use another proxy - if (skippedProxyHostId != null) { + // If a exclude was given, try to use another proxy + if (exclude != null) { Iterator<VDS> iter = hosts.iterator(); while (iter.hasNext()) { - if (iter.next().getId().equals(skippedProxyHostId)) { + if (iter.next().getId().equals(exclude)) { iter.remove(); break; } -- To view, visit http://gerrit.ovirt.org/34780 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2b846444ff795e7099b61f6d0be8909402b7bfa1 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Eli Mesika <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
