Eli Mesika has uploaded a new change for review.

Change subject: core: adding engine Maintenance and Prepare mode.
......................................................................

core: adding engine Maintenance and Prepare mode.

Support for that was already merged in http://gerrit.ovirt.org/#/c/8669/10

Solution above assumed that configuration values can be reloaded while
the engine is still running. While this is true when working fro API, it
is not working from the engine-config, therefor, we must take the config
values directly from the database and not rely on the config cache.

Change-Id: Iae5d1148c9c2868abd0061700bb9988242dd8faf
Signed-off-by: Eli Mesika <[email protected]>
Bug-Url:https://bugzilla.redhat.com/868639
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/68/9568/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
index 5420be1..9f62da3 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
@@ -299,12 +299,13 @@
     }
 
     private VdcReturnValueBase notAllowToRunAction(VdcActionType actionType) {
-        EngineWorkingMode mode =
-                Config.<EngineWorkingMode> GetValue(ConfigValues.EngineMode);
-        switch (mode) {
-        case MAINTENANCE:
+        // Since reload of configuration values is not fully supported, we 
have to get this value from DB
+        // and can not use the cached configuration.
+        String  mode = 
(DbFacade.getInstance().getVdcOptionDao().getByNameAndVersion(ConfigValues.EngineMode.name(),Config.DefaultConfigurationVersion)).getoption_value();
+        if (EngineWorkingMode.MAINTENANCE.name().equalsIgnoreCase(mode)) {
             return 
getErrorCommandReturnValue(VdcBllMessages.ENGINE_IS_RUNNING_IN_MAINTENANCE_MODE);
-        case PREPARE:
+        }
+        else if (EngineWorkingMode.PREPARE.name().equalsIgnoreCase(mode)) {
             return notAllowedInPrepForMaintMode(actionType);
         }
         return null;


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

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