ofri masad has uploaded a new change for review. Change subject: core: Fix quota check for Add-Template ......................................................................
core: Fix quota check for Add-Template It is possible to create a template even if quota has no sufficient resources for the disk. The internal disk list in the command was created only after the quota consumption parameters were checked. This only happens when calling the command from REST API since the UI initialize the disk list. The getQuotaStorageConsumptionParameters() method was changed so that if the internal disk list was not initialized it will be taken directly from the vm disk list. Change-Id: I48bffa41aa8a049a184b8cde262ad9c7f9b3baff Bug-Url: https://bugzilla.redhat.com/913551 Signed-off-by: Ofri Masad <oma...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java 1 file changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/94/12394/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java index c77f4e5..df21ed4 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java @@ -1,6 +1,7 @@ package org.ovirt.engine.core.bll; import java.util.ArrayList; +import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -488,7 +489,11 @@ public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); - for (DiskImage disk : diskInfoDestinationMap.values()) { + Collection<DiskImage> disksList = + diskInfoDestinationMap.values().size() > 0 ? diskInfoDestinationMap.values() : + getVm().getDiskList(); + + for (DiskImage disk : disksList) { list.add(new QuotaStorageConsumptionParameter( disk.getQuotaId(), null, -- To view, visit http://gerrit.ovirt.org/12394 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I48bffa41aa8a049a184b8cde262ad9c7f9b3baff 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