Skip to content

Commit 74b1962

Browse files
sandeeplocharlaLocharla, Sandeep
authored andcommitted
CSTACKEX-7: ONTAP Primary storage pool (#9)
* CSTACKEX-7: ONTAP Primary storage pool --------- Co-authored-by: Locharla, Sandeep <Sandeep.Locharla@netapp.com>
1 parent 326577e commit 74b1962

4 files changed

Lines changed: 108 additions & 1 deletion

File tree

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/OntapResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ public void setRecords(List<T> records) {
6161
this.records = records;
6262
this.numRecords = (records != null) ? records.size() : 0;
6363
}
64-
}
64+
}

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/SANStrategy.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ public SANStrategy(OntapStorage ontapStorage) {
2626
super(ontapStorage);
2727
}
2828

29+
public abstract String createLUN(String svmName, String volumeName, String lunName, long sizeBytes, String osType);
30+
public abstract String createIgroup(String svmName, String igroupName, String[] initiators);
31+
public abstract String mapLUNToIgroup(String lunName, String igroupName);
32+
public abstract String enableISCSI(String svmUuid);
2933
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.cloudstack.storage.utils;
21+
22+
public class Constants {
23+
public enum ProtocolType {
24+
NFS,
25+
ISCSI
26+
}
27+
28+
public static final String NFS = "nfs";
29+
public static final String ISCSI = "iscsi";
30+
public static final String PROTOCOL = "protocol";
31+
public static final String SVM_NAME = "svmName";
32+
public static final String USERNAME = "username";
33+
public static final String PASSWORD = "password";
34+
public static final String MANAGEMENT_LIF = "managementLIF";
35+
public static final String IS_DISAGGREGATED = "isDisaggregated";
36+
public static final String RUNNING = "running";
37+
38+
public static final String JOB_RUNNING = "running";
39+
public static final String JOB_QUEUE = "queued";
40+
public static final String JOB_PAUSED = "paused";
41+
public static final String JOB_FAILURE = "failure";
42+
public static final String JOB_SUCCESS = "success";
43+
44+
public static final int JOB_MAX_RETRIES = 100;
45+
public static final int CREATE_VOLUME_CHECK_SLEEP_TIME = 2000;
46+
47+
public static final String HTTPS = "https://";
48+
public static final String GET_SVMs = "/api/svm/svms";
49+
public static final String CREATE_VOLUME = "/api/storage/volumes";
50+
public static final String GET_JOB_BY_UUID = "/api/cluster/jobs";
51+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.cloudstack.storage.utils;
21+
22+
import com.cloud.utils.StringUtils;
23+
import org.apache.cloudstack.storage.feign.model.OntapStorage;
24+
import org.springframework.stereotype.Component;
25+
import org.springframework.util.Base64Utils;
26+
27+
import javax.inject.Inject;
28+
import java.net.URI;
29+
30+
@Component
31+
public class Utility {
32+
@Inject
33+
OntapStorage ontapStorage;
34+
35+
private static final String BASIC = "Basic";
36+
private static final String AUTH_HEADER_COLON = ":";
37+
/**
38+
* Method generates authentication headers using storage backend credentials passed as normal string
39+
* @param username -->> username of the storage backend
40+
* @param password -->> normal decoded password of the storage backend
41+
* @return
42+
*/
43+
public String generateAuthHeader(String username, String password) {
44+
byte[] encodedBytes = Base64Utils.encode((username + AUTH_HEADER_COLON + password).getBytes());
45+
return BASIC + StringUtils.SPACE + new String(encodedBytes);
46+
}
47+
48+
public URI generateURI(String path) {
49+
String uriString = Constants.HTTPS + ontapStorage.getManagementLIF() + path;
50+
return URI.create(uriString);
51+
}
52+
}

0 commit comments

Comments
 (0)