Liron Aravot has uploaded a new change for review.

Change subject: core: correct handling of FCP lun disks (#854185)
......................................................................

core: correct handling of FCP lun disks (#854185)

https://bugzilla.redhat.com/show_bug.cgi?id=854141

when creating lun disk using FCP, it has no storage server
connections. When assuming that the lun has storage server connections caused 
to NPE in multiple
scenarions, this patch fixes this issue.

Change-Id: I1843a0f3d7f26e49646bf9d414e1858ce46fa167
Signed-off-by: Liron Aravot <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java
2 files changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/64/7764/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
index 96d08c6..85bcccd 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
@@ -661,8 +661,10 @@
                 .getStorageServerConnectionDAO()
                 .getAllForLun(lun.getLUN_id())));
 
-        StorageHelperDirector.getInstance().getItem(
-                
lun.getLunConnections().get(0).getstorage_type()).removeLun(lun);
+        if (!lun.getLunConnections().isEmpty()) {
+            StorageHelperDirector.getInstance().getItem(
+                    
lun.getLunConnections().get(0).getstorage_type()).removeLun(lun);
+        }
 
     }
 
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java
index 9d84370..0e6ae98 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java
@@ -350,10 +350,12 @@
             lun.setLunConnections(new 
ArrayList<storage_server_connections>(DbFacade.getInstance()
                                             .getStorageServerConnectionDAO()
                                             .getAllForLun(lun.getLUN_id())));
-            if 
(!StorageHelperDirector.getInstance().getItem(lun.getLunConnections().get(0).getstorage_type())
+            if (!lun.getLunConnections().isEmpty()) {
+                if 
(!StorageHelperDirector.getInstance().getItem(lun.getLunConnections().get(0).getstorage_type())
                         .ConnectStorageToLunByVdsId(null, hostId, lun, 
getVm().getstorage_pool_id())) {
-                log.infoFormat("Failed to connect  a lun disk to vdsm {0} 
skiping it", hostId);
-                return false;
+                    log.infoFormat("Failed to connect  a lun disk to vdsm {0} 
skiping it", hostId);
+                    return false;
+                }
             }
         }
         return true;


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

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

Reply via email to