mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix CLOUDSTACK-2538: Add name as an optional parameter for addImageStore
api.
This commit is contained in:
parent
255d08ae7c
commit
ef541a2a7b
@ -44,6 +44,9 @@ public class AddImageStoreCmd extends BaseCmd {
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name for the image store")
|
||||
private String name;
|
||||
|
||||
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, description="the URL for the image store")
|
||||
private String url;
|
||||
|
||||
@ -65,10 +68,15 @@ public class AddImageStoreCmd extends BaseCmd {
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
@ -80,6 +80,10 @@ public class CloudStackImageStoreLifeCycleImpl implements ImageStoreLifeCycle {
|
||||
|
||||
Long dcId = (Long) dsInfos.get("zoneId");
|
||||
String url = (String) dsInfos.get("url");
|
||||
String name = (String)dsInfos.get("name");
|
||||
if ( name == null ){
|
||||
name = url;
|
||||
}
|
||||
String providerName = (String)dsInfos.get("providerName");
|
||||
DataStoreRole role =(DataStoreRole) dsInfos.get("role");
|
||||
Map<String, String> details = (Map<String, String>)dsInfos.get("details");
|
||||
@ -111,7 +115,7 @@ public class CloudStackImageStoreLifeCycleImpl implements ImageStoreLifeCycle {
|
||||
|
||||
|
||||
Map<String, Object> imageStoreParameters = new HashMap<String, Object>();
|
||||
imageStoreParameters.put("name", url);
|
||||
imageStoreParameters.put("name", name);
|
||||
imageStoreParameters.put("zoneId", dcId);
|
||||
imageStoreParameters.put("url", url);
|
||||
imageStoreParameters.put("protocol", uri.getScheme().toLowerCase());
|
||||
|
||||
@ -84,6 +84,7 @@ public class S3ImageStoreLifeCycleImpl implements ImageStoreLifeCycle {
|
||||
|
||||
Long dcId = (Long) dsInfos.get("zoneId");
|
||||
String url = (String) dsInfos.get("url");
|
||||
String name = (String)dsInfos.get("name");
|
||||
String providerName = (String)dsInfos.get("providerName");
|
||||
ScopeType scope = (ScopeType)dsInfos.get("scope");
|
||||
DataStoreRole role =(DataStoreRole) dsInfos.get("role");
|
||||
@ -102,7 +103,7 @@ public class S3ImageStoreLifeCycleImpl implements ImageStoreLifeCycle {
|
||||
*/
|
||||
|
||||
Map<String, Object> imageStoreParameters = new HashMap<String, Object>();
|
||||
imageStoreParameters.put("name", url);
|
||||
imageStoreParameters.put("name", name);
|
||||
imageStoreParameters.put("zoneId", dcId);
|
||||
imageStoreParameters.put("url", url);
|
||||
String protocol = "http";
|
||||
|
||||
@ -80,6 +80,7 @@ public class SwiftImageStoreLifeCycleImpl implements ImageStoreLifeCycle {
|
||||
|
||||
Long dcId = (Long) dsInfos.get("zoneId");
|
||||
String url = (String) dsInfos.get("url");
|
||||
String name = (String)dsInfos.get("name");
|
||||
ScopeType scope = (ScopeType)dsInfos.get("scope");
|
||||
String providerName = (String)dsInfos.get("providerName");
|
||||
DataStoreRole role =(DataStoreRole) dsInfos.get("role");
|
||||
@ -90,6 +91,7 @@ public class SwiftImageStoreLifeCycleImpl implements ImageStoreLifeCycle {
|
||||
|
||||
// just need to insert an entry in DB
|
||||
Map<String, Object> imageStoreParameters = new HashMap<String, Object>();
|
||||
imageStoreParameters.put("name", name);
|
||||
imageStoreParameters.put("zoneId", dcId);
|
||||
imageStoreParameters.put("url", url);
|
||||
imageStoreParameters.put("protocol", "http");
|
||||
|
||||
@ -1892,7 +1892,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("zoneId", dcId);
|
||||
params.put("url", cmd.getUrl());
|
||||
params.put("name", cmd.getUrl());
|
||||
params.put("name", cmd.getName());
|
||||
params.put("details", details);
|
||||
params.put("scope", scopeType);
|
||||
params.put("providerName", storeProvider.getName());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user