Kanagaraj M has uploaded a new change for review.

Change subject: gluster: fix NPE in volume sync job
......................................................................

gluster: fix NPE in volume sync job

Whenever a new brick/volume is discovered by the sync-job
it uses brick's serverId to find whether the corresponding
host is present in the engine database or not.

So VDS query will return empty serverId for the bricks
which doesn't have hosts in engine db .

Change-Id: I063569a3452a5c898a5a16791aff9ad409caf1cc
Bug-Url: https://bugzilla.redhat.com/1064777
Signed-off-by: Kanagaraj M <[email protected]>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumesListReturnForXmlRpc.java
1 file changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/30/24430/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumesListReturnForXmlRpc.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumesListReturnForXmlRpc.java
index 766f8b3..0cb3e39 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumesListReturnForXmlRpc.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumesListReturnForXmlRpc.java
@@ -170,7 +170,7 @@
         VdsStatic server = dbUtils.getServer(clusterId, hostnameOrIp);
         if (server == null) {
             log.warnFormat("Could not add brick {0} to volume {1} - server {2} 
not found in cluster {3}", brickInfo, volumeId, hostnameOrIp, clusterId);
-            return null;
+            return getBrickEntity(clusterId, volumeId, brickOrder, null, 
brickDir);
         }
 
         return getBrickEntity(clusterId, volumeId, brickOrder, server, 
brickDir);
@@ -190,7 +190,7 @@
         GlusterServer glusterServer = 
dbUtils.getServerByUuid(Guid.createGuidFromString(hostUuid));
         if (glusterServer == null) {
             log.warnFormat("Could not add brick {0} to volume {1} - server 
uuid {2} not found in cluster {3}", brickName, volumeId, hostUuid, clusterId);
-            return null;
+            return getBrickEntity(clusterId, volumeId, brickOrder, null, 
brickDir);
         }
         VdsStatic server = 
DbFacade.getInstance().getVdsStaticDao().get(glusterServer.getId());
         return getBrickEntity(clusterId, volumeId, brickOrder, server, 
brickDir);
@@ -206,8 +206,10 @@
         brick.setBrickOrder(brickOrder);
         brick.setBrickDirectory(brickDir);
 
-        brick.setServerId(server.getId());
-        brick.setServerName(server.getHostName());
+        if (server != null) {
+            brick.setServerId(server.getId());
+            brick.setServerName(server.getHostName());
+        }
 
         return brick;
     }


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

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

Reply via email to