Liron Ar has uploaded a new change for review.

Change subject: core: RemoveVm - fill quota release parameters when needed
......................................................................

core: RemoveVm - fill quota release parameters when needed

*If the vm disks aren't going to be removed, there's no need to create
quota release parameters.

*The vm snapshots should be filled only once and not on every iteration.

*The operation should be done for the disks that would be removed only.

Change-Id: I666091dbc64b03b9cf19b76f26a4afb8100b8373
Signed-off-by: Liron Aravot <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/98/20898/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 3a12f99..64a7cb0 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
@@ -321,9 +321,10 @@
 
     @Override
     public List<QuotaConsumptionParameter> 
getQuotaStorageConsumptionParameters() {
-        List<QuotaConsumptionParameter> list = new ArrayList<>();
-        for (DiskImage disk : getVm().getDiskList()) {
-                ImagesHandler.fillImagesBySnapshots(getVm());
+        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()) {
@@ -343,8 +344,10 @@
                         }
                     }
                 }
+            }
+            return list;
         }
-        return list;
+        return Collections.emptyList();
     }
 
     ///////////////////////////////////////


-- 
To view, visit http://gerrit.ovirt.org/20898
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I666091dbc64b03b9cf19b76f26a4afb8100b8373
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Liron Ar <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to