Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ public DataStore initialize(Map<String, Object> dsInfos) {

URI uri = null;
try {
if (url != null && url.startsWith("rbd://")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in case the url scheme is not case sensitive, can use:

Suggested change
if (url != null && url.startsWith("rbd://")) {
if (url != null && url..toLowerCase().startsWith("rbd://")) {

(or)

Suggested change
if (url != null && url.startsWith("rbd://")) {
if (StringUtils.startsWithIgnoreCase(url, "rbd://")) {

url = url.replace(",", "/");
}
uri = new URI(UriUtils.encodeURIComponent(url));
if (uri.getScheme() == null) {
throw new InvalidParameterValueException("scheme is null " + url + ", add nfs:// (or cifs://) as a prefix");
Expand Down Expand Up @@ -245,9 +248,10 @@ public DataStore initialize(Map<String, Object> dsInfos) {
port = 0;
}
parameters.setType(StoragePoolType.RBD);
parameters.setHost(storageHost);
int lastSlash = hostPath.lastIndexOf("/");
parameters.setHost(storageHost + hostPath.substring(0, lastSlash).replace("/", ","));
parameters.setPort(port);
parameters.setPath(hostPath.replaceFirst("/", ""));
parameters.setPath(hostPath.substring(lastSlash + 1));
parameters.setUserInfo(userInfo);
} else if (scheme.equalsIgnoreCase("PreSetup")) {
parameters.setType(StoragePoolType.PreSetup);
Expand Down