Arik Hadas has uploaded a new change for review.

Change subject: core: prevent rerunning HA VM which is migrating
......................................................................

core: prevent rerunning HA VM which is migrating

This patch prevents potential bug where VdsUpdateRunTimeInfo will try to
rerun HA (auto-start) VM which went down on the source host as part of
migration process.

This patch also includes additional refactoring to removeVmsFromCache
method in VdsUpdateRunTimeInfo.

Change-Id: I64c91d2d56ed84ca546282d5efb88b8c4b4cbbc6
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, 17 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/84/20884/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 8edd0c2..bfb3b11 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
@@ -1722,16 +1722,13 @@
 
     // del from cache all vms that not in vdsm
     private void removeVmsFromCache(List<VM> running) {
-        Guid vmGuid;
         for (VM vmToRemove : _vmDict.values()) {
-            if (running.contains(vmToRemove))
-            {
+            if (running.contains(vmToRemove)) {
                 continue;
             }
+
             proceedVmBeforeDeletion(vmToRemove, null);
-            boolean isInMigration = false;
             if (vmToRemove.getStatus() == VMStatus.MigratingFrom) {
-                isInMigration = true;
                 handOverVM(vmToRemove);
             } else {
                 log.infoFormat("VM {0} ({1}) is running in db and not running 
in VDS {2}",
@@ -1741,25 +1738,22 @@
                         VmExitStatus.Error,
                         String.format("Could not find VM %s on host, assuming 
it went down unexpectedly",
                                 vmToRemove.getName()));
-            }
 
-            vmGuid = vmToRemove.getId();
-            if (!isInMigration && !_vmsToRerun.contains(vmGuid)
-                    && 
ResourceManager.getInstance().IsVmInAsyncRunningList(vmGuid)) {
-                _vmsToRerun.add(vmGuid);
-                log.infoFormat("add VM {0} to rerun treatment", 
vmToRemove.getName());
-            }
-            // vm should be auto startup
-            // not already in start up list
-            // not in reported from vdsm at all
-            // 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))) {
-                _autoVmsToRun.add(vmGuid);
-                log.infoFormat("add VM {0} to HA rerun treatment", 
vmToRemove.getName());
+                Guid vmGuid = vmToRemove.getId();
+                if (!_vmsToRerun.contains(vmGuid) && 
ResourceManager.getInstance().IsVmInAsyncRunningList(vmGuid)) {
+                    _vmsToRerun.add(vmGuid);
+                    log.infoFormat("add VM {0} to rerun treatment", 
vmToRemove.getName());
+                }
+                // vm should be auto startup
+                // not already in start up list
+                // not in reported from vdsm at all 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))) {
+                    _autoVmsToRun.add(vmGuid);
+                    log.infoFormat("add VM {0} to HA rerun treatment", 
vmToRemove.getName());
+                }
             }
         }
     }


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

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