Maor Lipchuk has uploaded a new change for review.

Change subject: core: Fix potential NPE when adding LUN disk
......................................................................

core: Fix potential NPE when adding LUN disk

Since LUN disk is not part of storage pool, validation of shareable disk
should not use the storage pool that is part of the LUN disk.

The proposed fix, only validate the supported DC version on image disk.

Change-Id: I6c55b95dac6f70435f7d1ac02a6a2a7cdd3f1e91
Signed-off-by: Maor Lipchuk <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java
1 file changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/62/7362/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java
index 4b3b4c8..a07186f 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java
@@ -91,10 +91,7 @@
             if (returnValue && DiskStorageType.LUN == 
getParameters().getDiskInfo().getDiskStorageType()) {
                 returnValue = checkIfLunDiskCanBeAdded();
             }
-            if (returnValue
-                    && getParameters().getDiskInfo().isShareable()
-                    && 
!isVersionSupportedForShareable(getParameters().getDiskInfo(),
-                            
getStoragePool().getcompatibility_version().getValue())) {
+            if (returnValue && isVersionNotSupportedForShareableDisk()) {
                 returnValue = false;
                 
addCanDoActionMessage(VdcBllMessages.ACTION_NOT_SUPPORTED_FOR_CLUSTER_POOL_LEVEL);
             }
@@ -102,6 +99,13 @@
         return returnValue;
     }
 
+    private boolean isVersionNotSupportedForShareableDisk() {
+        return getParameters().getDiskInfo().getDiskStorageType() == 
DiskStorageType.IMAGE
+                && getParameters().getDiskInfo().isShareable()
+                && !Config.<Boolean> 
GetValue(ConfigValues.ShareableDiskEnabled,
+                      getStoragePool().getcompatibility_version().getValue());
+    }
+
     private boolean checkIfLunDiskCanBeAdded() {
         boolean returnValue = true;
         if (getDiskLunMapDao().getDiskIdByLunId(((LunDisk) 
getParameters().getDiskInfo()).getLun().getLUN_id()) != null) {


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

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

Reply via email to