ravening commented on a change in pull request #5862:
URL: https://github.com/apache/cloudstack/pull/5862#discussion_r836333976



##########
File path: 
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java
##########
@@ -35,121 +35,189 @@
 public class KVMHAMonitor extends KVMHABase implements Runnable {
 
     private static final Logger s_logger = 
Logger.getLogger(KVMHAMonitor.class);
-    private final Map<String, NfsStoragePool> storagePool = new 
ConcurrentHashMap<>();
+    private final Map<String, NfsStoragePool> nfsstoragePool = new 
ConcurrentHashMap<>();
+    private final Map<String, RbdStoragePool> rbdstoragePool = new 
ConcurrentHashMap<>();
+    private final NfsStoragePool nfsStoragePool = null;
+    private final RbdStoragePool rbdStoragePool = null;
     private final boolean rebootHostAndAlertManagementOnHeartbeatTimeout;
 
     private final String hostPrivateIp;
 
-    public KVMHAMonitor(NfsStoragePool pool, String host, String scriptPath) {
+    public KVMHAMonitor(NfsStoragePool pool, RbdStoragePool rbdpool, String 
host, String scriptPath, String scriptPathRbd) {
         if (pool != null) {
-            storagePool.put(pool._poolUUID, pool);
+            nfsstoragePool.put(pool._poolUUID, pool);
+        }else if (rbdpool != null) {
+            rbdstoragePool.put(rbdpool._poolUUID, rbdpool);
         }
+        configureHeartBeatPath(scriptPath, scriptPathRbd);
         hostPrivateIp = host;
-        configureHeartBeatPath(scriptPath);
-
         _heartBeatUpdateTimeout = 
AgentPropertiesFileHandler.getPropertyValue(AgentProperties.HEARTBEAT_UPDATE_TIMEOUT);
         rebootHostAndAlertManagementOnHeartbeatTimeout = 
AgentPropertiesFileHandler.getPropertyValue(AgentProperties.REBOOT_HOST_AND_ALERT_MANAGEMENT_ON_HEARTBEAT_TIMEOUT);
     }
 
-    private static synchronized void configureHeartBeatPath(String scriptPath) 
{
+    private static synchronized void configureHeartBeatPath(String scriptPath, 
String scriptPathRbd) {
         KVMHABase.s_heartBeatPath = scriptPath;
+        KVMHABase.s_heartBeatPathRbd = scriptPathRbd;
     }
 
     public void addStoragePool(NfsStoragePool pool) {
-        synchronized (storagePool) {
-            storagePool.put(pool._poolUUID, pool);
+        synchronized (nfsstoragePool) {

Review comment:
       Since you are already using `ConcurrentHashMap`, I dont see the need of 
synchronized




-- 
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