Skip to content

Commit 98d448d

Browse files
Gupta, SuryaGupta, Surya
authored andcommitted
[CSTACKEX-129] NFS3 Primary storage-pool is not failing even if NFS3 protocol is not enabled at the storage VM
1 parent 7108ef8 commit 98d448d

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,33 +109,31 @@ public boolean connect() {
109109
logger.info("Fetching the SVM details...");
110110
Map<String, Object> queryParams = Map.of(OntapStorageConstants.NAME, svmName, OntapStorageConstants.FIELDS, OntapStorageConstants.AGGREGATES +
111111
OntapStorageConstants.COMMA + OntapStorageConstants.STATE +
112-
OntapStorageConstants.COMMA + OntapStorageConstants.NFS + OntapStorageConstants.COMMA + OntapStorageConstants.ISCSI);
112+
OntapStorageConstants.COMMA + OntapStorageConstants.NFS_ENABLED + OntapStorageConstants.COMMA + OntapStorageConstants.ISCSI_ENABLED);
113113
OntapResponse<Svm> svms = svmFeignClient.getSvmResponse(queryParams, authHeader);
114114
if (svms != null && svms.getRecords() != null && !svms.getRecords().isEmpty()) {
115115
svm = svms.getRecords().get(0);
116116
} else {
117-
logger.error("No SVM found on the ONTAP cluster by the name" + svmName + ".");
118-
return false;
117+
logger.error("No SVM found on the ONTAP cluster by the name" + svmName);
118+
throw new CloudRuntimeException("No SVM found on the ONTAP cluster by the name " + svmName);
119119
}
120120

121121
logger.info("Validating SVM state and protocol settings...");
122-
logger.info("Protocol storage.getProtocol() = " + storage.getProtocol() + " Objects.equals(storage.getProtocol(), ProtocolType.ISCSI) " + Objects.equals(storage.getProtocol(), ProtocolType.ISCSI));
123-
logger.info("svm.getIscsiEnabled() : " + svm.getIscsiEnabled() + "svm.getNfsEnabled() : " + svm.getNfsEnabled());
124122
if (!Objects.equals(svm.getState(), OntapStorageConstants.RUNNING)) {
125-
logger.error("SVM " + svmName + " is not in running state.");
126-
return false;
123+
logger.error("SVM " + svmName + " is not in running state");
124+
throw new CloudRuntimeException("SVM " + svmName + " is not in running state");
127125
}
128126
if (Objects.equals(storage.getProtocol(), ProtocolType.NFS3) && !svm.getNfsEnabled()) {
129127
logger.error("NFS protocol is not enabled on SVM " + svmName);
130-
return false;
128+
throw new CloudRuntimeException("NFS protocol is not enabled on SVM " + svmName);
131129
} else if (Objects.equals(storage.getProtocol(), ProtocolType.ISCSI) && !svm.getIscsiEnabled()) {
132130
logger.error("iSCSI protocol is not enabled on SVM " + svmName);
133-
return false;
131+
throw new CloudRuntimeException("iSCSI protocol is not enabled on SVM " + svmName);
134132
}
135133
List<Aggregate> aggrs = svm.getAggregates();
136134
if (aggrs == null || aggrs.isEmpty()) {
137135
logger.error("No aggregates are assigned to SVM " + svmName);
138-
return false;
136+
throw new CloudRuntimeException("No aggregates are assigned to SVM " + svmName);
139137
}
140138
for (Aggregate aggr : aggrs) {
141139
logger.debug("Found aggregate: " + aggr.getName() + " with UUID: " + aggr.getUuid());

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public class OntapStorageConstants {
3030

3131
public static final String NFS = "nfs";
3232
public static final String ISCSI = "iscsi";
33+
34+
public static final String NFS_ENABLED = "nfs.enabled";
35+
public static final String ISCSI_ENABLED = "iscsi.enabled";
3336
public static final String SIZE = "size";
3437
public static final String PROTOCOL = "protocol";
3538
public static final String SVM_NAME = "svmName";

0 commit comments

Comments
 (0)