Eli Mesika has uploaded a new change for review.

Change subject: [RFE] Improve fencing robustness by retrying...
......................................................................

[RFE] Improve fencing robustness by retrying...

Improve fencing robustness by retrying failed attempts

This patch adds the following logic to the fencing flow:
In case that a fencing action is failed, an attempt to repeat the failed
action with a different proxy from that used in the failed operation is
done.
In case that no such proxy is available, the operation is repeated with
the same proxy.

Change-Id: I817e8a03695d02ee3f59fbefe0fe41483c3989fe
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=961753
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, 26 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/09/27309/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 be5f782..c502d98 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
@@ -36,6 +36,7 @@
     private FenceActionType _action = FenceActionType.forValue(0);
     private Guid proxyHostId;
     private String proxyHostName;
+    private Guid skippedProxyHostId=null;
 
     public FenceExecutor(VDS vds, FenceActionType actionType) {
         // TODO remove if block after UI patch that should set also cluster & 
proxy preferences in GetNewVdsFenceStatusParameters
@@ -137,6 +138,13 @@
         return !NO_VDS.equals(proxyHostId);
     }
 
+    private synchronized boolean findProxyHost(Guid id) {
+        skippedProxyHostId = id;
+        boolean res = findProxyHost();
+        skippedProxyHostId=null;
+        return res;
+    }
+
     private void logProxySelection(String proxy, String origin, String 
command) {
         AuditLogableBase logable = new AuditLogableBase();
         logable.addCustomValue("Proxy", proxy);
@@ -169,6 +177,15 @@
                 }
             }
             retValue = runFenceAction(_action, order);
+            // if fence failed, retry with another proxy
+            if (!retValue.getSucceeded()) {
+                log.warnFormat("Fencing operation failed with proxy host {0}, 
trying another proxy...", proxyHostId);
+                if (!findProxyHost(proxyHostId)) {
+                    log.warnFormat("Failed to find other proxy to re-run 
failed fence operation, retrying with the same proxy...");
+                    findProxyHost();
+                }
+                retValue = runFenceAction(_action, order);
+            }
         } catch (VdcBLLException e) {
             retValue = new VDSReturnValue();
             retValue.setReturnValue(new FenceStatusReturnValue("unknown", 
e.getMessage()));
@@ -286,6 +303,15 @@
 
     private VDS getFenceProxy(final boolean onlyUpHost, final boolean 
filterSelf, final PMProxyOptions proxyOptions) {
         List<VDS> hosts = DbFacade.getInstance().getVdsDao().getAll();
+        // If a skippedProxyHostId was given, try to use another proxy
+        if (skippedProxyHostId != null) {
+            for (int i=0; i < hosts.size(); i++) {
+                if (hosts.get(i).getId().equals(skippedProxyHostId)) {
+                    hosts.remove(i);
+                    break;
+                }
+            }
+        }
         VDS proxyHost = LinqUtils.firstOrNull(hosts, new Predicate<VDS>() {
             @Override
             public boolean eval(VDS vds) {


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

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

Reply via email to