test_class.declarator: storageManager
test_class.modifier: private
test_class.original_string: private StorageManagerImpl storageManager;
test_class.type: StorageManagerImpl
test_class.var_name: storageManager
test_class.declarator: poolDao
test_class.modifier: private
test_class.original_string: private PrimaryDataStoreDao poolDao;
test_class.type: PrimaryDataStoreDao
test_class.var_name: poolDao
test_class.declarator: storagePoolMonitor
test_class.modifier: private
test_class.original_string: private StoragePoolMonitor storagePoolMonitor;
test_class.type: StoragePoolMonitor
test_class.var_name: storagePoolMonitor
test_class.declarator: host
test_class.modifier: private
test_class.original_string: private HostVO host;
test_class.type: HostVO
test_class.var_name: host
test_class.declarator: pool
test_class.modifier: private
test_class.original_string: private StoragePoolVO pool;
test_class.type: StoragePoolVO
test_class.var_name: pool
test_class.declarator: cmds
test_class.modifier: private
test_class.original_string: private StartupRoutingCommand[] cmds;
test_class.type: StartupRoutingCommand[]
test_class.var_name: cmds
test_class.file: cosmic-core/server/src/test/java/com/cloud/storage/listener/StoragePoolMonitorTest.java
test_class.identifier: StoragePoolMonitorTest
test_case.body: @Test
      public void testProcessConnectStoragePoolNormal() throws Exception {
          Mockito.when(poolDao.listBy(Mockito.anyLong(), Mockito.anyLong(), Mockito.anyLong(), Mockito.any(ScopeType.class))).thenReturn(Collections.singletonList(pool));
          Mockito.when(poolDao.findZoneWideStoragePoolsByTags(Mockito.anyLong(), Mockito.any(String[].class))).thenReturn(Collections.<StoragePoolVO>emptyList());
          Mockito.when(poolDao.findZoneWideStoragePoolsByHypervisor(Mockito.anyLong(), Mockito.any(HypervisorType.class))).thenReturn(Collections.<StoragePoolVO>emptyList());
  
          storagePoolMonitor.processConnect(host, cmds, false);
  
          Mockito.verify(storageManager, Mockito.times(1)).connectHostToSharedPool(Mockito.eq(host.getId()), Mockito.eq(pool.getId()));
          Mockito.verify(storageManager, Mockito.times(1)).createCapacityEntry(Mockito.eq(pool.getId()));
      }
