You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "harikrishna-patnala (via GitHub)" <gi...@apache.org> on 2023/03/27 14:11:32 UTC
[GitHub] [cloudstack] harikrishna-patnala commented on a diff in pull request #7372: Fixed avoid set variables which is causing deployment failures
harikrishna-patnala commented on code in PR #7372:
URL: https://github.com/apache/cloudstack/pull/7372#discussion_r1149306404
##########
server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java:
##########
@@ -1576,11 +1576,11 @@ protected Pair<Map<Volume, List<StoragePool>>, List<Volume>> findSuitablePoolsFo
// for each volume find list of suitable storage pools by calling the
// allocators
- Set<Long> originalAvoidPoolSet = avoid.getPoolsToAvoid();
- if (originalAvoidPoolSet == null) {
- originalAvoidPoolSet = new HashSet<Long>();
+ Set<Long> originalAvoidPoolSet = new HashSet<>();
+ if (avoid.getPoolsToAvoid() != null) {
+ originalAvoidPoolSet.addAll(avoid.getPoolsToAvoid());
}
- Set<Long> poolsToAvoidOutput = new HashSet<Long>(originalAvoidPoolSet);
+ Set<Long> poolsToAvoidOutput = new HashSet<>(originalAvoidPoolSet);
Review Comment:
Logic is already down there @DaanHoogland.
https://github.com/apache/cloudstack/blob/4c60621458a3f9680d14bfb5eda001e99c2d7221/server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java#L1685-L1715
It is just that originalAvoidPoolSet was not maintained properly because of "Set<Long> originalAvoidPoolSet = avoid.getPoolsToAvoid();". Later in the planner whenever avoid.getPoolsToAvoid() is getting updated, originalAvoidPoolSet is also getting updated.
For example with 2 volumes, during the loop for each volume, for 1st volume avoid.getPoolsToAvoid() adds p3, p4 and also in originalAvoidPoolSet. For the 2nd volume p3, p4 should not be in avoid set, but since originalAvoidPoolSet also got updated planner is avoiding p3, p4.
Yes, this is working during my testing. I've verified with the debugger too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org