Skip to content

Commit adcab71

Browse files
Gupta, SuryaGupta, Surya
authored andcommitted
CSTACKEX-98 Made those fields as mandatory
1 parent bc32fb5 commit adcab71

File tree

7 files changed

+32
-53
lines changed

7 files changed

+32
-53
lines changed

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,18 @@
2424
public class OntapStorage {
2525
private final String username;
2626
private final String password;
27-
private final String managementLIF;
27+
private final String storageIP;
2828
private final String svmName;
2929
private final Long size;
3030
private final ProtocolType protocolType;
31-
private final Boolean isDisaggregated;
3231

33-
public OntapStorage(String username, String password, String managementLIF, String svmName, Long size, ProtocolType protocolType, Boolean isDisaggregated) {
32+
public OntapStorage(String username, String password, String storageIP, String svmName, Long size, ProtocolType protocolType) {
3433
this.username = username;
3534
this.password = password;
36-
this.managementLIF = managementLIF;
35+
this.storageIP = storageIP;
3736
this.svmName = svmName;
3837
this.size = size;
3938
this.protocolType = protocolType;
40-
this.isDisaggregated = isDisaggregated;
4139
}
4240

4341
public String getUsername() {
@@ -48,8 +46,8 @@ public String getPassword() {
4846
return password;
4947
}
5048

51-
public String getManagementLIF() {
52-
return managementLIF;
49+
public String getStorageIP() {
50+
return storageIP;
5351
}
5452

5553
public String getSvmName() {
@@ -63,8 +61,4 @@ public Long getSize() {
6361
public ProtocolType getProtocol() {
6462
return protocolType;
6563
}
66-
67-
public Boolean getIsDisaggregated() {
68-
return isDisaggregated;
69-
}
7064
}

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

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ public DataStore initialize(Map<String, Object> dsInfos) {
8787
throw new CloudRuntimeException("Datastore info map is null, cannot create primary storage");
8888
}
8989
s_logger.info("initialize::::::::::::::: dsInfos " + dsInfos.toString());
90-
String url = (String) dsInfos.get("url");
9190
Long zoneId = (Long) dsInfos.get("zoneId");
9291
Long podId = (Long) dsInfos.get("podId");
9392
Long clusterId = (Long) dsInfos.get("clusterId");
@@ -157,23 +156,9 @@ public DataStore initialize(Map<String, Object> dsInfos) {
157156
Constants.PASSWORD,
158157
Constants.SVM_NAME,
159158
Constants.PROTOCOL,
160-
Constants.MANAGEMENT_LIF,
161-
Constants.IS_DISAGGREGATED
159+
Constants.STORAGE_IP
162160
);
163161

164-
// Parse key=value pairs from URL into details (skip empty segments)
165-
if (url != null && !url.isEmpty()) {
166-
for (String segment : url.split(Constants.SEMICOLON)) {
167-
if (segment.isEmpty()) {
168-
continue;
169-
}
170-
String[] kv = segment.split(Constants.EQUALS, 2);
171-
if (kv.length == 2) {
172-
details.put(kv[0].trim(), kv[1].trim());
173-
}
174-
}
175-
}
176-
177162
// Validate existing entries (reject unexpected keys, empty values)
178163
for (Map.Entry<String, String> e : details.entrySet()) {
179164
String key = e.getKey();
@@ -196,21 +181,17 @@ public DataStore initialize(Map<String, Object> dsInfos) {
196181

197182
details.put(Constants.SIZE, capacityBytes.toString());
198183

199-
// Default for IS_DISAGGREGATED if needed
200-
details.putIfAbsent(Constants.IS_DISAGGREGATED, "false");
201-
202184
ProtocolType protocol = ProtocolType.valueOf(details.get(Constants.PROTOCOL));
203185

204186
// Connect to ONTAP and create volume
205187
long volumeSize = Long.parseLong(details.get(Constants.SIZE));
206188
OntapStorage ontapStorage = new OntapStorage(
207189
details.get(Constants.USERNAME),
208190
details.get(Constants.PASSWORD),
209-
details.get(Constants.MANAGEMENT_LIF),
191+
details.get(Constants.STORAGE_IP),
210192
details.get(Constants.SVM_NAME),
211193
volumeSize,
212-
protocol,
213-
Boolean.parseBoolean(details.get(Constants.IS_DISAGGREGATED).toLowerCase()));
194+
protocol);
214195

215196
StorageStrategy storageStrategy = StorageProviderFactory.getStrategy(ontapStorage);
216197
boolean isValid = storageStrategy.connect();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public abstract class StorageStrategy {
7979

8080
public StorageStrategy(OntapStorage ontapStorage) {
8181
storage = ontapStorage;
82-
String baseURL = Constants.HTTPS + storage.getManagementLIF();
82+
String baseURL = Constants.HTTPS + storage.getStorageIP();
8383
s_logger.info("Initializing StorageStrategy with base URL: " + baseURL);
8484
// Initialize FeignClientFactory and create clients
8585
this.feignClientFactory = new FeignClientFactory();
@@ -93,7 +93,7 @@ public StorageStrategy(OntapStorage ontapStorage) {
9393

9494
// Connect method to validate ONTAP cluster, credentials, protocol, and SVM
9595
public boolean connect() {
96-
s_logger.info("Attempting to connect to ONTAP cluster at " + storage.getManagementLIF() + " and validate SVM " +
96+
s_logger.info("Attempting to connect to ONTAP cluster at " + storage.getStorageIP() + " and validate SVM " +
9797
storage.getSvmName() + ", protocol " + storage.getProtocol());
9898
//Get AuthHeader
9999
String authHeader = Utility.generateAuthHeader(storage.getUsername(), storage.getPassword());

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class Constants {
3030
public static final String USERNAME = "username";
3131
public static final String PASSWORD = "password";
3232
public static final String DATA_LIF = "dataLIF";
33-
public static final String MANAGEMENT_LIF = "managementLIF";
33+
public static final String STORAGE_IP = "storage_ip";
3434
public static final String VOLUME_NAME = "volumeName";
3535
public static final String VOLUME_UUID = "volumeUUID";
3636
public static final String EXPORT_POLICY_ID = "exportPolicyId";

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,8 @@ public static StorageStrategy getStrategyByStoragePoolDetails(Map<String, String
121121
}
122122
String protocol = details.get(Constants.PROTOCOL);
123123
OntapStorage ontapStorage = new OntapStorage(details.get(Constants.USERNAME), details.get(Constants.PASSWORD),
124-
details.get(Constants.MANAGEMENT_LIF), details.get(Constants.SVM_NAME), Long.parseLong(details.get(Constants.SIZE)),
125-
ProtocolType.valueOf(protocol),
126-
Boolean.parseBoolean(details.get(Constants.IS_DISAGGREGATED)));
124+
details.get(Constants.STORAGE_IP), details.get(Constants.SVM_NAME), Long.parseLong(details.get(Constants.SIZE)),
125+
ProtocolType.valueOf(protocol));
127126
StorageStrategy storageStrategy = StorageProviderFactory.getStrategy(ontapStorage);
128127
boolean isValid = storageStrategy.connect();
129128
if (isValid) {

ui/public/locales/en.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4067,9 +4067,10 @@
40674067
"message.action.unregister.extension.resource": "Please confirm that you want to unregister extension with this resource",
40684068
"message.bgp.peers.null": "Please note, if no BGP peers are selected, the VR will connect to <br> (1) dedicated BGP peers the owner can access, if the owner has dedicated BGP peers and account setting use.system.bgp.peers is set to false; <br> (2) all BGP peers the owner can access, otherwise.<br>",
40694069
"message.bucket.delete": "Please confirm that you want to delete this Bucket",
4070-
"label.ontap.username.tooltip": "The username for the ONTAP storage array",
4071-
"label.ontap.password": "The password for the ONTAP storage array",
4072-
"label.ontap.ip.tooltip": "ONTAP storage array IP",
4070+
"label.ontap.username.tooltip": "The username for the NetApp ONTAP storage array",
4071+
"label.ontap.password.tooltip": "The password for the NetApp ONTAP storage array",
4072+
"label.ontap.ip.tooltip": "NetApp ONTAP storage array IP",
4073+
"label.ontap.svm.name.tooltip": "NetApp SVM Name",
40734074
"label.ontap.ip": "Storage Array IP",
40744075
"label.ontap.svm.name": "SVM Name",
40754076
"migrate.from": "Migrate from",

ui/src/views/infra/AddPrimaryStorage.vue

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,15 @@
285285
</a-form-item>
286286
<a-form-item name="ontapPassword" ref="ontapPassword">
287287
<template #label>
288-
<tooltip-label :title="$t('label.password')" :tooltip="$t('label.ontap.password')"/>
288+
<tooltip-label :title="$t('label.password')" :tooltip="$t('label.ontap.password.tooltip')"/>
289289
</template>
290-
<a-input-password v-model:value="form.ontapPassword" :placeholder="$t('label.ontap.password')"/>
290+
<a-input-password v-model:value="form.ontapPassword" :placeholder="$t('label.ontap.password.tooltip')"/>
291291
</a-form-item>
292292
<a-form-item name="ontapSvmName" ref="ontapSvmName">
293293
<template #label>
294-
<tooltip-label :title="$t('label.ontap.svm.name')" :tooltip="$t('label.ontap.svm.name')"/>
294+
<tooltip-label :title="$t('label.ontap.svm.name')" :tooltip="$t('label.ontap.svm.name.tooltip')"/>
295295
</template>
296-
<a-input v-model:value="form.ontapSvmName" :placeholder="$t('label.ontap.svm.name')"/>
296+
<a-input v-model:value="form.ontapSvmName" :placeholder="$t('label.ontap.svm.name.tooltip')"/>
297297
</a-form-item>
298298
<a-form-item name="capacityBytes" ref="capacityBytes">
299299
<template #label>
@@ -548,7 +548,11 @@ export default {
548548
primeraPassword: [{ required: true, message: this.$t('label.password') }],
549549
flashArrayURL: [{ required: true, message: this.$t('label.url') }],
550550
flashArrayUsername: [{ required: true, message: this.$t('label.username') }],
551-
flashArrayPassword: [{ required: true, message: this.$t('label.password') }]
551+
flashArrayPassword: [{ required: true, message: this.$t('label.password') }],
552+
ontapIP: [{ required: true, message: this.$t('label.required') }],
553+
ontapUsername: [{ required: true, message: this.$t('label.required') }],
554+
ontapPassword: [{ required: true, message: this.$t('label.required') }],
555+
ontapSvmName: [{ required: true, message: this.$t('label.required') }],
552556
})
553557
},
554558
fetchData () {
@@ -807,7 +811,7 @@ export default {
807811
this.protocols = ['FiberChannel']
808812
this.form.protocol = 'FiberChannel'
809813
} else if (value === 'ONTAP') {
810-
this.protocols = ['NFS3', 'iSCSI']
814+
this.protocols = ['NFS3', 'ISCSI']
811815
this.form.protocol = 'NFS3'
812816
} else {
813817
this.fetchHypervisor(value)
@@ -932,11 +936,11 @@ export default {
932936
params['details[0].api_password'] = values.flashArrayPassword
933937
url = values.flashArrayURL
934938
} else if (values.provider === 'ONTAP') {
935-
params['details[0].ontap_ip'] = values.ontapIP
936-
params['details[0].ontap_username'] = values.ontapUsername
937-
params['details[0].ontap_password'] = values.ontapPassword
938-
params['details[0].ontap_svmName'] = values.ontapSvmName
939-
params['details[0].ontap_protocol'] = values.protocol
939+
params['details[0].storage_ip'] = values.ontapIP
940+
params['details[0].username'] = values.ontapUsername
941+
params['details[0].password'] = values.ontapPassword
942+
params['details[0].svmName'] = values.ontapSvmName
943+
params['details[0].protocol'] = values.protocol
940944
values.managed = true
941945
url = this.ontapURL(values.ontapIP)
942946
}

0 commit comments

Comments
 (0)