Skip to content

Commit e11dc24

Browse files
Gupta, SuryaGupta, Surya
authored andcommitted
CSTACKEX-117 Decode the password
1 parent 47b7ac6 commit e11dc24

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,14 @@ public Long getSize() {
5757
public ProtocolType getProtocol() {
5858
return protocolType;
5959
}
60+
61+
@Override
62+
public String toString() {
63+
return "OntapStorage{" +
64+
"username='" + username + '\'' +
65+
", storageIP='" + storageIP + '\'' +
66+
", svmName='" + svmName + '\'' +
67+
", protocol=" + protocolType +
68+
'}';
69+
}
6070
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ public DataStore initialize(Map<String, Object> dsInfos) {
183183
details.put(Constants.SIZE, capacityBytes.toString());
184184

185185
ProtocolType protocol = ProtocolType.valueOf(details.get(Constants.PROTOCOL));
186-
186+
187+
s_logger.info("password::::::: " + details.get(Constants.PASSWORD));
187188
// Connect to ONTAP and create volume
188189
long volumeSize = Long.parseLong(details.get(Constants.SIZE));
189190
OntapStorage ontapStorage = new OntapStorage(

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/provider/StorageProviderFactory.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
import com.cloud.utils.component.ComponentContext;
2323
import com.cloud.utils.exception.CloudRuntimeException;
24+
25+
import java.nio.charset.StandardCharsets;
26+
2427
import org.apache.cloudstack.storage.feign.model.OntapStorage;
2528
import org.apache.cloudstack.storage.service.StorageStrategy;
2629
import org.apache.cloudstack.storage.service.UnifiedNASStrategy;
@@ -34,8 +37,20 @@ public class StorageProviderFactory {
3437
private static final Logger s_logger = LogManager.getLogger(StorageProviderFactory.class);
3538

3639
public static StorageStrategy getStrategy(OntapStorage ontapStorage) {
40+
s_logger.info("Initializing ontapStorage:::::::::::: " + ontapStorage.toString());
3741
ProtocolType protocol = ontapStorage.getProtocol();
3842
s_logger.info("Initializing StorageProviderFactory with protocol: " + protocol);
43+
String decodedPassword = new String(java.util.Base64.getDecoder().decode(ontapStorage.getPassword()), StandardCharsets.UTF_8);
44+
s_logger.info("Initializing StorageProviderFactory with decoded password: " + decodedPassword);
45+
ontapStorage = new OntapStorage(
46+
ontapStorage.getUsername(),
47+
decodedPassword,
48+
ontapStorage.getStorageIP(),
49+
ontapStorage.getSvmName(),
50+
ontapStorage.getSize(),
51+
protocol);
52+
s_logger.info("Initializing ontapStorage1:::::::::::: " + ontapStorage.toString());
53+
3954
switch (protocol) {
4055
case NFS3:
4156
UnifiedNASStrategy unifiedNASStrategy = new UnifiedNASStrategy(ontapStorage);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ public boolean connect() {
9696
s_logger.info("Attempting to connect to ONTAP cluster at " + storage.getStorageIP() + " and validate SVM " +
9797
storage.getSvmName() + ", protocol " + storage.getProtocol());
9898
//Get AuthHeader
99-
String decodedPassword = new String(java.util.Base64.getDecoder().decode(storage.getPassword()), java.nio.charset.StandardCharsets.UTF_8);
100-
String authHeader = Utility.generateAuthHeader(storage.getUsername(), decodedPassword);
99+
String authHeader = Utility.generateAuthHeader(storage.getUsername(), storage.getPassword());
101100
String svmName = storage.getSvmName();
102101
try {
103102
// Call the SVM API to check if the SVM exists

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public UnifiedNASStrategy(OntapStorage ontapStorage) {
7575
String baseURL = Constants.HTTPS + ontapStorage.getStorageIP();
7676
this.feignClientFactory = new FeignClientFactory();
7777
this.nasFeignClient = feignClientFactory.createClient(NASFeignClient.class, baseURL);
78-
this.volumeFeignClient = feignClientFactory.createClient(VolumeFeignClient.class,baseURL );
78+
this.volumeFeignClient = feignClientFactory.createClient(VolumeFeignClient.class, baseURL);
7979
this.jobFeignClient = feignClientFactory.createClient(JobFeignClient.class, baseURL );
8080
}
8181

0 commit comments

Comments
 (0)