Kanagaraj M has uploaded a new change for review.

Change subject: engine: Adding null check for VDS in NewGlusterServersQuery
......................................................................

engine: Adding null check for VDS in NewGlusterServersQuery

In case of an empty cluster we will not get any VDS to
execute the command. So a null check is added before executing
the corresponding command.

Change-Id: I839589d239a3dec771fc9aad7a0ef8f8e1a195fe
Signed-off-by: Kanagaraj M <kmayi...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetAddedGlusterServersQuery.java
1 file changed, 10 insertions(+), 6 deletions(-)


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

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetAddedGlusterServersQuery.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetAddedGlusterServersQuery.java
index 378ccb6..52fba20 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetAddedGlusterServersQuery.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetAddedGlusterServersQuery.java
@@ -30,13 +30,17 @@
     @Override
     @SuppressWarnings("unchecked")
     protected void executeQueryCommand() {
-        VDSReturnValue returnValue = 
getBackendInstance().RunVdsCommand(VDSCommandType.GlusterServersList,
-                new VdsIdVDSCommandParametersBase(getClusterUtils()
-                        .getUpServer(getParameters().getClusterId())
-                        .getId()));
+        Map<String, String> glusterServers = null;
+        VDS upServer = 
getClusterUtils().getUpServer(getParameters().getClusterId());
 
-        Map<String, String> glusterServers =
-                getAddedGlusterServers((List<GlusterServerInfo>) 
returnValue.getReturnValue());
+        if(upServer != null ) {
+            VDSReturnValue returnValue = 
getBackendInstance().RunVdsCommand(VDSCommandType.GlusterServersList,
+                            new 
VdsIdVDSCommandParametersBase(upServer.getId()));
+            glusterServers = getAddedGlusterServers((List<GlusterServerInfo>) 
returnValue.getReturnValue());
+        }
+        else {
+            glusterServers = new HashMap<String, String>();
+        }
         getQueryReturnValue().setReturnValue(glusterServers);
     }
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I839589d239a3dec771fc9aad7a0ef8f8e1a195fe
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Kanagaraj M <kmayi...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to