Revert "Changed ConnectOnDemand order"

This reverts commit 05db34bf44.
This commit is contained in:
Suresh Kumar Anaparti 2024-09-05 12:42:05 +05:30
parent 05db34bf44
commit 9f072f2f1c
No known key found for this signature in database
GPG Key ID: D7CEAE3A9E71D0AA
1 changed files with 7 additions and 8 deletions

View File

@ -104,6 +104,10 @@ public class ScaleIOSDCManagerImpl implements ScaleIOSDCManager, Configurable {
@Override
public String prepareSDC(Host host, DataStore dataStore) {
if (Boolean.FALSE.equals(ConnectOnDemand.valueIn(host.getDataCenterId()))) {
return getConnectedSdc(host, dataStore);
}
String systemId = storagePoolDetailsDao.findDetail(dataStore.getId(), ScaleIOGatewayClient.STORAGE_POOL_SYSTEM_ID).getValue();
if (systemId == null) {
throw new CloudRuntimeException("Unable to prepare SDC, failed to get the system id for PowerFlex storage pool: " + dataStore.getName());
@ -131,10 +135,6 @@ public class ScaleIOSDCManagerImpl implements ScaleIOSDCManager, Configurable {
LOGGER.debug(String.format("SDC %s already connected for the pool: %d on host: %d, no need to prepare/start it", sdcId, poolId, hostId));
return sdcId;
}
if (Boolean.FALSE.equals(ConnectOnDemand.valueIn(host.getDataCenterId()))) {
LOGGER.debug("On-demand connect/disconnect disabled, no need to prepare it");
return getConnectedSdc(host, dataStore);
}
String storageSystemIdLockString = String.format(POWERFLEX_SDC_SYSTEMID_LOCK_FORMAT, systemId);
storageSystemIdLock = GlobalLock.getInternLock(storageSystemIdLockString);
@ -241,6 +241,9 @@ public class ScaleIOSDCManagerImpl implements ScaleIOSDCManager, Configurable {
@Override
public boolean stopSDC(Host host, DataStore dataStore) {
if(Boolean.FALSE.equals(ConnectOnDemand.valueIn(host.getDataCenterId()))) {
return true;
}
String systemId = storagePoolDetailsDao.findDetail(dataStore.getId(), ScaleIOGatewayClient.STORAGE_POOL_SYSTEM_ID).getValue();
if (systemId == null) {
throw new CloudRuntimeException("Unable to unprepare SDC, failed to get the system id for PowerFlex storage pool: " + dataStore.getName());
@ -265,10 +268,6 @@ public class ScaleIOSDCManagerImpl implements ScaleIOSDCManager, Configurable {
LOGGER.debug("SDC not connected, no need to unprepare it");
return true;
}
if (Boolean.FALSE.equals(ConnectOnDemand.valueIn(host.getDataCenterId()))) {
LOGGER.debug("On-demand connect/disconnect disabled, no need to unprepare it");
return true;
}
return unprepareSDCOnHost(host, dataStore);
} finally {