Skip to content

Commit 199ac0f

Browse files
Gupta, SuryaGupta, Surya
authored andcommitted
CSTACKEX-35 Removed Type Casting for logger
1 parent cc6af4a commit 199ac0f

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
public class OntapPrimaryDatastoreDriver implements PrimaryDataStoreDriver {
6060

61-
private static final Logger s_logger = (Logger)LogManager.getLogger(OntapPrimaryDatastoreDriver.class);
61+
private static final Logger s_logger = LogManager.getLogger(OntapPrimaryDatastoreDriver.class);
6262

6363
@Inject private Utility utils;
6464
@Inject private StoragePoolDetailsDao storagePoolDetailsDao;
@@ -126,10 +126,6 @@ private String createCloudStackVolumeForTypeVolume(DataStore dataStore, DataObje
126126
throw new CloudRuntimeException("createCloudStackVolume : Storage Pool not found for id: " + dataStore.getId());
127127
}
128128
Map<String, String> details = storagePoolDetailsDao.listDetailsKeyPairs(dataStore.getId());
129-
if(details == null || details.isEmpty()) {
130-
s_logger.error("createCloudStackVolume : Storage Details not found for id: " + dataStore.getId());
131-
throw new CloudRuntimeException("createCloudStackVolume : Storage Details not found for id: " + dataStore.getId());
132-
}
133129
StorageStrategy storageStrategy = utils.getStrategyByStoragePoolDetails(details);
134130
s_logger.info("createCloudStackVolumeForTypeVolume: Connection to Ontap SVM [{}] successful, preparing CloudStackVolumeRequest", details.get(Constants.SVM_NAME));
135131
CloudStackVolume cloudStackVolumeRequest = utils.createCloudStackVolumeRequestByProtocol(storagePool, details, dataObject);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
public class UnifiedSANStrategy extends SANStrategy {
3939

40-
private static final Logger s_logger = (Logger) LogManager.getLogger(UnifiedSANStrategy.class);
40+
private static final Logger s_logger = LogManager.getLogger(UnifiedSANStrategy.class);
4141
@Inject private Utility utils;
4242
@Inject private SANFeignClient sanFeignClient;
4343
public UnifiedSANStrategy(OntapStorage ontapStorage) {
@@ -56,7 +56,7 @@ public CloudStackVolume createCloudStackVolume(CloudStackVolume cloudstackVolume
5656
String authHeader = utils.generateAuthHeader(storage.getUsername(), storage.getPassword());
5757
// Create URI for lun creation
5858
URI url = utils.generateURI(Constants.CREATE_LUN);
59-
//TODO: there is possible that Lun creation will take time and we may need to handle through async job.
59+
//TODO: It is possible that Lun creation will take time and we may need to handle through async job.
6060
OntapResponse<Lun> createdLun = sanFeignClient.createLun(url, authHeader, true, cloudstackVolume.getLun());
6161
if (createdLun == null || createdLun.getRecords() == null || createdLun.getRecords().size() == 0) {
6262
s_logger.error("createCloudStackVolume: LUN creation failed for Lun {}", cloudstackVolume.getLun().getName());

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
@Component
4646
public class Utility {
4747

48-
private static final Logger s_logger = (Logger) LogManager.getLogger(Utility.class);
48+
private static final Logger s_logger = LogManager.getLogger(Utility.class);
4949
@Inject private OntapStorage ontapStorage;
5050
@Inject private PrimaryDataStoreDao storagePoolDao;
5151
@Inject private StoragePoolDetailsDao storagePoolDetailsDao;
@@ -109,6 +109,10 @@ public CloudStackVolume createCloudStackVolumeRequestByProtocol(StoragePoolVO st
109109
}
110110

111111
public StorageStrategy getStrategyByStoragePoolDetails(Map<String, String> details) {
112+
if (details == null || details.isEmpty()) {
113+
s_logger.error("getStrategyByStoragePoolDetails: Storage pool details are null or empty");
114+
throw new CloudRuntimeException("getStrategyByStoragePoolDetails: Storage pool details are null or empty");
115+
}
112116
String protocol = details.get(Constants.PROTOCOL);
113117
OntapStorage ontapStorage = new OntapStorage(details.get(Constants.USERNAME), details.get(Constants.PASSWORD),
114118
details.get(Constants.MANAGEMENT_LIF), details.get(Constants.SVM_NAME), ProtocolType.valueOf(protocol),
@@ -119,8 +123,8 @@ public StorageStrategy getStrategyByStoragePoolDetails(Map<String, String> detai
119123
s_logger.info("Connection to Ontap SVM [{}] successful", details.get(Constants.SVM_NAME));
120124
return storageStrategy;
121125
} else {
122-
s_logger.error("createCloudStackVolumeForTypeVolume: Connection to Ontap SVM [" + details.get(Constants.SVM_NAME) + "] failed");
123-
throw new CloudRuntimeException("createCloudStackVolumeForTypeVolume: Connection to Ontap SVM [" + details.get(Constants.SVM_NAME) + "] failed");
126+
s_logger.error("getStrategyByStoragePoolDetails: Connection to Ontap SVM [" + details.get(Constants.SVM_NAME) + "] failed");
127+
throw new CloudRuntimeException("getStrategyByStoragePoolDetails: Connection to Ontap SVM [" + details.get(Constants.SVM_NAME) + "] failed");
124128
}
125129
}
126130
}

0 commit comments

Comments
 (0)