Skip to content

Commit dcdcd09

Browse files
Marcus SorensenMarcus Sorensen
andauthored
Randomize managed volume copy host (#5789)
* Randomize managed volume copy host * Managed volume copy was always returning first host that could see storage pools * Fix null value in logging for ScaleIOPrimaryDataStoreDriver due to if/else logic error Signed-off-by: Marcus Sorensen <mls@apple.com> * Use String.format for ScaleIO debug message Signed-off-by: Marcus Sorensen <mls@apple.com> * Update debug message for ScaleIO copy methods Signed-off-by: Marcus Sorensen <mls@apple.com> Co-authored-by: Marcus Sorensen <mls@apple.com>
1 parent 6208976 commit dcdcd09

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ public void copyAsync(DataObject srcData, DataObject destData, Host destHost, As
629629

630630
private Answer copyTemplateToVolume(DataObject srcData, DataObject destData, Host destHost) {
631631
// Copy PowerFlex/ScaleIO template to volume
632-
LOGGER.debug("Initiating copy from PowerFlex template volume on host " + destHost != null ? destHost.getId() : "");
632+
LOGGER.debug(String.format("Initiating copy from PowerFlex template volume on host %s", destHost != null ? destHost.getId() : "<not specified>"));
633633
int primaryStorageDownloadWait = StorageManager.PRIMARY_STORAGE_DOWNLOAD_WAIT.value();
634634
CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), primaryStorageDownloadWait, VirtualMachineManager.ExecuteInSequence.value());
635635

@@ -648,7 +648,7 @@ private Answer copyTemplateToVolume(DataObject srcData, DataObject destData, Hos
648648

649649
private Answer copyVolume(DataObject srcData, DataObject destData, Host destHost) {
650650
// Copy PowerFlex/ScaleIO volume
651-
LOGGER.debug("Initiating copy from PowerFlex volume on host " + destHost != null ? destHost.getId() : "");
651+
LOGGER.debug(String.format("Initiating copy from PowerFlex template volume on host %s", destHost != null ? destHost.getId() : "<not specified>"));
652652
String value = configDao.getValue(Config.CopyVolumeWait.key());
653653
int copyVolumeWait = NumbersUtil.parseInt(value, Integer.parseInt(Config.CopyVolumeWait.getDefaultValue()));
654654

server/src/main/java/com/cloud/storage/StorageManagerImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,7 @@ public Host findUpAndEnabledHostWithAccessToStoragePools(List<Long> poolIds) {
21362136
if (hostIds.isEmpty()) {
21372137
return null;
21382138
}
2139+
Collections.shuffle(hostIds);
21392140

21402141
for (Long hostId : hostIds) {
21412142
Host host = _hostDao.findById(hostId);

0 commit comments

Comments
 (0)