Liron Ar has uploaded a new change for review.

Change subject: core: export vm - removal of unneeded for loop
......................................................................

core: export vm - removal of unneeded for loop

All the disks that are part of the export are already being iterated
over, their id's can be added during that loop.
Furthermore, there's no need to include id's that aren't part of the
export.

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


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/10/20710/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportVmCommand.java
index 6a75bb5..2f01e66 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportVmCommand.java
@@ -246,6 +246,8 @@
             interfaces.clear();
             
interfaces.addAll(getDbFacade().getVmNetworkInterfaceDao().getAllForVm(vm.getId()));
         }
+
+        List<Guid> imageGroupIds = new ArrayList<>();
         for (Disk disk : vm.getDiskMap().values()) {
             if (DiskStorageType.IMAGE == disk.getDiskStorageType() && 
!disk.isShareable()) {
                 DiskImage diskImage = (DiskImage) disk;
@@ -267,20 +269,17 @@
                     
diskImage.setActualSizeInBytes(fromVdsm.getActualSizeInBytes());
                 }
                 AllVmImages.add(diskImage);
+                imageGroupIds.add(disk.getId());
             }
         }
+
         if (StringUtils.isEmpty(vm.getVmtName())) {
             VmTemplate t = 
getDbFacade().getVmTemplateDao().get(vm.getVmtGuid());
             vm.setVmtName(t.getName());
         }
         getVm().setVmtGuid(VmTemplateHandler.BlankVmTemplateId);
         String vmMeta = ovfManager.ExportVm(vm, AllVmImages, 
ClusterUtils.getCompatibilityVersion(vm));
-        List<Guid> imageGroupIds = new ArrayList<Guid>();
-        for(Disk disk : vm.getDiskMap().values()) {
-            if(disk.getDiskStorageType() == DiskStorageType.IMAGE) {
-                imageGroupIds.add(disk.getId());
-            }
-        }
+
         vmsAndMetaDictionary
                     .put(vm.getId(), new KeyValuePairCompat<String, 
List<Guid>>(vmMeta, imageGroupIds));
         UpdateVMVDSCommandParameters tempVar = new 
UpdateVMVDSCommandParameters(storagePoolId, vmsAndMetaDictionary);


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

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

Reply via email to