use of org.ovirt.engine.core.bll.quota.QuotaStorageConsumptionParameter in project ovirt-engine by oVirt.
the class RegisterDiskCommand method getQuotaStorageConsumptionParameters.
@Override
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() {
List<QuotaConsumptionParameter> list = new ArrayList<>();
refreshDiskImageIfNecessery();
list.add(new QuotaStorageConsumptionParameter(getParameters().getDiskImage().getQuotaId(), null, QuotaConsumptionParameter.QuotaAction.CONSUME, getStorageDomainId(), getDiskImage().getActualSize()));
return list;
}
use of org.ovirt.engine.core.bll.quota.QuotaStorageConsumptionParameter in project ovirt-engine by oVirt.
the class TransferDiskImageCommand method getQuotaStorageConsumptionParameters.
@Override
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() {
List<QuotaConsumptionParameter> list = new ArrayList<>();
if (getParameters().getAddDiskParameters() != null) {
AddDiskParameters parameters = getAddDiskParameters();
list.add(new QuotaStorageConsumptionParameter(((DiskImage) parameters.getDiskInfo()).getQuotaId(), null, QuotaConsumptionParameter.QuotaAction.CONSUME, getStorageDomainId(), (double) parameters.getDiskInfo().getSize() / SizeConverter.BYTES_IN_GB));
}
return list;
}
use of org.ovirt.engine.core.bll.quota.QuotaStorageConsumptionParameter in project ovirt-engine by oVirt.
the class MoveOrCopyDiskCommand method getQuotaStorageConsumptionParameters.
@Override
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() {
List<QuotaConsumptionParameter> list = new ArrayList<>();
list.add(new QuotaStorageConsumptionParameter(getDestinationQuotaId(), null, QuotaConsumptionParameter.QuotaAction.CONSUME, getParameters().getStorageDomainId(), (double) getImage().getSizeInGigabytes()));
if (isMoveOperation()) {
if (getImage().getQuotaId() != null && !Guid.Empty.equals(getImage().getQuotaId())) {
list.add(new QuotaStorageConsumptionParameter(getImage().getQuotaId(), null, QuotaConsumptionParameter.QuotaAction.RELEASE, getParameters().getSourceDomainId(), (double) getImage().getSizeInGigabytes()));
}
}
return list;
}
use of org.ovirt.engine.core.bll.quota.QuotaStorageConsumptionParameter in project ovirt-engine by oVirt.
the class UpdateVmDiskCommand method getQuotaStorageConsumptionParameters.
@Override
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() {
List<QuotaConsumptionParameter> list = new ArrayList<>();
if (isInternalManagedDisk()) {
DiskImage oldDiskImage = (DiskImage) getOldDisk();
DiskImage newDiskImage = (DiskImage) getNewDisk();
boolean emptyOldQuota = oldDiskImage.getQuotaId() == null || Guid.Empty.equals(oldDiskImage.getQuotaId());
boolean differentNewQuota = !emptyOldQuota && !oldDiskImage.getQuotaId().equals(newDiskImage.getQuotaId());
long diskExtendingDiff = newDiskImage.getSizeInGigabytes() - oldDiskImage.getSizeInGigabytes();
if (emptyOldQuota || differentNewQuota) {
list.add(generateQuotaConsumeParameters(newDiskImage, newDiskImage.getSizeInGigabytes()));
} else if (diskExtendingDiff > 0L) {
list.add(generateQuotaConsumeParameters(newDiskImage, diskExtendingDiff));
}
if (differentNewQuota) {
list.add(new QuotaStorageConsumptionParameter(oldDiskImage.getQuotaId(), null, QuotaStorageConsumptionParameter.QuotaAction.RELEASE, // TODO: Shared Disk?
oldDiskImage.getStorageIds().get(0), (double) oldDiskImage.getSizeInGigabytes()));
}
}
return list;
}
use of org.ovirt.engine.core.bll.quota.QuotaStorageConsumptionParameter in project ovirt-engine by oVirt.
the class ImportRepoImageCommand method getQuotaStorageConsumptionParameters.
@Override
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() {
List<QuotaConsumptionParameter> list = new ArrayList<>();
list.add(new QuotaStorageConsumptionParameter(getParameters().getQuotaId(), null, QuotaConsumptionParameter.QuotaAction.CONSUME, getParameters().getStorageDomainId(), (double) getDiskImage().getSizeInGigabytes()));
return list;
}
Aggregations