Skip to content

Commit 71daee2

Browse files
Gupta, SuryaGupta, Surya
authored andcommitted
CSTACKEX-46 Resolve bot review comments
1 parent c4399c1 commit 71daee2

File tree

4 files changed

+13
-23
lines changed

4 files changed

+13
-23
lines changed

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,7 @@ private CloudStackVolume createCloudStackVolumeRequestByProtocol(StoragePoolVO s
166166
String lunFullName = Utility.getLunName(storagePool.getName(), volumeInfo.getName());
167167
lunRequest.setName(lunFullName);
168168

169-
String hypervisorType = storagePool.getHypervisor().name();
170-
String osType = null;
171-
switch (hypervisorType) {
172-
case Constants.KVM:
173-
osType = Lun.OsTypeEnum.LINUX.getValue();
174-
break;
175-
default:
176-
String errMsg = "createCloudStackVolume : Unsupported hypervisor type " + hypervisorType + " for ONTAP storage";
177-
s_logger.error(errMsg);
178-
throw new CloudRuntimeException(errMsg);
179-
}
169+
String osType = Utility.getOSTypeFromHypervisor(storagePool.getHypervisor().name());
180170
lunRequest.setOsType(Lun.OsTypeEnum.valueOf(osType));
181171

182172
cloudStackVolumeRequest.setLun(lunRequest);
@@ -270,7 +260,7 @@ private void grantAccessForVolume(StoragePoolVO storagePool, VolumeVO volumeVO,
270260
AccessGroup accessGroup = getAccessGroupByName(storageStrategy, svmName, accessGroupName);
271261
if(!hostInitiatorFoundInIgroup(host.getStorageUrl(), accessGroup.getIgroup())) {
272262
s_logger.error("grantAccess: initiator [{}] is not present in iGroup [{}]", host.getStorageUrl(), accessGroupName);
273-
throw new CloudRuntimeException("grantAccess: initiator [" + host.getStorageUrl() + "] is not present in iGroup [" + accessGroupName);
263+
throw new CloudRuntimeException("grantAccess: initiator [" + host.getStorageUrl() + "] is not present in iGroup [" + accessGroupName + "]");
274264
}
275265

276266
Map<String, String> enableLogicalAccessMap = new HashMap<>();

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,9 @@ public boolean attachCluster(DataStore dataStore, ClusterScope scope) {
275275
ProtocolType protocol = ProtocolType.valueOf(details.get(Constants.PROTOCOL));
276276
//TODO- Check if we have to handle heterogeneous host within the cluster
277277
if (!validateProtocolSupportAndFetchHostsIdentifier(hostsToConnect, protocol, hostsIdentifier)) {
278-
s_logger.error("attachCluster: Not all hosts in the cluster support the protocol: " + protocol.name());
279-
throw new CloudRuntimeException("attachCluster: Not all hosts in the cluster support the protocol: " + protocol.name());
278+
String errMsg = "attachCluster: Not all hosts in the cluster support the protocol: " + protocol.name();
279+
s_logger.error(errMsg);
280+
throw new CloudRuntimeException(errMsg);
280281
}
281282
//TODO - check if no host to connect then also need to create access group without initiators
282283
if (hostsIdentifier != null && hostsIdentifier.size() > 0) {
@@ -329,8 +330,9 @@ public boolean attachZone(DataStore dataStore, ZoneScope scope, Hypervisor.Hyper
329330
ProtocolType protocol = ProtocolType.valueOf(details.get(Constants.PROTOCOL));
330331
//TODO- Check if we have to handle heterogeneous host within the zone
331332
if (!validateProtocolSupportAndFetchHostsIdentifier(hostsToConnect, protocol, hostsIdentifier)) {
332-
s_logger.error("attachZone: Not all hosts in the zone support the protocol: " + protocol.name());
333-
throw new CloudRuntimeException("attachZone: Not all hosts in the zone support the protocol: " + protocol.name());
333+
String errMsg = "attachZone: Not all hosts in the zone support the protocol: " + protocol.name();
334+
s_logger.error(errMsg);
335+
throw new CloudRuntimeException(errMsg);
334336
}
335337
if (hostsIdentifier != null && !hostsIdentifier.isEmpty()) {
336338
AccessGroup accessGroupRequest = createAccessGroupRequestByProtocol(storagePool, scope.getScopeId(), details, hostsIdentifier);

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,10 @@ public Volume getStorageVolume(Volume volume)
310310

311311
/**
312312
* Method encapsulates the behavior based on the opted protocol in subclasses
313-
@@ -306,22 +306,22 @@ public AccessGroup getAccessGroup(Map<String, String> values)
314-
* getNameSpace for Nvme/TCP and Nvme/FC protocols
315-
* @param values
313+
* getIGroup example getIgroup for iSCSI and FC protocols
314+
* getExportPolicy example getExportPolicy for NFS 3.0 and NFS 4.1 protocols
315+
* //TODO for Nvme/TCP and Nvme/FC protocols
316+
* @param values map to get access group values like name, svm name etc.
316317
*/
317318
abstract public AccessGroup getAccessGroup(Map<String, String> values);
318319

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,6 @@ public AccessGroup getAccessGroup(Map<String, String> values) {
197197
throw new CloudRuntimeException("Failed to fetch Igroup");
198198
}
199199
Igroup igroup = igroupResponse.getRecords().get(0);
200-
s_logger.debug("getAccessGroup: Igroup Details : {}", igroup);
201-
s_logger.info("getAccessGroup: Fetched the Igroup successfully. IgroupName: {}", igroup.getName());
202-
203200
AccessGroup accessGroup = new AccessGroup();
204201
accessGroup.setIgroup(igroup);
205202
return accessGroup;
@@ -226,7 +223,7 @@ public void enableLogicalAccess(Map<String, String> values) {
226223
OntapResponse<LunMap> createdLunMap = sanFeignClient.createLunMap(authHeader, true, lunMapRequest);
227224
if (createdLunMap == null || createdLunMap.getRecords() == null || createdLunMap.getRecords().size() == 0) {
228225
s_logger.error("enableLogicalAccess: LunMap failed for Lun: {} and igroup: {}", lunName, igroupName);
229-
throw new CloudRuntimeException("Failed to perform LunMap for Lun: " +lunName+ " and igroup: " + igroupName);
226+
throw new CloudRuntimeException("Failed to perform LunMap for Lun: " + lunName + " and igroup: " + igroupName);
230227
}
231228
LunMap lunMap = createdLunMap.getRecords().get(0);
232229
s_logger.debug("enableLogicalAccess: LunMap created successfully, LunMap: {}", lunMap);

0 commit comments

Comments
 (0)