Daniel Erez has uploaded a new change for review.

Change subject: core: allow identical path for different local domains
......................................................................

core: allow identical path for different local domains

StorageServerConnectionCommandBase -> isConnWithSameDetailsExists:
Added a specific validation for local domains connections;
allowing identical path for local domains residing
on different data-centers.

Note: as a future work, we should add a unique identification
for a local domains connections (e.g. to differentiate between
local connections retrieved from the rest-api).

Change-Id: I4628d7fa442b959d5582e44386f31518b98852e7
Bug-Url: https://bugzilla.redhat.com/1023739
Signed-off-by: Daniel Erez <de...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StorageServerConnectionCommandBase.java
1 file changed, 15 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/20886/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StorageServerConnectionCommandBase.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StorageServerConnectionCommandBase.java
index 0e76abd..c2eb7e9 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StorageServerConnectionCommandBase.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StorageServerConnectionCommandBase.java
@@ -53,9 +53,23 @@
         return 
getStorageDomainDao().getAllByConnectionId(Guid.createGuidFromString(connectionId));
     }
 
+    protected Guid getStoragePoolIdByConnId(String connectionId) {
+        List<StorageDomain> storageDomains = 
getStorageDomainsByConnId(connectionId);
+        if (storageDomains.isEmpty()) {
+            return null;
+        }
+
+        return storageDomains.get(0).getStoragePoolId();
+    }
+
     protected boolean isConnWithSameDetailsExists(StorageServerConnections 
connection) {
         List<StorageServerConnections> connections = null;
-        if (connection.getstorage_type().isFileDomain()) {
+        if (connection.getstorage_type() == StorageType.LOCALFS) {
+            Guid storagePoolId = getStoragePoolIdByConnId(connection.getid());
+            connections = storagePoolId == null ? 
Collections.<StorageServerConnections> emptyList() :
+                    
getStorageConnDao().getAllConnectableStorageSeverConnection(storagePoolId);
+        }
+        else if (connection.getstorage_type().isFileDomain()) {
             String connectionField = connection.getconnection();
             connections = 
getStorageConnDao().getAllForStorage(connectionField);
         }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4628d7fa442b959d5582e44386f31518b98852e7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Daniel Erez <de...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to