Skip to content
Merged
Changes from 1 commit
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();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since size isn’t assigned before connect executes, the process cannot succeed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storage is already assigned but the other comment makes sense, aggregate selection should be in Volume creation code. So, have modified the code accordingly

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s go over the code in the scrum meeting. My review was limited to the merged changes and the code review raised, so I’d appreciate your input on the code as it appears in your IDE.

Aggregate aggrChosen = null;
for (Aggregate aggr : aggrs) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the connect method handle aggregate selection? This logic should ideally reside in the volume creation process.

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