sureshanaparti commented on code in PR #8628:
URL: https://github.com/apache/cloudstack/pull/8628#discussion_r1492290426


##########
plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/provider/ScaleIOHostListener.java:
##########
@@ -70,12 +71,33 @@ public boolean hostAdded(long hostId) {
     public boolean hostConnect(long hostId, long poolId) {
         HostVO host = _hostDao.findById(hostId);
         if (host == null) {
-            logger.error("Failed to add host by HostListener as host was not 
found with id : " + hostId);
+            logger.error("Failed to connect host by ScaleIOHostListener as 
host was not found with id : " + hostId);
             return false;
         }
 
         StoragePool storagePool = 
(StoragePool)_dataStoreMgr.getDataStore(poolId, DataStoreRole.Primary);
+        Pair<String, String> sdcDetails = getConnectedSdcIdOfHost(host, 
storagePool, true);
+        String sdcId = sdcDetails.first();
+        if (sdcId == null) {
+            return false;
+        }
 
+        StoragePoolHostVO storagePoolHost = 
_storagePoolHostDao.findByPoolHost(poolId, hostId);
+        if (storagePoolHost == null) {
+            storagePoolHost = new StoragePoolHostVO(poolId, hostId, sdcId);
+            _storagePoolHostDao.persist(storagePoolHost);
+        } else {
+            storagePoolHost.setLocalPath(sdcId);
+            _storagePoolHostDao.update(storagePoolHost.getId(), 
storagePoolHost);
+        }
+
+        logger.info("Connection established between PowerFlex storage pool: " 
+ storagePool + " and host: " + hostId);
+        return true;
+    }
+
+    private Pair<String, String> getConnectedSdcIdOfHost(HostVO host, 
StoragePool storagePool, boolean alert) {

Review Comment:
   correct, i cleaned up some changes. will update it. 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]

Reply via email to