Ramesh N has uploaded a new change for review.

Change subject: gluster: fix NPE in gluster sync job for volume capacity info
......................................................................

gluster: fix NPE in gluster sync job for volume capacity info

 Fix NPE in GlusterSyncJob.refreshVolumeDetails. When all bricks
are down in a volume, volume capacity information can't be
retrived but volume status will work. So we can't update the
capacity info for volume but brick status can be updated.

Change-Id: Iab4c5cdc38c53aa7b35417ad3db10b1cb4ac0f2a
Bug-Url: https://bugzilla.redhat.com/1212290
Signed-off-by: Ramesh Nachimuthu <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterSyncJob.java
1 file changed, 9 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/95/40195/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterSyncJob.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterSyncJob.java
index 6308ea7..2ac54fb 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterSyncJob.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterSyncJob.java
@@ -928,7 +928,11 @@
         List<GlusterBrickEntity> brickPropertiesToAdd = new 
ArrayList<GlusterBrickEntity>();
 
         GlusterVolumeAdvancedDetails volumeAdvancedDetails = 
getVolumeAdvancedDetails(upServer, volume.getClusterId(), volume.getName());
-
+        if (volumeAdvancedDetails == null) {
+            log.error("Error while refreshing brick statuses for volume '{}'. 
Failed to get volume advanced details ",
+                    volume.getName());
+            return;
+        }
         if (volumeAdvancedDetails.getCapacityInfo() != null) {
             if (volume.getAdvancedDetails().getCapacityInfo() == null) {
                 
getVolumeDao().addVolumeCapacityInfo(volumeAdvancedDetails.getCapacityInfo());
@@ -1005,7 +1009,10 @@
                         null,
                         false, true));
 
-        return result.getSucceeded() ? (GlusterVolumeAdvancedDetails) 
result.getReturnValue() : null;
+        // Purposely returning returnValue as is without checking 
result.getSucceeded(), because
+        // VolumeAdvancedDetails runs multiple commands internally and if the 
last one fails, getSucceeded() will be
+        // false. But still we have the brick status details and we can update 
the brick status without any issue.
+        return (GlusterVolumeAdvancedDetails) result.getReturnValue();
     }
 
     private void removeVdsStatisticsFromDb(VDS server) {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab4c5cdc38c53aa7b35417ad3db10b1cb4ac0f2a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5-gluster
Gerrit-Owner: Ramesh N <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to