Skip to content

Commit 7ee8138

Browse files
Gupta, SuryaGupta, Surya
authored andcommitted
CSTACKEX-37 Utility Issue
1 parent a2f843d commit 7ee8138

File tree

3 files changed

+19
-24
lines changed

3 files changed

+19
-24
lines changed

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriver.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@
5959
public class OntapPrimaryDatastoreDriver implements PrimaryDataStoreDriver {
6060

6161
private static final Logger s_logger = LogManager.getLogger(OntapPrimaryDatastoreDriver.class);
62-
63-
@Inject private Utility utils;
6462
@Inject private StoragePoolDetailsDao storagePoolDetailsDao;
6563
@Inject private PrimaryDataStoreDao storagePoolDao;
6664
@Override
@@ -126,9 +124,9 @@ private String createCloudStackVolumeForTypeVolume(DataStore dataStore, DataObje
126124
throw new CloudRuntimeException("createCloudStackVolume : Storage Pool not found for id: " + dataStore.getId());
127125
}
128126
Map<String, String> details = storagePoolDetailsDao.listDetailsKeyPairs(dataStore.getId());
129-
StorageStrategy storageStrategy = utils.getStrategyByStoragePoolDetails(details);
127+
StorageStrategy storageStrategy = Utility.getStrategyByStoragePoolDetails(details);
130128
s_logger.info("createCloudStackVolumeForTypeVolume: Connection to Ontap SVM [{}] successful, preparing CloudStackVolumeRequest", details.get(Constants.SVM_NAME));
131-
CloudStackVolume cloudStackVolumeRequest = utils.createCloudStackVolumeRequestByProtocol(storagePool, details, dataObject);
129+
CloudStackVolume cloudStackVolumeRequest = Utility.createCloudStackVolumeRequestByProtocol(storagePool, details, dataObject);
132130
CloudStackVolume cloudStackVolume = storageStrategy.createCloudStackVolume(cloudStackVolumeRequest);
133131
if (ProtocolType.ISCSI.name().equalsIgnoreCase(details.get(Constants.PROTOCOL)) && cloudStackVolume.getLun() != null && cloudStackVolume.getLun().getName() != null) {
134132
return cloudStackVolume.getLun().getName();

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

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@
5252
* Supported platform: Unified and Disaggregated
5353
*/
5454
public abstract class StorageStrategy {
55-
@Inject
56-
private Utility utils;
5755

5856
@Inject
5957
private VolumeFeignClient volumeFeignClient;
@@ -82,7 +80,7 @@ public StorageStrategy(OntapStorage ontapStorage) {
8280
public boolean connect() {
8381
s_logger.info("Attempting to connect to ONTAP cluster at " + storage.getManagementLIF());
8482
//Get AuthHeader
85-
String authHeader = utils.generateAuthHeader(storage.getUsername(), storage.getPassword());
83+
String authHeader = Utility.generateAuthHeader(storage.getUsername(), storage.getPassword());
8684
String svmName = storage.getSvmName();
8785
try {
8886
// Call the SVM API to check if the SVM exists
@@ -139,7 +137,7 @@ public Volume createStorageVolume(String volumeName, Long size) {
139137
throw new CloudRuntimeException("No aggregates available to create volume on SVM " + svmName);
140138
}
141139
// Get the AuthHeader
142-
String authHeader = utils.generateAuthHeader(storage.getUsername(), storage.getPassword());
140+
String authHeader = Utility.generateAuthHeader(storage.getUsername(), storage.getPassword());
143141

144142
// Generate the Create Volume Request
145143
Volume volumeRequest = new Volume();
@@ -153,7 +151,7 @@ public Volume createStorageVolume(String volumeName, Long size) {
153151
// Make the POST API call to create the volume
154152
try {
155153
// Create URI for POST CreateVolume API
156-
URI url = utils.generateURI(Constants.CREATE_VOLUME);
154+
URI url = Utility.generateURI(Constants.CREATE_VOLUME);
157155
// Call the VolumeFeignClient to create the volume
158156
JobResponse jobResponse = volumeFeignClient.createVolumeWithJob(url, authHeader, volumeRequest);
159157
if (jobResponse == null || jobResponse.getJob() == null) {
@@ -162,7 +160,7 @@ public Volume createStorageVolume(String volumeName, Long size) {
162160
String jobUUID = jobResponse.getJob().getUuid();
163161

164162
//Create URI for GET Job API
165-
url = utils.generateURI(Constants.GET_JOB_BY_UUID);
163+
url = Utility.generateURI(Constants.GET_JOB_BY_UUID);
166164
int jobRetryCount = 0;
167165
Job createVolumeJob = null;
168166
while(createVolumeJob == null || !createVolumeJob.getState().equals(Constants.JOB_SUCCESS)) {
@@ -199,7 +197,7 @@ public Volume createStorageVolume(String volumeName, Long size) {
199197
* Eligible only for Unified ONTAP storage
200198
* throw exception in case of disaggregated ONTAP storage
201199
*
202-
* @param values
200+
* @param volume
203201
*/
204202
public Volume updateStorageVolume(Volume volume)
205203
{
@@ -212,7 +210,7 @@ public Volume updateStorageVolume(Volume volume)
212210
* Eligible only for Unified ONTAP storage
213211
* throw exception in case of disaggregated ONTAP storage
214212
*
215-
* @param values
213+
* @param volume
216214
*/
217215
public void deleteStorageVolume(Volume volume)
218216
{
@@ -224,7 +222,7 @@ public void deleteStorageVolume(Volume volume)
224222
* Eligible only for Unified ONTAP storage
225223
* throw exception in case of disaggregated ONTAP storage
226224
*
227-
* @param values
225+
* @param volume
228226
*/
229227
public Volume getStorageVolume(Volume volume)
230228
{
@@ -238,7 +236,7 @@ public Volume getStorageVolume(Volume volume)
238236
* createLun for iSCSI, FC protocols
239237
* createFile for NFS3.0 and NFS4.1 protocols
240238
* createNameSpace for Nvme/TCP and Nvme/FC protocol
241-
* @param values
239+
* @param cloudstackVolume
242240
*/
243241
abstract public CloudStackVolume createCloudStackVolume(CloudStackVolume cloudstackVolume);
244242

@@ -248,7 +246,7 @@ public Volume getStorageVolume(Volume volume)
248246
* updateLun for iSCSI, FC protocols
249247
* updateFile for NFS3.0 and NFS4.1 protocols
250248
* updateNameSpace for Nvme/TCP and Nvme/FC protocol
251-
* @param values
249+
* @param cloudstackVolume
252250
*/
253251
abstract CloudStackVolume updateCloudStackVolume(CloudStackVolume cloudstackVolume);
254252

@@ -258,7 +256,7 @@ public Volume getStorageVolume(Volume volume)
258256
* deleteLun for iSCSI, FC protocols
259257
* deleteFile for NFS3.0 and NFS4.1 protocols
260258
* deleteNameSpace for Nvme/TCP and Nvme/FC protocol
261-
* @param values
259+
* @param cloudstackVolume
262260
*/
263261
abstract void deleteCloudStackVolume(CloudStackVolume cloudstackVolume);
264262

@@ -268,7 +266,7 @@ public Volume getStorageVolume(Volume volume)
268266
* getLun for iSCSI, FC protocols
269267
* getFile for NFS3.0 and NFS4.1 protocols
270268
* getNameSpace for Nvme/TCP and Nvme/FC protocol
271-
* @param values
269+
* @param cloudstackVolume
272270
*/
273271
abstract CloudStackVolume getCloudStackVolume(CloudStackVolume cloudstackVolume);
274272

@@ -277,7 +275,7 @@ public Volume getStorageVolume(Volume volume)
277275
* createiGroup for iSCSI and FC protocols
278276
* createExportPolicy for NFS 3.0 and NFS 4.1 protocols
279277
* createSubsystem for Nvme/TCP and Nvme/FC protocols
280-
* @param values
278+
* @param accessGroup
281279
*/
282280
abstract AccessGroup createAccessGroup(AccessGroup accessGroup);
283281

@@ -286,7 +284,7 @@ public Volume getStorageVolume(Volume volume)
286284
* deleteiGroup for iSCSI and FC protocols
287285
* deleteExportPolicy for NFS 3.0 and NFS 4.1 protocols
288286
* deleteSubsystem for Nvme/TCP and Nvme/FC protocols
289-
* @param values
287+
* @param accessGroup
290288
*/
291289
abstract void deleteAccessGroup(AccessGroup accessGroup);
292290

@@ -295,7 +293,7 @@ public Volume getStorageVolume(Volume volume)
295293
* updateiGroup example add/remove-Iqn for iSCSI and FC protocols
296294
* updateExportPolicy example add/remove-Rule for NFS 3.0 and NFS 4.1 protocols
297295
* //TODO for Nvme/TCP and Nvme/FC protocols
298-
* @param values
296+
* @param accessGroup
299297
*/
300298
abstract AccessGroup updateAccessGroup(AccessGroup accessGroup);
301299

@@ -304,7 +302,7 @@ public Volume getStorageVolume(Volume volume)
304302
* getiGroup for iSCSI and FC protocols
305303
* getExportPolicy for NFS 3.0 and NFS 4.1 protocols
306304
* getNameSpace for Nvme/TCP and Nvme/FC protocols
307-
* @param values
305+
* @param accessGroup
308306
*/
309307
abstract AccessGroup getAccessGroup(AccessGroup accessGroup);
310308

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
public class UnifiedSANStrategy extends SANStrategy {
3939

4040
private static final Logger s_logger = LogManager.getLogger(UnifiedSANStrategy.class);
41-
@Inject private Utility utils;
4241
@Inject private SANFeignClient sanFeignClient;
4342
public UnifiedSANStrategy(OntapStorage ontapStorage) {
4443
super(ontapStorage);
@@ -53,9 +52,9 @@ public CloudStackVolume createCloudStackVolume(CloudStackVolume cloudstackVolume
5352
}
5453
try {
5554
// Get AuthHeader
56-
String authHeader = utils.generateAuthHeader(storage.getUsername(), storage.getPassword());
55+
String authHeader = Utility.generateAuthHeader(storage.getUsername(), storage.getPassword());
5756
// Create URI for lun creation
58-
URI url = utils.generateURI(Constants.CREATE_LUN);
57+
URI url = Utility.generateURI(Constants.CREATE_LUN);
5958
//TODO: It is possible that Lun creation will take time and we may need to handle through async job.
6059
OntapResponse<Lun> createdLun = sanFeignClient.createLun(url, authHeader, true, cloudstackVolume.getLun());
6160
if (createdLun == null || createdLun.getRecords() == null || createdLun.getRecords().size() == 0) {

0 commit comments

Comments
 (0)