Ravi Nori has uploaded a new change for review.

Change subject: core : Upgrading a hypervisor automatically puts it into an Up 
state
......................................................................

core : Upgrading a hypervisor automatically puts it into an Up state

When upgrading a hypervisor via the admin portal, once
the install is finished the hypervisor returns (or tries
to return) to an Up state

Change-Id: Ib94ba543b347aab4eafe326e7fce84aac163be25
Bug-Url: https://bugzilla.redhat.com/1073070
Signed-off-by: Ravi Nori <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsCommand.java
3 files changed, 16 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/17/26117/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
index 4cb0c64..33a3326 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
@@ -35,6 +35,7 @@
     private static final String GENERIC_ERROR = "Please refer to engine.log 
and log files under /var/log/ovirt-engine/host-deploy/ on the engine for 
further details.";
     protected String _failureMessage = null;
     protected File _iso = null;
+    private VDSStatus vdsInitialStatus;
 
     private File resolveISO(String iso) {
         File ret = null;
@@ -134,6 +135,8 @@
             return;
         }
 
+        vdsInitialStatus = getVds().getStatus();
+
         if (isOvirtReInstallOrUpgrade()) {
             upgradeNode();
         } else {
@@ -231,7 +234,7 @@
                     throw new VdsInstallException(VDSStatus.InstallFailed, 
"Partial installation");
                 case Reboot:
                     setVdsStatus(VDSStatus.Reboot);
-                    RunSleepOnReboot();
+                    RunSleepOnReboot(getStatusOnReboot());
                 break;
                 case Complete:
                     if (!configureNetworkUsingHostDeploy) {
@@ -275,7 +278,7 @@
                     throw new VdsInstallException(VDSStatus.InstallFailed, 
StringUtils.EMPTY);
                 case Reboot:
                     setVdsStatus(VDSStatus.Reboot);
-                    RunSleepOnReboot();
+                    RunSleepOnReboot(getStatusOnReboot());
                 break;
                 case Complete:
                     setVdsStatus(VDSStatus.Initializing);
@@ -295,6 +298,10 @@
         }
     }
 
+    private VDSStatus getStatusOnReboot() {
+        return (VDSStatus.Maintenance.equals(vdsInitialStatus)) ? 
VDSStatus.Maintenance : VDSStatus.NonResponsive;
+    }
+
     private void handleError(Exception e, VDSStatus status) {
         log.errorFormat(
             "Host installation failed for host {0}, {1}.",
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsCommand.java
index a5776c1..798b98e 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsCommand.java
@@ -24,8 +24,6 @@
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
 import org.ovirt.engine.core.common.validation.group.PowerManagementCheck;
 import org.ovirt.engine.core.common.validation.group.UpdateEntity;
-import 
org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters;
-import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.dal.dbbroker.DbFacade;
 import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase;
@@ -211,10 +209,6 @@
             }
         });
 
-        if (getParameters().getInstallVds()) {
-            runVdsCommand(VDSCommandType.SetVdsStatus,
-                    new SetVdsStatusVDSCommandParameters(getVdsId(), 
VDSStatus.Installing));
-        }
     }
 
     private boolean NeedToUpdateVdsBroker() {
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsCommand.java
index ac10cd7..ee4ae79 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsCommand.java
@@ -67,15 +67,19 @@
     }
 
     protected void RunSleepOnReboot() {
+        RunSleepOnReboot(VDSStatus.NonResponsive);
+    }
+
+    protected void RunSleepOnReboot(final VDSStatus status) {
         ThreadPoolUtil.execute(new Runnable() {
             @Override
             public void run() {
-                SleepOnReboot();
+                SleepOnReboot(status);
             }
         });
     }
 
-    private void SleepOnReboot() {
+    private void SleepOnReboot(final VDSStatus status) {
         int sleepTimeInSec = Config.<Integer> 
getValue(ConfigValues.ServerRebootTimeout);
         log.infoFormat("Waiting {0} seconds, for server to finish reboot 
process.",
                 sleepTimeInSec);
@@ -83,7 +87,7 @@
         Backend.getInstance()
                 .getResourceManager()
                 .RunVdsCommand(VDSCommandType.SetVdsStatus,
-                        new SetVdsStatusVDSCommandParameters(getVdsId(), 
VDSStatus.NonResponsive));
+                        new SetVdsStatusVDSCommandParameters(getVdsId(), 
status));
     }
 
     /**


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

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

Reply via email to