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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to