Skip to content

Commit dac753f

Browse files
Gupta, SuryaLocharla, Sandeep
authored andcommitted
CSTACKEX-46 resolve check style issues
1 parent f067b50 commit dac753f

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ public boolean isValidName(String name) {
145145
return false;
146146
}
147147
// Regex: Starts with a letter, followed by letters, digits, or underscores
148-
String regex = "^[a-zA-Z][a-zA-Z0-9_]*$";
149-
return name.matches(regex);
148+
return name.matches(Constants.ONTAP_NAME_REGEX);
150149
}
151150

152151
private String createCloudStackVolumeForTypeVolume(DataStore dataStore, VolumeInfo volumeObject) {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,4 @@ public int hashCode() {
143143

144144
@JsonInclude(JsonInclude.Include.NON_NULL)
145145
public static class Links { }
146-
147146
}

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/lifecycle/OntapPrimaryDatastoreLifecycle.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ public boolean attachCluster(DataStore dataStore, ClusterScope scope) {
339339
AccessGroup accessGroupRequest = createAccessGroupRequestByProtocol(storagePool, scope.getScopeId(), details, hostsIdentifier);
340340
strategy.createAccessGroup(accessGroupRequest);
341341
} catch (Exception e) {
342-
s_logger.error("attachCluster: Failed to create access group on storage system for cluster: " + primaryStore.getClusterId(), e);
343-
throw new CloudRuntimeException("attachCluster: Failed to create access group on storage system for cluster: " + primaryStore.getClusterId(), e);
342+
s_logger.error("attachCluster: Failed to create access group on storage system for cluster: " + primaryStore.getClusterId() + ". Exception: " + e.getMessage(), e);
343+
throw new CloudRuntimeException("attachCluster: Failed to create access group on storage system for cluster: " + primaryStore.getClusterId() + ". Exception: " + e.getMessage(), e);
344344
}
345345
}
346346
logger.debug("attachCluster: Attaching the pool to each of the host in the cluster: {}", primaryStore.getClusterId());
@@ -406,8 +406,13 @@ public boolean attachZone(DataStore dataStore, ZoneScope scope, Hypervisor.Hyper
406406
throw new CloudRuntimeException(errMsg);
407407
}
408408
if (hostsIdentifier != null && !hostsIdentifier.isEmpty()) {
409-
AccessGroup accessGroupRequest = createAccessGroupRequestByProtocol(storagePool, scope.getScopeId(), details, hostsIdentifier);
410-
strategy.createAccessGroup(accessGroupRequest);
409+
try {
410+
AccessGroup accessGroupRequest = createAccessGroupRequestByProtocol(storagePool, scope.getScopeId(), details, hostsIdentifier);
411+
strategy.createAccessGroup(accessGroupRequest);
412+
} catch (Exception e) {
413+
s_logger.error("attachZone: Failed to create access group on storage system for zone with Exception: " + e.getMessage());
414+
throw new CloudRuntimeException("attachZone: Failed to create access group on storage system for zone with Exception: " + e.getMessage());
415+
}
411416
}
412417
for (HostVO host : hostsToConnect) {
413418
try {

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@
2727
import org.apache.cloudstack.storage.feign.client.SANFeignClient;
2828
import org.apache.cloudstack.storage.feign.model.Igroup;
2929
import org.apache.cloudstack.storage.feign.model.Initiator;
30-
import org.apache.cloudstack.storage.feign.model.Igroup;
31-
import org.apache.cloudstack.storage.feign.model.Lun;
32-
import org.apache.cloudstack.storage.feign.model.LunMap;
33-
import org.apache.cloudstack.storage.feign.model.OntapStorage;
30+
import org.apache.cloudstack.storage.feign.model.*;
3431
import org.apache.cloudstack.storage.feign.model.Svm;
3532
import org.apache.cloudstack.storage.feign.model.response.OntapResponse;
3633
import org.apache.cloudstack.storage.service.model.AccessGroup;
@@ -389,9 +386,17 @@ public void enableLogicalAccess(Map<String, String> values) {
389386
String authHeader = Utility.generateAuthHeader(storage.getUsername(), storage.getPassword());
390387
// Create LunMap
391388
LunMap lunMapRequest = new LunMap();
392-
lunMapRequest.getSvm().setName(svmName);
393-
lunMapRequest.getLun().setName(lunName);
394-
lunMapRequest.getIgroup().setName(igroupName);
389+
Svm svm = new Svm();
390+
svm.setName(svmName);
391+
lunMapRequest.setSvm(svm);
392+
//Set Lun name
393+
Lun lun = new Lun();
394+
lun.setName(lunName);
395+
lunMapRequest.setLun(lun);
396+
//Set Igroup name
397+
Igroup igroup = new Igroup();
398+
igroup.setName(igroupName);
399+
lunMapRequest.setIgroup(igroup);
395400
OntapResponse<LunMap> createdLunMap = sanFeignClient.createLunMap(authHeader, true, lunMapRequest);
396401
if (createdLunMap == null || createdLunMap.getRecords() == null || createdLunMap.getRecords().size() == 0) {
397402
s_logger.error("enableLogicalAccess: LunMap failed for Lun: {} and igroup: {}", lunName, igroupName);

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/utils/Utility.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public static String generateExportPolicyName(String svmName, String volumeName)
146146
}
147147

148148
public static String getLunName(String volName, String lunName) {
149-
//LUN name in ONTAP unified : "/vol/VolumeName/LunName"
149+
//LUN name in ONTAP unified format: "/vol/VolumeName/LunName"
150150
return Constants.VOLUME_PATH_PREFIX + volName + Constants.SLASH + lunName;
151151
}
152152

0 commit comments

Comments
 (0)