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;
}
Aggregations