Eli Mesika has uploaded a new change for review. Change subject: core: adding engine Maintenance mode ......................................................................
core: adding engine Maintenance mode Adding support for engine Maintenance mode that is controlled by a new configuration key named EngineMaintenanceMode (boolean). The default value of this configuration key is false, however, this value can be set to true in order to prevent new commands from being processed by the backend class. Change-Id: Idd86f9f9008a447e160edc913ee8a6cd70912dcb Signed-off-by: Eli Mesika <emes...@redhat.com> --- M backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java M frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties M frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties 8 files changed, 29 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/69/8669/1 diff --git a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql index 6e47f32..1b843c3 100644 --- a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql +++ b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql @@ -115,6 +115,8 @@ --Handling Enables Host Load Balancing system. select fn_db_add_config_value('EnableVdsLoadBalancing','true','general'); select fn_db_add_config_value('ENGINEEARLib','%JBOSS_HOME%/server/engine-slimmed/deploy/engine.ear','general'); +--Handling Engine maintenance mode +select fn_db_add_config_value('EngineMaintenanceMode','false','general'); --Handling Mail User Domain select fn_db_add_config_value('ENMailDomain','','general'); --Handling Use HTML in message body 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 95cfe3a..196a485 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 @@ -314,12 +314,15 @@ VdcReturnValueBase returnValue = null; switch (actionType) { case AutoLogin: - returnValue = new VdcReturnValueBase(); - returnValue.setCanDoAction(false); - returnValue.getCanDoActionMessages().add(VdcBllMessages.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION.toString()); - return returnValue; + return getErrorReturnValue(VdcBllMessages.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION); default: { + // check if engine runs in maintenance mode , in such case all Action is rejected + // used mainly for safe upgrade and proper handling of left async tasks and compensation. + if (Config.<Boolean>GetValue(ConfigValues.EngineMaintenanceMode)){ + return getErrorReturnValue(VdcBllMessages.ENGINE_IS_RUNNING_IN_MAINTENANCE_MODE); + } + // Evaluate and set the correlationId on the parameters, fails on invalid correlation id boolean hasCorrelationId = parameters == null ? false : StringUtils.isNotEmpty(parameters.getCorrelationId()); @@ -596,5 +599,12 @@ return runActionImpl(actionType, parameters, true, context); } + private VdcReturnValueBase getErrorReturnValue(VdcBllMessages message) { + VdcReturnValueBase returnValue = new VdcReturnValueBase(); + returnValue.setCanDoAction(false); + returnValue.getCanDoActionMessages().add(message.toString()); + return returnValue; + } + private static final Log log = LogFactory.getLog(Backend.class); } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java index 0602a88..4f2e053 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java @@ -1530,6 +1530,10 @@ @DefaultValueAttribute("false") OnlyRequiredNetworksMandatoryForVdsSelection(392), + @TypeConverterAttribute(Boolean.class) + @DefaultValueAttribute("false") + EngineMaintenanceMode(393), + Invalid(65535); private int intValue; diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java index ee8a25f..2cdf87d 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java @@ -666,8 +666,9 @@ /* VDSM Error that propagates up to the client. See VdcBLLErrors */ ERROR_GET_STORAGE_DOMAIN_LIST, // VdcBllErrors.GetStorageDomainListError - USER_CANNOT_FORCE_RECONNECT_TO_VM - ; + USER_CANNOT_FORCE_RECONNECT_TO_VM, + // Engine maintenance mode + ENGINE_IS_RUNNING_IN_MAINTENANCE_MODE; public int getValue() { return this.ordinal(); diff --git a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties index 30dfb4c..1eb87c5 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -794,3 +794,4 @@ ACTION_TYPE_FAILED_NETWORK_INTERFACE_MAC_INVALID=Cannot ${action} ${type}. The Network Interface ${IfaceName} has an invalid MAC address ${MacAddress}. MAC address must be in format "HH:HH:HH:HH:HH:HH" where H is a hexadecimal character (either a digit or A-F, case is insignificant). MIGRATE_PAUSED_VM_IS_UNSUPPORTED=Migrating a VM in paused status is unsupported. VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED=Cannot ${action} ${type}. Enabling both Virt and Gluster services is not allowed. +ENGINE_IS_RUNNING_IN_MAINTENANCE_MODE=Engine is running in Maintenance mode by the upgrade process and is not accepting commands. diff --git a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java index cfe1fa5..c4a34d6 100644 --- a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java +++ b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java @@ -2080,4 +2080,7 @@ @DefaultStringValue("Console connection denied. Another user has already accessed the console of this VM. The VM should be rebooted to allow another user to access it, or changed by an admin to not enforce reboot between users accessing its console.") String USER_CANNOT_FORCE_RECONNECT_TO_VM(); + + @DefaultStringValue("Engine is running in Maintenance mode by the upgrade process and is not accepting commands.") + String ENGINE_IS_RUNNING_IN_MAINTENANCE_MODE(); } diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index 209b5b2..093c929 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -735,3 +735,4 @@ ACTION_TYPE_FAILED_NETWORK_INTERFACE_MAC_INVALID=Cannot ${action} ${type}. The Network Interface ${IfaceName} has an invalid MAC address ${MacAddress}. MAC address must be in format "HH:HH:HH:HH:HH:HH" where H is a hexadecimal character (either a digit or A-F, case is insignificant). MIGRATE_PAUSED_VM_IS_UNSUPPORTED=Migrating a VM in paused status is unsupported. USER_CANNOT_FORCE_RECONNECT_TO_VM=Console connection denied. Another user has already accessed the console of this VM. The VM should be rebooted to allow another user to access it, or changed by an admin to not enforce reboot between users accessing its console. +ENGINE_IS_RUNNING_IN_MAINTENANCE_MODE=Engine is running in Maintenance mode by the upgrade process and is not accepting commands. diff --git a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index 958753a..c30a726 100644 --- a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -737,3 +737,4 @@ VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED=Cannot ${action} ${type}. Enabling both Virt and Gluster services is not allowed. USER_CANNOT_FORCE_RECONNECT_TO_VM=Console connection denied. Another user has already accessed the console of this VM. The VM should be rebooted to allow another user to access it, or changed by an admin to not enforce reboot between users accessing its console. +ENGINE_IS_RUNNING_IN_MAINTENANCE_MODE=Engine is running in Maintenance mode by the upgrade process and is not accepting commands. -- To view, visit http://gerrit.ovirt.org/8669 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idd86f9f9008a447e160edc913ee8a6cd70912dcb Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <emes...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches