diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java index fb9a0104c87..6561567da83 100755 --- a/server/src/com/cloud/server/StatsCollector.java +++ b/server/src/com/cloud/server/StatsCollector.java @@ -259,21 +259,26 @@ public class StatsCollector { @Override public void run() { try { - s_logger.debug("StorageCollector is running..."); + if (s_logger.isDebugEnabled()) { + s_logger.debug("StorageCollector is running..."); + } List hosts = _hostDao.listSecondaryStorageHosts(); - ConcurrentHashMap storageStats = new ConcurrentHashMap(); + ConcurrentHashMap storageStats = new ConcurrentHashMap(); + for (HostVO host : hosts) { GetStorageStatsCommand command = new GetStorageStatsCommand(host.getStorageUrl()); - HostVO ssAhost = _agentMgr.getSSAgent(host); - if (ssAhost == null) { - return; - } + HostVO ssAhost = _agentMgr.getSSAgent(host); + if( ssAhost == null ) { + s_logger.warn("There is no secondary storage VM for secondary storage host " + host.getName()); + continue; + } + long hostId = host.getId(); Answer answer = _agentMgr.easySend(ssAhost.getId(), command); if (answer != null && answer.getResult()) { storageStats.put(hostId, (StorageStats)answer); - s_logger.debug("HostId: "+hostId+ " Used: " + ((StorageStats)answer).getByteUsed() + " Total Available: " + ((StorageStats)answer).getCapacityBytes()); + s_logger.trace("HostId: "+hostId+ " Used: " + ((StorageStats)answer).getByteUsed() + " Total Available: " + ((StorageStats)answer).getCapacityBytes()); //Seems like we have dynamically updated the sec. storage as prev. size and the current do not match if (_storageStats.get(hostId)!=null && _storageStats.get(hostId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()){