Liron Ar has uploaded a new change for review.

Change subject: core: avoid disconnecting from used connections
......................................................................

core: avoid disconnecting from used connections

When attempting to extend a LUN based storage domain, the engine
attempts to connect all the hosts to the lun. If one or more hosts fail
to see the chosen luns for the extension - the engine attempts to
disconnect all the hosts from the target.

In that scenario the connection isn't loaded from the DB, therefore it's
id will be always null - which can cause to disconnection from targets
that are used by other luns that are in use.

Change-Id: I7008e64ebce57fbbdb350810a5ffca6e0a7800cc
Bug-Url: https://bugzilla.redhat.com/982707
Signed-off-by: Liron Aravot <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ISCSIStorageHelper.java
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/83/17983/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ISCSIStorageHelper.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ISCSIStorageHelper.java
index 8264dde..317ad04 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ISCSIStorageHelper.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ISCSIStorageHelper.java
@@ -100,6 +100,7 @@
         List<StorageServerConnections> toRemove =
                 new ArrayList<StorageServerConnections>();
         for (StorageServerConnections connection : connections) {
+            fillConnectionDetailsIfNeeded(connection);
             List<String> list = LinqUtils.foreach(
                     
DbFacade.getInstance().getLunDao().getAllForStorageServerConnection(connection.getid()),
                     new Function<LUNs, String>() {
@@ -116,6 +117,15 @@
         return (List<StorageServerConnections>) 
CollectionUtils.subtract(connections, toRemove);
     }
 
+    private void fillConnectionDetailsIfNeeded(StorageServerConnections 
connection) {
+        if (connection.getid() == null) {
+            List<StorageServerConnections> dbConnections = 
DbFacade.getInstance().getStorageServerConnectionDao().getAllForConnection(connection);
+            if (!dbConnections.isEmpty()) {
+                connection.setid(dbConnections.get(0).getid());
+            }
+        }
+    }
+
     @Override
     public boolean isConnectSucceeded(final Map<String, String> returnValue,
             List<StorageServerConnections> connections) {


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

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

Reply via email to