if (capacity.getTotalCapacity() != 0) {
capacity.setUsedPercentage(capacity.getUsedCapacity() / capacity.getTotalCapacity());
} else {
capacity.setUsedPercentage(0);
}
SummedCapacity summedCapacity = new SummedCapacity(capacity.getUsedCapacity(), capacity.getTotalCapacity(),
capacity.getUsedPercentage(), capacity.getCapacityType(), capacity.getDataCenterId(), capacity.getPodId(),
capacity.getClusterId());
list.add(summedCapacity);
} else {
List<DataCenterVO> dcList = _dcDao.listEnabledZones();
for (DataCenterVO dc : dcList) {
CapacityVO capacity = _storageMgr.getSecondaryStorageUsedStats(null, dc.getId());
if (capacity.getTotalCapacity() != 0) {
capacity.setUsedPercentage((float) capacity.getUsedCapacity() / capacity.getTotalCapacity());
} else {
capacity.setUsedPercentage(0);
}
SummedCapacity summedCapacity = new SummedCapacity(capacity.getUsedCapacity(), capacity.getTotalCapacity(),
capacity.getUsedPercentage(), capacity.getCapacityType(), capacity.getDataCenterId(), capacity.getPodId(),
capacity.getClusterId());
list.add(summedCapacity);
}// End of for
}