Tal Nisan has uploaded a new change for review.

Change subject: restapi: Null check on domain volume group when attempting to 
extend domain
......................................................................

restapi: Null check on domain volume group when attempting to extend domain

When editing a block domain via REST, the LUN passed in the new entity can
come either from the LUNs collection and in case it's empty from the volume
group property and it's LUNs, added a null check on the volume group since
when you do not provide LUNs it automatically falls back to volume group
which might be null

Change-Id: Ic762bdfb4c01d7b9344c94878d6662b9866a4090
Bug-Url: https://bugzilla.redhat.com/1115966
Signed-off-by: Tal Nisan <tni...@redhat.com>restapi:
---
M 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainResource.java
1 file changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/34/35334/1

diff --git 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainResource.java
 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainResource.java
index 375ea04..5c42443 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainResource.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainResource.java
@@ -200,8 +200,18 @@
     }
 
     private List<LogicalUnit> getIncomingLuns(Storage storage) {
-        //user may pass the LUNs under Storage, or Storage-->VolumeGroup; both 
are supported.
-        return !storage.getLogicalUnits().isEmpty() ? 
storage.getLogicalUnits() : storage.getVolumeGroup().getLogicalUnits();
+        // user may pass the LUNs under Storage, or Storage-->VolumeGroup; 
both are supported.
+        if (storage.getLogicalUnits().isEmpty()) {
+            if (storage.getVolumeGroup() != null) {
+                return storage.getVolumeGroup().getLogicalUnits();
+            }
+            else {
+                return new ArrayList<LogicalUnit>();
+            }
+        }
+        else {
+            return storage.getLogicalUnits();
+        }
     }
 
     private Guid getHostId(StorageDomain storageDomain) {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic762bdfb4c01d7b9344c94878d6662b9866a4090
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Tal Nisan <tni...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to