Eli Mesika has uploaded a new change for review.

Change subject: core: VMs moved to UNKNOWN after set to DOWN
......................................................................

core: VMs moved to UNKNOWN after set to DOWN

In case that fencing fails and host is rebooted manually we can
encounter the following

1) Fence failure handling started
2) Host is rebooted and is UP
3) Host set all its VMs in DOWN
4) Fencing failure handling sets all host VMs to UNKNOWN

In order to prevent that, the code in the fencing error handling flow
that changes the host VMs to UNKNOWN was changed to check if the host
has at least one VM not in the DOWN state and only if this condition is
true, the code that moves VMs to UNKNOWN is processed.

Change-Id: I3c6a6b67e4ec8b44a41dc13729b5999b852a88e2
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1064860
Signed-off-by: Eli Mesika <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
1 file changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/66/26466/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
index 543ba1a..330983b 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
@@ -88,7 +88,10 @@
 
     @Override
     protected void handleError() {
-        MoveVMsToUnknown();
+        // In case that all VMs are in down we assume that host was rebooted 
and marked all VMs as DOWN so we should not change their state again
+        if (vmNotInStatusExists(VMStatus.Down)) {
+            MoveVMsToUnknown();
+        }
         // if fence failed on spm, move storage pool to non operational
         if (getVds().getSpmStatus() != VdsSpmStatus.None) {
             log.infoFormat("Fence failed on vds {0} which is spm of pool {1} - 
moving pool to non operational",
@@ -103,6 +106,14 @@
         AlertIfPowerManagementOperationSkipped(RESTART, null);
     }
 
+    private boolean vmNotInStatusExists(VMStatus status) {
+        for (VM vm : getVmList()) {
+            if (vm.getStatus() != status)
+                return true;
+        }
+        return false;
+    }
+
     @Override
     public AuditLogType getAuditLogTypeValue() {
         return getSucceeded() ? _vmsMovedToUnknown ? 
AuditLogType.VDS_RECOVER_FAILED_VMS_UNKNOWN


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

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

Reply via email to