Timothy Asir has uploaded a new change for review.

Change subject: gluster: fix import cluster when one of the peers is unreachable
......................................................................

gluster: fix import cluster when one of the peers is unreachable

Change-Id: I3e31006072ebf771ce49a73238a4fb933a6269f7
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=983051
Signed-off-by: Timothy Asir <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterServersForImportQuery.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/GlusterUtil.java
2 files changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/14/19614/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterServersForImportQuery.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterServersForImportQuery.java
index 0177d3f..ba64129 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterServersForImportQuery.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterServersForImportQuery.java
@@ -1,5 +1,6 @@
 package org.ovirt.engine.core.bll.gluster;
 
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -45,6 +46,15 @@
                             getParameters().getPassword(),
                             getParameters().getFingerprint());
 
+            // Keep server details in the map only for the servers which are 
reachable
+            Iterator<Map.Entry<String, String>> iterator = 
serverFingerPrintMap.entrySet().iterator();
+            while (iterator.hasNext()) {
+                Map.Entry<String,String> entry = iterator.next();
+                if (entry.getValue() == null) {
+                    iterator.remove();
+                }
+            }
+
             // Check if any of the server in the map is already part of some 
other cluster.
             if (!validateServers(serverFingerPrintMap.keySet())) {
                 throw new 
RuntimeException(VdcBllMessages.SERVER_ALREADY_EXISTS_IN_ANOTHER_CLUSTER.toString());
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/GlusterUtil.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/GlusterUtil.java
index 3b376b6..e5e7828 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/GlusterUtil.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/GlusterUtil.java
@@ -179,7 +179,7 @@
             returnValue = getBackendInstance().
                     runInternalQuery(VdcQueryType.GetServerSSHKeyFingerprint,
                                      new ServerParameters(server));
-            if (returnValue != null && returnValue.getSucceeded()) {
+            if (returnValue != null && returnValue.getSucceeded() && 
returnValue.getReturnValue() != null) {
                 fingerprints.put(server, 
returnValue.getReturnValue().toString());
             } else {
                 fingerprints.put(server, null);


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e31006072ebf771ce49a73238a4fb933a6269f7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Timothy Asir <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to