Search in sources :

Example 1 with SecondaryStorageVmAllocator

use of com.cloud.storage.secondary.SecondaryStorageVmAllocator in project cloudstack by apache.

the class SecondaryStorageManagerImpl method assignSecStorageVmFromRunningPool.

public SecondaryStorageVmVO assignSecStorageVmFromRunningPool(long dataCenterId, SecondaryStorageVm.Role role) {
    if (s_logger.isTraceEnabled()) {
        s_logger.trace("Assign  secondary storage vm from running pool for request from data center : " + dataCenterId);
    }
    SecondaryStorageVmAllocator allocator = getCurrentAllocator();
    assert (allocator != null);
    List<SecondaryStorageVmVO> runningList = _secStorageVmDao.getSecStorageVmListInStates(role, dataCenterId, State.Running);
    if (runningList != null && runningList.size() > 0) {
        if (s_logger.isTraceEnabled()) {
            s_logger.trace("Running secondary storage vm pool size : " + runningList.size());
            for (SecondaryStorageVmVO secStorageVm : runningList) {
                s_logger.trace("Running secStorageVm instance : " + secStorageVm.getHostName());
            }
        }
        Map<Long, Integer> loadInfo = new HashMap<Long, Integer>();
        return allocator.allocSecondaryStorageVm(runningList, loadInfo, dataCenterId);
    } else {
        if (s_logger.isTraceEnabled()) {
            s_logger.trace("Empty running secStorageVm pool for now in data center : " + dataCenterId);
        }
    }
    return null;
}
Also used : SecondaryStorageVmVO(com.cloud.vm.SecondaryStorageVmVO) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) SecondaryStorageVmAllocator(com.cloud.storage.secondary.SecondaryStorageVmAllocator)

Aggregations

SecondaryStorageVmAllocator (com.cloud.storage.secondary.SecondaryStorageVmAllocator)1 SecondaryStorageVmVO (com.cloud.vm.SecondaryStorageVmVO)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1