Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ public boolean connect() {
throw new CloudRuntimeException("No aggregates are assigned to SVM " + svmName);
}
// Set the aggregates which are according to the storage requirements
int maxAvailableAggregateSpace = storage.getSize().intValue();
Aggregate aggrChosen = null;
for (Aggregate aggr : aggrs) {
s_logger.debug("Found aggregate: " + aggr.getName() + " with UUID: " + aggr.getUuid());
Aggregate aggrResp = aggregateFeignClient.getAggregateByUUID(authHeader, aggr.getUuid());
Expand All @@ -142,13 +144,18 @@ public boolean connect() {
s_logger.warn("Aggregate " + aggr.getName() + " does not have sufficient available space. Skipping this aggregate.");
continue;
}
s_logger.info("Selected aggregate: " + aggr.getName() + " for volume operations.");
this.aggregates = List.of(aggr);
if (aggrResp.getAvailableBlockStorageSpace() >= maxAvailableAggregateSpace) {
maxAvailableAggregateSpace = aggrResp.getAvailableBlockStorageSpace().intValue();
aggrChosen = aggr;
}
}

this.aggregates = List.of(aggrChosen);
if (this.aggregates == null || this.aggregates.isEmpty()) {
s_logger.error("No suitable aggregates found on SVM " + svmName + " for volume creation.");
throw new CloudRuntimeException("No suitable aggregates found on SVM " + svmName + " for volume creation.");
}
s_logger.info("Selected aggregate: " + aggrChosen.getName() + " for volume operations.");
s_logger.info("Successfully connected to ONTAP cluster and validated ONTAP details provided");
} catch (Exception e) {
throw new CloudRuntimeException("Failed to connect to ONTAP cluster: " + e.getMessage(), e);
Expand Down
Loading