You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2013/12/26 20:50:44 UTC

git commit: updated refs/heads/4.3 to 69fb1d4

Updated Branches:
  refs/heads/4.3 35ba14d88 -> 69fb1d4ed


CLOUDSTACK-5530 attempt to add secondary storage with the same name is ignored


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/69fb1d4e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/69fb1d4e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/69fb1d4e

Branch: refs/heads/4.3
Commit: 69fb1d4ed04156b61ca7993516d6ca02e72d45a2
Parents: 35ba14d
Author: Bharat Kumar <bh...@citrix.com>
Authored: Thu Dec 26 15:30:30 2013 +0530
Committer: Min Chen <mi...@citrix.com>
Committed: Thu Dec 26 11:48:45 2013 -0800

----------------------------------------------------------------------
 server/src/com/cloud/storage/StorageManagerImpl.java | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/69fb1d4e/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index a96a4ee..e478956 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -1689,6 +1689,15 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
             scopeType = ScopeType.REGION;
         }
 
+        String name = cmd.getName();
+        if (name == null) {
+            name = cmd.getUrl();
+        }
+        ImageStoreVO imageStore = _imageStoreDao.findByName(name);
+        if (imageStore != null) {
+            throw new InvalidParameterValueException("The image store with name " + name + " already exists, try creating with another name");
+        }
+
         // check if scope is supported by store provider
         if (!((ImageStoreProvider) storeProvider).isScopeSupported(scopeType)) {
             throw new InvalidParameterValueException("Image store provider " + providerName + " does not support scope " + scopeType);