Arik Hadas has uploaded a new change for review.

Change subject: core: minor refactoring in VURTI#removeVmsFromCache
......................................................................

core: minor refactoring in VURTI#removeVmsFromCache

Change-Id: I27c4fc6edec3809b9e0daa74c6ed53bd21c06af3
Signed-off-by: Arik Hadas <[email protected]>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
1 file changed, 10 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/43/28143/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
index 34d0f3d..836de44 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
@@ -1748,17 +1748,19 @@
         }
     }
 
-    // del from cache all vms that not in vdsm
+    /**
+     * Delete all VMs that not reported by VDSM from cache
+     *
+     * @param staleRunningVms - VMs that didn't change their status
+     */
     private void removeVmsFromCache(List<Guid> staleRunningVms) {
-        Guid vmGuid;
         for (VM vmToRemove : _vmDict.values()) {
             if (staleRunningVms.contains(vmToRemove.getId())) {
                 continue;
             }
             proceedVmBeforeDeletion(vmToRemove, null);
-            boolean isInMigration = false;
-            if (vmToRemove.getStatus() == VMStatus.MigratingFrom) {
-                isInMigration = true;
+            boolean isInMigration = vmToRemove.getStatus() == 
VMStatus.MigratingFrom;
+            if (isInMigration) {
                 handOverVM(vmToRemove);
             } else {
                 clearVm(vmToRemove,
@@ -1771,7 +1773,7 @@
             log.infoFormat("VM {0} ({1}) is running in db and not running in 
VDS {2}",
                     vmToRemove.getName(), vmToRemove.getId(), _vds.getName());
 
-            vmGuid = vmToRemove.getId();
+            Guid vmGuid = vmToRemove.getId();
             if (!isInMigration && !_vmsToRerun.contains(vmGuid)
                     && 
ResourceManager.getInstance().IsVmInAsyncRunningList(vmGuid)) {
                 _vmsToRerun.add(vmGuid);
@@ -1783,9 +1785,8 @@
             // or reported from vdsm with error code
             else if (vmToRemove.isAutoStartup()
                     && !_autoVmsToRun.contains(vmGuid)
-                    && (!_runningVms.containsKey(vmGuid) || 
(_runningVms.containsKey(vmGuid) && _runningVms.get(vmGuid)
-                            .getVmDynamic()
-                            .getExitStatus() != VmExitStatus.Normal))) {
+                    && (!_runningVms.containsKey(vmGuid) ||
+                            
_runningVms.get(vmGuid).getVmDynamic().getExitStatus() != VmExitStatus.Normal)) 
{
                 _autoVmsToRun.add(vmGuid);
                 log.infoFormat("add VM {0} to HA rerun treatment", 
vmToRemove.getName());
             }


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

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

Reply via email to