Skip to content

Commit fe5eca4

Browse files
code improvements
1 parent 5aaf33f commit fe5eca4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/ScaleIOStorageAdaptor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ private Map<String, String> getSDCDetails(Map<String, String> details) {
630630
return sdcDetails;
631631
}
632632

633-
int waitTimeInSecs = 5;
633+
int numberOfTries = 5;
634634
int timeBetweenTries = 1000; // Try more frequently (every sec) and return early when SDC Id or Guid found
635635
do {
636636
String sdcId = ScaleIOUtil.getSdcId(storageSystemId);
@@ -649,8 +649,8 @@ private Map<String, String> getSDCDetails(Map<String, String> details) {
649649
Thread.sleep(timeBetweenTries);
650650
} catch (Exception ignore) {
651651
}
652-
waitTimeInSecs--;
653-
} while (waitTimeInSecs > 0);
652+
numberOfTries--;
653+
} while (numberOfTries > 0);
654654

655655
return sdcDetails;
656656
}

plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/manager/ScaleIOSDCManagerImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ private boolean isHostSdcConnected(String sdcId, long poolId) {
381381

382382
private ScaleIOGatewayClient getScaleIOClient(final Long storagePoolId) throws Exception {
383383
StoragePoolVO storagePool = storagePoolDao.findById(storagePoolId);
384+
if (storagePool == null) {
385+
throw new CloudRuntimeException("Unable to find the storage pool with id " + storagePoolId);
386+
}
384387
return ScaleIOGatewayClientConnectionPool.getInstance().getClient(storagePool, storagePoolDetailsDao);
385388
}
386389

0 commit comments

Comments
 (0)