DK101010 commented on code in PR #6699:
URL: https://github.com/apache/cloudstack/pull/6699#discussion_r1386432622
##########
plugins/storage/volume/default/src/main/java/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java:
##########
@@ -138,64 +134,26 @@ public DataStore initialize(Map<String, Object> dsInfos) {
PrimaryDataStoreParameters parameters = new
PrimaryDataStoreParameters();
- UriUtils.UriInfo uriInfo = UriUtils.getUriInfo(url);
-
- String scheme = uriInfo.getScheme();
- String storageHost = uriInfo.getStorageHost();
- String storagePath = uriInfo.getStoragePath();
- try {
- if (scheme == null) {
- throw new InvalidParameterValueException("scheme is null " +
url + ", add nfs:// (or cifs://) as a prefix");
- } else if (scheme.equalsIgnoreCase("nfs")) {
- if (storageHost == null || storagePath == null ||
storageHost.trim().isEmpty() || storagePath.trim().isEmpty()) {
- throw new InvalidParameterValueException("host or path is
null, should be nfs://hostname/path");
- }
- } else if (scheme.equalsIgnoreCase("cifs")) {
- // Don't validate against a URI encoded URI.
- URI cifsUri = new URI(url);
- String warnMsg =
UriUtils.getCifsUriParametersProblems(cifsUri);
- if (warnMsg != null) {
- throw new InvalidParameterValueException(warnMsg);
- }
- } else if (scheme.equalsIgnoreCase("sharedMountPoint")) {
- if (storagePath == null) {
- throw new InvalidParameterValueException("host or path is
null, should be sharedmountpoint://localhost/path");
- }
- } else if (scheme.equalsIgnoreCase("rbd")) {
- if (storagePath == null) {
- throw new InvalidParameterValueException("host or path is
null, should be rbd://hostname/pool");
- }
- } else if (scheme.equalsIgnoreCase("gluster")) {
- if (storageHost == null || storagePath == null ||
storageHost.trim().isEmpty() || storagePath.trim().isEmpty()) {
- throw new InvalidParameterValueException("host or path is
null, should be gluster://hostname/volume");
- }
- }
- } catch (URISyntaxException e) {
- throw new InvalidParameterValueException(url + " is not a valid
uri");
- }
Review Comment:
@JoaoJandre I moved it to StorageManagerImpl.extractUriParamsAsMap
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]