Пример #1
0
 public static void populateCpuUtilizationVms(Utilization utilization, DataSource dwhDataSource)
     throws DashboardDataException {
   VmDwhDao dao = new VmDwhDao(dwhDataSource);
   List<TrendResources> usageList = dao.getCpuUtilizationVms();
   for (TrendResources usage : usageList) {
     UtilizedEntity entity = new UtilizedEntity();
     entity.setName(usage.getName());
     entity.setUsed(usage.getUsed());
     entity.setTotal(usage.getTotal());
     entity.setTrend(calculateTrend(usage.getUsed(), usage.getPreviousUsed()));
     utilization.addVm(entity);
   }
 }
Пример #2
0
 public static void populateStorageUtilizationVms(
     Utilization utilization, DataSource dwhDataSource) throws DashboardDataException {
   StorageDomainDwhDao dao = new StorageDomainDwhDao(dwhDataSource);
   List<TrendResources> usageList = dao.getStorageUtilizationVms();
   for (TrendResources usage : usageList) {
     UtilizedEntity entity = new UtilizedEntity();
     entity.setName(usage.getName());
     // Transform GB to TB
     entity.setUsed(usage.getUsed() / 1024);
     entity.setTotal(usage.getTotal() / 1024);
     entity.setTrend(
         calculateTrend(usage.getUsed() / usage.getTotal() * 100, usage.getPreviousUsed()));
     utilization.addVm(entity);
   }
 }