mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Make url in AddImageStoreCmd not required since S3 does not have url.
This commit is contained in:
parent
e7f6333209
commit
26424ff2a8
@ -44,7 +44,7 @@ public class AddImageStoreCmd extends BaseCmd {
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="the URL for the image store")
|
||||
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, description="the URL for the image store")
|
||||
private String url;
|
||||
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
|
||||
|
||||
@ -70,7 +70,6 @@ public class ImageStoreHelper {
|
||||
return store;
|
||||
}
|
||||
store = new ImageStoreVO();
|
||||
store.setName((String)params.get("name"));
|
||||
store.setProtocol((String)params.get("protocol"));
|
||||
store.setProviderName((String)params.get("providerName"));
|
||||
store.setScope((ScopeType)params.get("scope"));
|
||||
@ -82,6 +81,10 @@ public class ImageStoreHelper {
|
||||
store.setUuid(UUID.randomUUID().toString());
|
||||
}
|
||||
store.setUrl((String)params.get("url"));
|
||||
store.setName((String)params.get("name"));
|
||||
if ( store.getName() == null ){
|
||||
store.setName(store.getUuid());
|
||||
}
|
||||
store.setRole((DataStoreRole)params.get("role"));
|
||||
store = imageStoreDao.persist(store);
|
||||
|
||||
|
||||
@ -91,6 +91,7 @@ public class S3ImageStoreLifeCycleImpl implements ImageStoreLifeCycle {
|
||||
|
||||
s_logger.info("Trying to add a S3 store in data center " + dcId);
|
||||
|
||||
/*
|
||||
try{
|
||||
// verify S3 parameters
|
||||
_s3Mgr.verifyS3Fields(details);
|
||||
@ -98,6 +99,7 @@ public class S3ImageStoreLifeCycleImpl implements ImageStoreLifeCycle {
|
||||
catch (DiscoveryException ex){
|
||||
throw new InvalidParameterValueException("failed to verify S3 parameters!");
|
||||
}
|
||||
*/
|
||||
|
||||
Map<String, Object> imageStoreParameters = new HashMap<String, Object>();
|
||||
imageStoreParameters.put("name", url);
|
||||
|
||||
@ -90,7 +90,6 @@ public class SwiftImageStoreLifeCycleImpl implements ImageStoreLifeCycle {
|
||||
|
||||
// just need to insert an entry in DB
|
||||
Map<String, Object> imageStoreParameters = new HashMap<String, Object>();
|
||||
imageStoreParameters.put("name", url);
|
||||
imageStoreParameters.put("zoneId", dcId);
|
||||
imageStoreParameters.put("url", url);
|
||||
imageStoreParameters.put("protocol", "http");
|
||||
|
||||
@ -258,10 +258,10 @@ public class S3ManagerImpl extends ManagerBase implements S3Manager {
|
||||
params.get(ApiConstants.S3_SECRET_KEY),
|
||||
params.get(ApiConstants.S3_END_POINT),
|
||||
params.get(ApiConstants.S3_BUCKET_NAME),
|
||||
Boolean.valueOf(params.get(ApiConstants.S3_HTTPS_FLAG)),
|
||||
Integer.valueOf(params.get(ApiConstants.S3_CONNECTION_TIMEOUT)),
|
||||
Integer.valueOf(params.get(ApiConstants.S3_MAX_ERROR_RETRY)),
|
||||
Integer.valueOf(params.get(ApiConstants.S3_SOCKET_TIMEOUT)), now());
|
||||
params.get(ApiConstants.S3_HTTPS_FLAG) == null ? false : Boolean.valueOf(params.get(ApiConstants.S3_HTTPS_FLAG)),
|
||||
params.get(ApiConstants.S3_CONNECTION_TIMEOUT) == null ? null : Integer.valueOf(params.get(ApiConstants.S3_CONNECTION_TIMEOUT)),
|
||||
params.get(ApiConstants.S3_MAX_ERROR_RETRY) == null ? null : Integer.valueOf(params.get(ApiConstants.S3_MAX_ERROR_RETRY)),
|
||||
params.get(ApiConstants.S3_SOCKET_TIMEOUT) == null ? null : Integer.valueOf(params.get(ApiConstants.S3_SOCKET_TIMEOUT)), now());
|
||||
|
||||
this.validateFields(s3VO);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user