Eli Mesika has uploaded a new change for review.

Change subject: core: After enable concurrent option under host...
......................................................................

core: After enable concurrent option under host...

After enable concurrent option under host power management fencing begin failed

This bug was probably caused by a race:
>From the logs its seems that a NULL proxy host is attempt to be used.

There is a check for a valid proxy in canDoAction but not all the
execution paths checks for proxy
Checking for proxy should be also in execute for
single/dual[sequential,concurrent] and the flag that indicates if the
operation succeeded should be set accordingly

Change-Id: I139a7de9a4bb24a56523073b800b929a31fcdc6a
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=977689
Signed-off-by: Eli Mesika <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
1 file changed, 72 insertions(+), 58 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/06/17206/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 2b589a3..ead18cb 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
@@ -195,6 +195,10 @@
                 handleError(lastStatus, vdsReturnValue, 
FenceAgentOrder.Primary);
             }
         }
+        else {
+            setFenceSucceeded(false);
+            vdsReturnValue.setSucceeded(false);
+        }
     }
 
     /**
@@ -217,6 +221,10 @@
             } else {
                 tryOtherSequentialAgent(lastStatus);
             }
+        }
+        else {
+            setFenceSucceeded(false);
+            vdsReturnValue.setSucceeded(false);
         }
     }
 
@@ -255,71 +263,77 @@
     private void handleMultipleConcurrentAgents(VDSStatus lastStatus, 
VDSReturnValue vdsReturnValue) {
         primaryExecutor = new FenceExecutor(getVds(), 
getParameters().getAction());
         secondaryExecutor = new FenceExecutor(getVds(), 
getParameters().getAction());
-        primaryResult = new FenceInvocationResult();
-        secondaryResult = new FenceInvocationResult();
-        List<Callable<FenceInvocationResult>> tasks = new 
ArrayList<Callable<FenceInvocationResult>>();
-        Future<FenceInvocationResult> f1 = null;
-        Future<FenceInvocationResult> f2 = null;
-        tasks.add(new Callable<FenceInvocationResult>() {
-            @Override
-            public FenceInvocationResult call() {
-                return run(primaryExecutor, FenceAgentOrder.Primary);
-            }
-        });
-        tasks.add(new Callable<FenceInvocationResult>() {
-            @Override
-            public FenceInvocationResult call() {
-                return run(secondaryExecutor, FenceAgentOrder.Secondary);
-            }
-        });
-        try {
-            ExecutorCompletionService<FenceInvocationResult> ecs = 
ThreadPoolUtil.createCompletionService(tasks);
-            switch (getParameters().getAction()) {
-            case Start:
-                try {
-                f1 = ecs.take();
-                setResult(f1);
-                if (primaryResult.isSucceeded() || 
secondaryResult.isSucceeded()) {
-                    handleSpecificCommandActions();
-                    setFenceSucceeded(true);
-                } else {
-                    tryOtherConcurrentAgent(lastStatus, ecs);
+        if (primaryExecutor.findProxyHost() && 
secondaryExecutor.findProxyHost()) {
+            primaryResult = new FenceInvocationResult();
+            secondaryResult = new FenceInvocationResult();
+            List<Callable<FenceInvocationResult>> tasks = new 
ArrayList<Callable<FenceInvocationResult>>();
+            Future<FenceInvocationResult> f1 = null;
+            Future<FenceInvocationResult> f2 = null;
+            tasks.add(new Callable<FenceInvocationResult>() {
+                @Override
+                public FenceInvocationResult call() {
+                    return run(primaryExecutor, FenceAgentOrder.Primary);
                 }
-                } catch (InterruptedException e) {
-                    tryOtherConcurrentAgent(lastStatus, ecs);
-                } catch (ExecutionException e) {
-                    tryOtherConcurrentAgent(lastStatus, ecs);
+            });
+            tasks.add(new Callable<FenceInvocationResult>() {
+                @Override
+                public FenceInvocationResult call() {
+                    return run(secondaryExecutor, FenceAgentOrder.Secondary);
                 }
+            });
+            try {
+                ExecutorCompletionService<FenceInvocationResult> ecs = 
ThreadPoolUtil.createCompletionService(tasks);
+                switch (getParameters().getAction()) {
+                case Start:
+                    try {
+                        f1 = ecs.take();
+                        setResult(f1);
+                        if (primaryResult.isSucceeded() || 
secondaryResult.isSucceeded()) {
+                            handleSpecificCommandActions();
+                            setFenceSucceeded(true);
+                        } else {
+                            tryOtherConcurrentAgent(lastStatus, ecs);
+                        }
+                    } catch (InterruptedException e) {
+                        tryOtherConcurrentAgent(lastStatus, ecs);
+                    } catch (ExecutionException e) {
+                        tryOtherConcurrentAgent(lastStatus, ecs);
+                    }
 
-                break;
-            case Stop:
-                f1 = ecs.take();
-                f2 = ecs.take();
+                    break;
+                case Stop:
+                    f1 = ecs.take();
+                    f2 = ecs.take();
 
-                if (f1.get().getOrder() == FenceAgentOrder.Primary) {
-                    primaryResult = f1.get();
-                    secondaryResult = f2.get();
-                } else {
-                    primaryResult = f2.get();
-                    secondaryResult = f1.get();
-                }
-                if (primaryResult.isSucceeded() && 
secondaryResult.isSucceeded()) {
-                    handleSpecificCommandActions();
+                    if (f1.get().getOrder() == FenceAgentOrder.Primary) {
+                        primaryResult = f1.get();
+                        secondaryResult = f2.get();
+                    } else {
+                        primaryResult = f2.get();
+                        secondaryResult = f1.get();
+                    }
+                    if (primaryResult.isSucceeded() && 
secondaryResult.isSucceeded()) {
+                        handleSpecificCommandActions();
+                        setFenceSucceeded(true);
+                    } else {
+                        handleError(lastStatus,
+                                !primaryResult.isSucceeded() ? 
primaryResult.getValue() : secondaryResult.getValue(),
+                                !primaryResult.isSucceeded() ? 
FenceAgentOrder.Primary : FenceAgentOrder.Secondary);
+                    }
+                    break;
+                default:
                     setFenceSucceeded(true);
-                } else {
-                    handleError(lastStatus,
-                            !primaryResult.isSucceeded() ? 
primaryResult.getValue() : secondaryResult.getValue(),
-                            !primaryResult.isSucceeded() ? 
FenceAgentOrder.Primary : FenceAgentOrder.Secondary);
+                    break;
                 }
-                break;
-            default:
-                setFenceSucceeded(true);
-                break;
+            } catch (InterruptedException e) {
+                log.error(e);
+            } catch (ExecutionException e) {
+                log.error(e);
             }
-        } catch (InterruptedException e) {
-            log.error(e);
-        } catch (ExecutionException e) {
-            log.error(e);
+        }
+        else {
+            setFenceSucceeded(false);
+            vdsReturnValue.setSucceeded(false);
         }
     }
 


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

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