weizhouapache commented on PR #6307: URL: https://github.com/apache/cloudstack/pull/6307#issuecomment-1106811822
@DaanHoogland from what I understand, the issue can be fixed by https://github.com/apache/cloudstack/pull/6307/commits/65d557ed62a2520d376ce8410e247257d331dcd6 in another word, by following change, right ? ``` diff --git a/engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java b/engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java index 41a8325558..237d016e97 100644 --- a/engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java +++ b/engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.storage.allocator; import java.math.BigDecimal; +import java.security.SecureRandom; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -74,6 +75,11 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement @Inject private StorageUtil storageUtil; @Inject private StoragePoolDetailsDao storagePoolDetailsDao; + /** + * make sure shuffled lists of Pools are really shuffled + */ + private SecureRandom secureRandom = new SecureRandom(); + @Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { super.configure(name, params); @@ -179,7 +185,7 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement if (allocationAlgorithm.equals("random") || allocationAlgorithm.equals("userconcentratedpod_random") || (account == null)) { // Shuffle this so that we don't check the pools in the same order. - Collections.shuffle(pools); + Collections.shuffle(pools, secureRandom); } else if (allocationAlgorithm.equals("userdispersing")) { pools = reorderPoolsByNumberOfVolumes(plan, pools, account); } else if(allocationAlgorithm.equals("firstfitleastconsumed")){ ``` -- 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]
