Skip to content

Commit 69fb1d4

Browse files
bvbharatminchen07
authored andcommitted
CLOUDSTACK-5530 attempt to add secondary storage with the same name is ignored
1 parent 35ba14d commit 69fb1d4

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

server/src/com/cloud/storage/StorageManagerImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,6 +1689,15 @@ public ImageStore discoverImageStore(AddImageStoreCmd cmd) throws IllegalArgumen
16891689
scopeType = ScopeType.REGION;
16901690
}
16911691

1692+
String name = cmd.getName();
1693+
if (name == null) {
1694+
name = cmd.getUrl();
1695+
}
1696+
ImageStoreVO imageStore = _imageStoreDao.findByName(name);
1697+
if (imageStore != null) {
1698+
throw new InvalidParameterValueException("The image store with name " + name + " already exists, try creating with another name");
1699+
}
1700+
16921701
// check if scope is supported by store provider
16931702
if (!((ImageStoreProvider) storeProvider).isScopeSupported(scopeType)) {
16941703
throw new InvalidParameterValueException("Image store provider " + providerName + " does not support scope " + scopeType);

0 commit comments

Comments
 (0)