test_case.class_method_signature: StoragePoolMonitorTest.testProcessConnectStoragePoolNormal()
test_case.full_signature: @Test public void testProcessConnectStoragePoolNormal()
test_case.identifier: testProcessConnectStoragePoolNormal
test_case.invocations: thenReturn when listBy anyLong anyLong anyLong any singletonList thenReturn when findZoneWideStoragePoolsByTags anyLong any emptyList thenReturn when findZoneWideStoragePoolsByHypervisor anyLong any emptyList processConnect connectHostToSharedPool verify times eq getId eq getId createCapacityEntry verify times eq getId
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testProcessConnectStoragePoolNormal()
focal_class.declarator: s_logger = LoggerFactory.getLogger(StoragePoolMonitor.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger s_logger = LoggerFactory.getLogger(StoragePoolMonitor.class);
focal_class.type: Logger
focal_class.var_name: s_logger
focal_class.declarator: _storageManager
focal_class.modifier: private final
focal_class.original_string: private final StorageManagerImpl _storageManager;
focal_class.type: StorageManagerImpl
focal_class.var_name: _storageManager
focal_class.declarator: _poolDao
focal_class.modifier: private final
focal_class.original_string: private final PrimaryDataStoreDao _poolDao;
focal_class.type: PrimaryDataStoreDao
focal_class.var_name: _poolDao
focal_class.declarator: _ocfs2Mgr
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      OCFS2Manager _ocfs2Mgr;
focal_class.type: OCFS2Manager
focal_class.var_name: _ocfs2Mgr
focal_class.file: cosmic-core/server/src/main/java/com/cloud/storage/listener/StoragePoolMonitor.java
focal_class.identifier: StoragePoolMonitor
focal_class.interfaces: implements Listener
focal_class.class_method_signature: StoragePoolMonitor.StoragePoolMonitor(final StorageManagerImpl mgr, final PrimaryDataStoreDao poolDao)
focal_class.full_signature: public  StoragePoolMonitor(final StorageManagerImpl mgr, final PrimaryDataStoreDao poolDao)
focal_class.identifier: StoragePoolMonitor
focal_class.modifiers: public
focal_class.parameters: (final StorageManagerImpl mgr, final PrimaryDataStoreDao poolDao)
focal_class.signature:  StoragePoolMonitor(final StorageManagerImpl mgr, final PrimaryDataStoreDao poolDao)
focal_class.class_method_signature: StoragePoolMonitor.processAnswers(final long agentId, final long seq, final Answer[] resp)
focal_class.full_signature: @Override public synchronized boolean processAnswers(final long agentId, final long seq, final Answer[] resp)
focal_class.identifier: processAnswers
focal_class.modifiers: @Override public synchronized
focal_class.parameters: (final long agentId, final long seq, final Answer[] resp)
focal_class.return: boolean
focal_class.signature: boolean processAnswers(final long agentId, final long seq, final Answer[] resp)
focal_class.class_method_signature: StoragePoolMonitor.processCommands(final long agentId, final long seq, final Command[] req)
focal_class.full_signature: @Override public boolean processCommands(final long agentId, final long seq, final Command[] req)
focal_class.identifier: processCommands
focal_class.modifiers: @Override public
focal_class.parameters: (final long agentId, final long seq, final Command[] req)
focal_class.return: boolean
focal_class.signature: boolean processCommands(final long agentId, final long seq, final Command[] req)
focal_class.class_method_signature: StoragePoolMonitor.processControlCommand(final long agentId, final AgentControlCommand cmd)
focal_class.full_signature: @Override public AgentControlAnswer processControlCommand(final long agentId, final AgentControlCommand cmd)
focal_class.identifier: processControlCommand
focal_class.modifiers: @Override public
focal_class.parameters: (final long agentId, final AgentControlCommand cmd)
focal_class.return: AgentControlAnswer
focal_class.signature: AgentControlAnswer processControlCommand(final long agentId, final AgentControlCommand cmd)
focal_class.class_method_signature: StoragePoolMonitor.processConnect(final Host host, final StartupCommand[] startupCommands, final boolean forRebalance)
focal_class.full_signature: @Override public void processConnect(final Host host, final StartupCommand[] startupCommands, final boolean forRebalance)
focal_class.identifier: processConnect
focal_class.modifiers: @Override public
focal_class.parameters: (final Host host, final StartupCommand[] startupCommands, final boolean forRebalance)
focal_class.return: void
focal_class.signature: void processConnect(final Host host, final StartupCommand[] startupCommands, final boolean forRebalance)
focal_class.class_method_signature: StoragePoolMonitor.processDisconnect(final long agentId, final HostStatus state)
focal_class.full_signature: @Override public synchronized boolean processDisconnect(final long agentId, final HostStatus state)
focal_class.identifier: processDisconnect
focal_class.modifiers: @Override public synchronized
focal_class.parameters: (final long agentId, final HostStatus state)
focal_class.return: boolean
focal_class.signature: boolean processDisconnect(final long agentId, final HostStatus state)
focal_class.class_method_signature: StoragePoolMonitor.isRecurring()
focal_class.full_signature: @Override public boolean isRecurring()
focal_class.identifier: isRecurring
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isRecurring()
focal_class.class_method_signature: StoragePoolMonitor.getTimeout()
focal_class.full_signature: @Override public int getTimeout()
focal_class.identifier: getTimeout
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getTimeout()
focal_class.class_method_signature: StoragePoolMonitor.processTimeout(final long agentId, final long seq)
focal_class.full_signature: @Override public boolean processTimeout(final long agentId, final long seq)
focal_class.identifier: processTimeout
focal_class.modifiers: @Override public
focal_class.parameters: (final long agentId, final long seq)
focal_class.return: boolean
focal_class.signature: boolean processTimeout(final long agentId, final long seq)
focal_method.body: @Override
      public void processConnect(final Host host, final StartupCommand[] startupCommands, final boolean forRebalance) throws ConnectionException {
          for (final StartupCommand startupCommand : startupCommands) {
              if (startupCommand instanceof StartupRoutingCommand) {
                  final StartupRoutingCommand scCmd = (StartupRoutingCommand) startupCommand;
                  if (scCmd.getHypervisorType() == HypervisorType.XenServer || scCmd.getHypervisorType() == HypervisorType.KVM) {
                      final List<StoragePoolVO> pools = _poolDao.listBy(host.getDataCenterId(), host.getPodId(), host.getClusterId(), ScopeType.CLUSTER);
                      final List<StoragePoolVO> zoneStoragePoolsByTags = _poolDao.findZoneWideStoragePoolsByTags(host.getDataCenterId(), null);
                      final List<StoragePoolVO> zoneStoragePoolsByHypervisor = _poolDao.findZoneWideStoragePoolsByHypervisor(host.getDataCenterId(), scCmd.getHypervisorType());
                      zoneStoragePoolsByTags.retainAll(zoneStoragePoolsByHypervisor);
                      pools.addAll(zoneStoragePoolsByTags);
                      final List<StoragePoolVO> zoneStoragePoolsByAnyHypervisor = _poolDao.findZoneWideStoragePoolsByHypervisor(host.getDataCenterId(), HypervisorType.Any);
                      pools.addAll(zoneStoragePoolsByAnyHypervisor);
  
                      for (final StoragePoolVO pool : pools) {
                          if (pool.getStatus() != StoragePoolStatus.Up) {
                              continue;
                          }
                          if (!pool.isShared()) {
                              continue;
                          }
  
                          if (pool.getPoolType() == StoragePoolType.OCFS2 && !_ocfs2Mgr.prepareNodes(pool.getClusterId())) {
                              throw new ConnectionException(true, "Unable to prepare OCFS2 nodes for pool " + pool.getId());
                          }
  
                          final Long hostId = host.getId();
                          s_logger.debug("Host " + hostId + " connected, connecting host to shared pool id " + pool.getId() + " and sending storage pool information ...");
                          try {
                              _storageManager.connectHostToSharedPool(hostId, pool.getId());
                              _storageManager.createCapacityEntry(pool.getId());
                          } catch (final Exception e) {
                              throw new ConnectionException(true, "Unable to connect host " + hostId + " to storage pool id " + pool.getId() + " due to " + e.toString(), e);
                          }
                      }
                  }
              }
          }
      }
focal_method.class_method_signature: StoragePoolMonitor.processConnect(final Host host, final StartupCommand[] startupCommands, final boolean forRebalance)
focal_method.full_signature: @Override public void processConnect(final Host host, final StartupCommand[] startupCommands, final boolean forRebalance)
focal_method.identifier: processConnect
focal_method.invocations: getHypervisorType getHypervisorType listBy getDataCenterId getPodId getClusterId findZoneWideStoragePoolsByTags getDataCenterId findZoneWideStoragePoolsByHypervisor getDataCenterId getHypervisorType retainAll addAll findZoneWideStoragePoolsByHypervisor getDataCenterId addAll getStatus isShared getPoolType prepareNodes getClusterId getId getId debug getId connectHostToSharedPool getId createCapacityEntry getId getId toString
focal_method.modifiers: @Override public
focal_method.parameters: (final Host host, final StartupCommand[] startupCommands, final boolean forRebalance)
focal_method.return: void
focal_method.signature: void processConnect(final Host host, final StartupCommand[] startupCommands, final boolean forRebalance)