ofri masad has uploaded a new change for review. Change subject: core: Fix snapshot quota when removing a VM ......................................................................
core: Fix snapshot quota when removing a VM When VM is removed the disks quota is released. Added a release for the snapshot's quota as well Change-Id: I5a1649e65c1a0cf4c7752dd5f6e39c9b034feecd Bug-Url: https://bugzilla.redhat.com/1001017 Signed-off-by: Ofri Masad <oma...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java 1 file changed, 21 insertions(+), 9 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/41/18741/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java index ef4ab02..a5935ec 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java @@ -306,15 +306,27 @@ @Override public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<>(); - for (DiskImage disk : getVm().getDiskList()){ - if (disk.getQuotaId() != null && !Guid.Empty.equals(disk.getQuotaId())) { - list.add(new QuotaStorageConsumptionParameter( - disk.getQuotaId(), - null, - QuotaStorageConsumptionParameter.QuotaAction.RELEASE, - disk.getStorageIds().get(0), - (double)disk.getSizeInGigabytes())); - } + for (DiskImage disk : getVm().getDiskList()) { + ImagesHandler.fillImagesBySnapshots(getVm()); + 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; } -- To view, visit http://gerrit.ovirt.org/18741 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5a1649e65c1a0cf4c7752dd5f6e39c9b034feecd Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: ofri masad <oma...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches