Eli Mesika has uploaded a new change for review.

Change subject: [RFE] Maintenance mode shall persist after reboot
......................................................................

[RFE] Maintenance mode shall persist after reboot

Fencing operations can occur as a result of manual operation or
automatically after Host was in non-responsive state and has been
restarted after waiting the grace-time for it to reconnect.

In the case that Host was in Maintenance
1) If it was manually started , it should stay in maintenance
2) If it was manually restarted it should change first to reboot and move back 
to
Maintenance when the Host is ON again.

In the case that Host is restarted from the non-responsive treatment, it
should go to reboot -> non responding -> up as before

This patch address 1) and 2) above by

1) Setting the parent command in VdsNotRespondingTreatmentComman
parameters so the Restart command can distinguish between manual Restart and
automatic restart
2) Add a flag to FenceVdsActionParameters to mark if Host should be
moved again to Maintenance after it was restarted
3) Use The Host last status to skip changing the status in case of 1)
4) Use the flag described in 2) to set Host again to Maintenance in
case that Host was manually rebooted while in the Maintenance status.

Change-Id: I3dcb06b18c4af13876d1fb3043fb5b6cc5c6a74a
https://bugzilla.redhat.com/show_bug.cgi?id=917039
Signed-off-by: Eli Mesika <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestartVdsCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/StartVdsCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/FenceVdsActionParameters.java
5 files changed, 24 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/28/23428/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
index 3eef1d3..990a396 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
@@ -52,7 +52,6 @@
     private FenceInvocationResult primaryResult;
     private FenceInvocationResult secondaryResult;
 
-
     /**
      * Constructor for command creation when compensation is applied on startup
      *
@@ -156,7 +155,10 @@
         VDSReturnValue vdsReturnValue = null;
         try {
             // Set status immediately to prevent a race (BZ 636950/656224)
-            setStatus();
+            // Skip setting status if action is manual Start and Host was in 
Maintenance
+            if (! (getParameters().getAction() == FenceActionType.Start && 
lastStatus == VDSStatus.Maintenance)) {
+                setStatus();
+            }
             // Check which fence invocation pattern to invoke
             // Regular (no secondary agent) , multiple sequential agents or 
multiple concurrent agents
             if (StringUtils.isEmpty(getVds().getPmSecondaryIp())){
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestartVdsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestartVdsCommand.java
index 2b18611..e76ed39 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestartVdsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestartVdsCommand.java
@@ -111,6 +111,10 @@
         FenceVdsActionParameters params = new FenceVdsActionParameters(vdsId, 
fenceAction);
         params.setParentCommand(VdcActionType.RestartVds);
         params.setSessionId(sessionId);
+        // If Host was in Maintenance, and was restarted manually , it should 
preserve its status after reboot
+        if (getParameters().getParentCommand() != 
VdcActionType.VdsNotRespondingTreatment && getVds().getStatus() == 
VDSStatus.Maintenance) {
+            params.setChangeHostToMaintenanceOnStart(true);
+        }
         return Backend.getInstance().runInternalAction(action, params, 
getContext());
     }
 
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/StartVdsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/StartVdsCommand.java
index c7fc122..40d48e3 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/StartVdsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/StartVdsCommand.java
@@ -50,7 +50,12 @@
 
     @Override
     protected void setStatus() {
-        setStatus(VDSStatus.NonResponsive);
+        if (getParameters().isChangeHostToMaintenanceOnStart()) {
+            setStatus(VDSStatus.Maintenance);
+        }
+        else {
+            setStatus(VDSStatus.NonResponsive);
+        }
     }
 
     @Override
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 3471f48..97f024a 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
@@ -61,6 +61,7 @@
         VdsValidator validator = new VdsValidator(getVds());
         boolean shouldBeFenced = validator.shouldVdsBeFenced();
         if (shouldBeFenced) {
+            
getParameters().setParentCommand(VdcActionType.VdsNotRespondingTreatment);
             super.executeCommand();
         } else {
             setCommandShouldBeLogged(false);
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/FenceVdsActionParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/FenceVdsActionParameters.java
index bbb01b0..168962d 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/FenceVdsActionParameters.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/FenceVdsActionParameters.java
@@ -5,6 +5,7 @@
 
 public class FenceVdsActionParameters extends VdsActionParameters {
     private static final long serialVersionUID = 6174371941176548263L;
+    private boolean changeHostToMaintenanceOnStart=false;
 
     /*
      * If the power management policy is responsible for this action
@@ -41,4 +42,12 @@
     public void setKeepPolicyPMEnabled(boolean _keepPolicyPMEnabled) {
         this.keepPolicyPMEnabled = _keepPolicyPMEnabled;
     }
+
+    public boolean isChangeHostToMaintenanceOnStart() {
+        return changeHostToMaintenanceOnStart;
+    }
+
+    public void setChangeHostToMaintenanceOnStart(boolean 
changeHostStatusOnStart) {
+        this.changeHostToMaintenanceOnStart = changeHostStatusOnStart;
+    }
 }


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

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