Exemplo n.º 1
0
 @Override
 public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() {
   if (getParameters().isRemoveDisks()) {
     List<QuotaConsumptionParameter> list = new ArrayList<>();
     ImagesHandler.fillImagesBySnapshots(getVm());
     for (DiskImage disk : getVm().getDiskList()) {
       for (DiskImage snapshot : disk.getSnapshots()) {
         if (snapshot.getQuotaId() != null && !Guid.Empty.equals(snapshot.getQuotaId())) {
           if (snapshot.getActive()) {
             list.add(
                 new QuotaStorageConsumptionParameter(
                     snapshot.getQuotaId(),
                     null,
                     QuotaStorageConsumptionParameter.QuotaAction.RELEASE,
                     disk.getStorageIds().get(0),
                     (double) snapshot.getSizeInGigabytes()));
           } else {
             list.add(
                 new QuotaStorageConsumptionParameter(
                     snapshot.getQuotaId(),
                     null,
                     QuotaStorageConsumptionParameter.QuotaAction.RELEASE,
                     disk.getStorageIds().get(0),
                     snapshot.getActualSize()));
           }
         }
       }
     }
     return list;
   }
   return Collections.emptyList();
 }