Sahina Bose has uploaded a new change for review.

Change subject: engine: Fixed issue with null brick during sync
......................................................................

engine: Fixed issue with null brick during sync

While syncing gluster volume info, if the server
associated with one of the bricks is not available
in the engine db, a null object was returned for the
brick. This causes NPE - handling that flow here.

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


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/99/40799/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 e4d38e2..71f5be4 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
@@ -136,17 +136,18 @@
      */
     private List<GlusterBrickEntity> getBricks(Guid volumeId, Object[] 
brickList, boolean withUuid) throws Exception {
         List<GlusterBrickEntity> bricks = new ArrayList<GlusterBrickEntity>();
-
+        GlusterBrickEntity fetchedBrick;
         int brickOrder = 0;
 
         try {
-            if (withUuid) {
-                for (Object brick : brickList) {
-                    bricks.add(getBrick(clusterId, volumeId, (Map<String, 
Object>) brick, brickOrder++));
+            for (Object brick : brickList) {
+                if (withUuid) {
+                    fetchedBrick = getBrick(clusterId, volumeId, (Map<String, 
Object>) brick, brickOrder++);
+                } else {
+                    fetchedBrick = getBrick(clusterId, volumeId, (String) 
brick, brickOrder++);
                 }
-            } else {
-                for (Object brick : brickList) {
-                    bricks.add(getBrick(clusterId, volumeId, (String) brick, 
brickOrder++));
+                if (fetchedBrick != null) {
+                    bricks.add(fetchedBrick);
                 }
             }
         } catch (Exception e) {


-- 
To view, visit https://gerrit.ovirt.org/40799
To unsubscribe, visit https://gerrit.ovirt.org/settings

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

Reply via email to