use of org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter in project ovirt-engine by oVirt.
the class ImportVmCommand method getQuotaStorageConsumptionParameters.
@Override
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() {
List<QuotaConsumptionParameter> list = new ArrayList<>();
for (Disk disk : getParameters().getVm().getDiskMap().values()) {
// TODO: handle import more than once;
if (disk instanceof DiskImage) {
DiskImage diskImage = (DiskImage) disk;
list.add(new QuotaStorageConsumptionParameter(diskImage.getQuotaId(), null, QuotaConsumptionParameter.QuotaAction.CONSUME, imageToDestinationDomainMap.get(diskImage.getId()), (double) diskImage.getSizeInGigabytes()));
}
}
return list;
}
use of org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter in project ovirt-engine by oVirt.
the class RemoveVmTemplateCommand method getQuotaStorageConsumptionParameters.
@Override
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() {
List<QuotaConsumptionParameter> list = new ArrayList<>();
getImageTemplates();
if (imageTemplates != null) {
for (DiskImage disk : imageTemplates) {
if (disk.getQuotaId() != null && !Guid.Empty.equals(disk.getQuotaId())) {
for (Guid storageId : disk.getStorageIds()) {
list.add(new QuotaStorageConsumptionParameter(disk.getQuotaId(), null, QuotaStorageConsumptionParameter.QuotaAction.RELEASE, storageId, (double) disk.getSizeInGigabytes()));
}
}
}
}
return list;
}
use of org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter in project ovirt-engine by oVirt.
the class RemoveVmCommand method getQuotaStorageConsumptionParameters.
@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();
}
use of org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter in project ovirt-engine by oVirt.
the class RestoreAllSnapshotsCommand method getQuotaStorageConsumptionParameters.
@Override
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() {
List<QuotaConsumptionParameter> list = new ArrayList<>();
List<DiskImage> disks = getImagesList();
if (disks != null && !disks.isEmpty()) {
// TODO: need to be fixed. sp id should be available
setStoragePoolId(disks.get(0).getStoragePoolId());
for (DiskImage image : disks) {
if (!image.getImage().isActive() && image.getQuotaId() != null && !Guid.Empty.equals(image.getQuotaId())) {
list.add(new QuotaStorageConsumptionParameter(image.getQuotaId(), null, QuotaConsumptionParameter.QuotaAction.RELEASE, image.getStorageIds().get(0), image.getActualSize()));
}
}
}
return list;
}
use of org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter 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;
}
Aggregations