sureshanaparti commented on code in PR #6367:
URL: https://github.com/apache/cloudstack/pull/6367#discussion_r901321812
##########
plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/provider/ScaleIOHostListener.java:
##########
@@ -69,7 +73,41 @@ public boolean hostConnect(long hostId, long poolId) {
return false;
}
- if (!isHostSdcConnected(host.getPrivateIpAddress(), poolId)) {
+ StoragePool storagePool =
(StoragePool)_dataStoreMgr.getDataStore(poolId, DataStoreRole.Primary);
+
+ String systemId = _storagePoolDetailsDao.findDetail(poolId,
ScaleIOGatewayClient.STORAGE_POOL_SYSTEM_ID).getValue();
+ if (systemId == null) {
+ throw new CloudRuntimeException("Failed to get the system id for
PowerFlex storage pool " + storagePool.getName());
+ }
+ Map<String,String> details = new HashMap<>();
+ details.put(ScaleIOGatewayClient.STORAGE_POOL_SYSTEM_ID, systemId);
+
+ ModifyStoragePoolCommand cmd = new ModifyStoragePoolCommand(true,
storagePool, storagePool.getPath(), details);
+ ModifyStoragePoolAnswer answer = sendModifyStoragePoolCommand(cmd,
storagePool, hostId);
+ Map<String,String> poolDetails = answer.getPoolInfo().getDetails();
+ if (MapUtils.isEmpty(poolDetails)) {
+ String msg = "SDC details not found on the host: " + hostId + ",
(re)install SDC and restart agent";
+ s_logger.warn(msg);
+ _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST,
host.getDataCenterId(), host.getPodId(), "SDC not found on host: " +
host.getUuid(), msg);
+ return false;
+ }
+
+ String sdcId = null;
+ if (poolDetails.containsKey(ScaleIOGatewayClient.SDC_ID)) {
+ sdcId = poolDetails.get(ScaleIOGatewayClient.SDC_ID);
+ } else if (poolDetails.containsKey(ScaleIOGatewayClient.SDC_GUID)) {
+ String sdcGuid = poolDetails.get(ScaleIOGatewayClient.SDC_GUID);
+ sdcId = getHostSdcId(sdcGuid, poolId);
+ }
+
+ if (StringUtils.isBlank(sdcId)) {
+ String msg = "Couldn't retrieve SDC details from the host: " +
hostId + ", (re)install SDC and restart agent";
+ s_logger.warn(msg);
+ _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST,
host.getDataCenterId(), host.getPodId(), "SDC details not found on host: " +
host.getUuid(), msg);
+ return false;
+ }
+
+ if (!isHostSdcConnected(sdcId, poolId)) {
Review Comment:
will do this refactoring in another PR if needed. thanks.
--
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]