Skip to content

Commit 3c4ec09

Browse files
Locharla, SandeepLocharla, Sandeep
authored andcommitted
Fixed the initial review comments
1 parent b8e5cd6 commit 3c4ec09

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public RequestInterceptor createRequestInterceptor() {
102102
return template -> {
103103
logger.info("Feign Request URL: {}", template.url());
104104
logger.info("HTTP Method: {}", template.method());
105-
logger.info("Headers: {}", template.headers());
105+
logger.trace("Headers: {}", template.headers());
106106
if (template.body() != null) {
107107
logger.info("Body: {}", new String(template.body(), StandardCharsets.UTF_8));
108108
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,11 @@ private boolean validateProtocolSupportAndFetchHostsIdentifier(List<HostVO> host
403403
for (HostVO host : hosts) {
404404
if (host != null) {
405405
ip = host.getStorageIpAddress() != null ? host.getStorageIpAddress().trim() : "";
406-
if (ip.isEmpty() && host.getPrivateIpAddress() != null || host.getPrivateIpAddress().trim().isEmpty()) {
407-
return false;
408-
} else {
409-
ip = ip.isEmpty() ? host.getPrivateIpAddress().trim() : ip;
406+
if (ip.isEmpty()) {
407+
if (host.getPrivateIpAddress() == null || host.getPrivateIpAddress().trim().isEmpty()) {
408+
return false;
409+
}
410+
ip = host.getPrivateIpAddress().trim();
410411
}
411412
}
412413
hostIdentifiers.add(ip);

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/listener/OntapHostListener.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ public boolean hostConnect(long hostId, long poolId) {
8787
"Unable to establish a connection from agent to storage pool %s due to %s", pool, answer.getDetails()));
8888
}
8989

90+
if (!(answer instanceof ModifyStoragePoolAnswer)) {
91+
logger.error("Received unexpected answer type {} for storage pool {}", answer.getClass().getName(), pool.getName());
92+
throw new CloudRuntimeException("Failed to connect to storage pool. Please check agent logs for details.");
93+
}
94+
9095
ModifyStoragePoolAnswer mspAnswer = (ModifyStoragePoolAnswer) answer;
9196
StoragePoolInfo poolInfo = mspAnswer.getPoolInfo();
9297
if (poolInfo == null) {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ public boolean connect() {
134134
return false;
135135
}
136136

137-
this.aggregates = aggrs;
138137
s_logger.info("Successfully connected to ONTAP cluster and validated ONTAP details provided");
139138
} catch (Exception e) {
140139
s_logger.error("Failed to connect to ONTAP cluster: " + e.getMessage(), e);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ public void deleteAccessGroup(AccessGroup accessGroup) {
141141
String svmName = storage.getSvmName();
142142
String exportPolicyName = primaryDataStoreInfo.getDetails().get(Constants.EXPORT_POLICY_NAME);
143143
String exportPolicyId = primaryDataStoreInfo.getDetails().get(Constants.EXPORT_POLICY_ID);
144+
if (exportPolicyId == null || exportPolicyId.isEmpty()) {
145+
s_logger.warn("deleteAccessGroup: Export policy ID not found in storage pool details for storage pool {}. Cannot delete export policy.", primaryDataStoreInfo.getName());
146+
throw new CloudRuntimeException("Export policy ID not found for storage pool: " + primaryDataStoreInfo.getName());
147+
}
144148

145149
try {
146150
nasFeignClient.deleteExportPolicyById(authHeader,exportPolicyId);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.apache.logging.log4j.Logger;
3131
import org.springframework.util.Base64Utils;
3232

33+
import java.nio.charset.StandardCharsets;
3334
import java.util.Map;
3435

3536
public class Utility {
@@ -40,7 +41,7 @@ public class Utility {
4041
private static final String AUTH_HEADER_COLON = ":";
4142

4243
public static String generateAuthHeader (String username, String password) {
43-
byte[] encodedBytes = Base64Utils.encode((username + AUTH_HEADER_COLON + password).getBytes());
44+
byte[] encodedBytes = Base64Utils.encode((username + AUTH_HEADER_COLON + password).getBytes(StandardCharsets.UTF_8));
4445
return BASIC + StringUtils.SPACE + new String(encodedBytes);
4546
}
4647

0 commit comments

Comments
 (0)