Liron Ar has uploaded a new change for review.

Change subject: core: change while loop to foreach
......................................................................

core: change while loop to foreach

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


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/74/20974/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyDiskCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyDiskCommand.java
index b9154eb..406f19f 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyDiskCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyDiskCommand.java
@@ -209,20 +209,19 @@
      */
     protected boolean checkCanBeMoveInVm() {
         List<VM> vmsForDisk = getVmsForDiskId();
-        int vmCount = 0;
-        boolean canMoveDisk = true;
-        while (vmsForDisk.size() > vmCount && canMoveDisk) {
-            VM currVm = vmsForDisk.get(vmCount++);
+
+        for (VM currVm : vmsForDisk) {
             if (VMStatus.Down != currVm.getStatus()) {
                 VmDevice vmDevice =
                         getVmDeviceDAO().get(new 
VmDeviceId(getImage().getId(), currVm.getId()));
                 if (vmDevice.getIsPlugged()) {
                     
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN);
-                    canMoveDisk = false;
+                    return false;
                 }
             }
         }
-        return canMoveDisk;
+
+        return true;
     }
 
     /**


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id2d68bc5ae15226a5e1005d91f1218546990d225
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