Sandro Bonazzola has uploaded a new change for review. Change subject: packaging: setup: preserve shmmax config on cleanup ......................................................................
packaging: setup: preserve shmmax config on cleanup Previously if you ran engine-setup; engine-cleanup; engine-setup the final engine-setup may not properly store a persistent configuration for shmmax in sysctl, so that a subsequent reboot will cause postgresql to fail to come up so oVirt is non-operational. Now cleanup won't remove the configuration for shmmax in sysctl just telling the user where it's placed and how to restore default value manually. This will ensure that a working postgresql will work also after reboot. Change-Id: I4a95d5d9c678da80ee3f1e0a9de511309dfd4b51 Bug-Url: https://bugzilla.redhat.com/1026926 Bug-Url: https://bugzilla.redhat.com/1027605 Signed-off-by: Sandro Bonazzola <sbona...@redhat.com> --- A packaging/setup/plugins/ovirt-engine-remove/system/__init__.py A packaging/setup/plugins/ovirt-engine-remove/system/sysctl.py M packaging/setup/plugins/ovirt-engine-setup/system/sysctl.py 3 files changed, 119 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/83/21283/1 diff --git a/packaging/setup/plugins/ovirt-engine-remove/system/__init__.py b/packaging/setup/plugins/ovirt-engine-remove/system/__init__.py new file mode 100644 index 0000000..ab657df --- /dev/null +++ b/packaging/setup/plugins/ovirt-engine-remove/system/__init__.py @@ -0,0 +1,33 @@ +# +# ovirt-engine-setup -- ovirt engine setup +# Copyright (C) 2013 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +"""ovirt-host-setup system plugin.""" + + +from otopi import util + + +from . import sysctl + + +@util.export +def createPlugins(context): + sysctl.Plugin(context=context) + + +# vim: expandtab tabstop=4 shiftwidth=4 diff --git a/packaging/setup/plugins/ovirt-engine-remove/system/sysctl.py b/packaging/setup/plugins/ovirt-engine-remove/system/sysctl.py new file mode 100644 index 0000000..2e08560 --- /dev/null +++ b/packaging/setup/plugins/ovirt-engine-remove/system/sysctl.py @@ -0,0 +1,82 @@ +# +# ovirt-engine-setup -- ovirt engine setup +# Copyright (C) 2013 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +"""sysctl plugin.""" + + +import gettext +import os +_ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-setup') + + +from otopi import util +from otopi import plugin + + +from ovirt_engine_setup import constants as osetupcons + + +@util.export +class Plugin(plugin.PluginBase): + """sysctl plugin.""" + + def __init__(self, context): + super(Plugin, self).__init__(context=context) + self._enabled = False + + @plugin.event( + stage=plugin.Stages.STAGE_MISC, + ) + def _misc(self): + if ( + osetupcons.FileLocations.OVIRT_ENGINE_SYSCTL in + self.environment[osetupcons.RemoveEnv.FILES_TO_REMOVE] + ): + self.environment[ + osetupcons.RemoveEnv.FILES_TO_REMOVE + ].remove( + osetupcons.FileLocations.OVIRT_ENGINE_SYSCTL + ) + + @plugin.event( + stage=plugin.Stages.STAGE_CLOSEUP, + before=( + osetupcons.Stages.DIALOG_TITLES_E_SUMMARY, + ), + after=( + osetupcons.Stages.DIALOG_TITLES_S_SUMMARY, + ), + ) + def _closeup(self): + if os.path.exists( + osetupcons.FileLocations.OVIRT_ENGINE_SYSCTL + ): + self.dialog.note( + text=_( + 'The file {filename} configuring sysctl kernel.shmmax has ' + 'been left in place in order to allow postgres to run at ' + 'next reboot.\n' + 'If you want to restore default kernel.shmmax ' + 'value please remove the file and reboot.' + ).format( + filename=osetupcons.FileLocations.OVIRT_ENGINE_SYSCTL, + ), + ) + + +# vim: expandtab tabstop=4 shiftwidth=4 diff --git a/packaging/setup/plugins/ovirt-engine-setup/system/sysctl.py b/packaging/setup/plugins/ovirt-engine-setup/system/sysctl.py index 77b7502..9e16bcb 100644 --- a/packaging/setup/plugins/ovirt-engine-setup/system/sysctl.py +++ b/packaging/setup/plugins/ovirt-engine-setup/system/sysctl.py @@ -139,6 +139,10 @@ otopicons.CoreEnv.MODIFIED_FILES ], ) + self.environment[ + osetupcons.CoreEnv.UNINSTALL_UNREMOVABLE_FILES + ].append(osetupcons.FileLocations.OVIRT_ENGINE_SYSCTL) + self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append(sysctl) # we must do this here as postgres requires it -- To view, visit http://gerrit.ovirt.org/21283 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4a95d5d9c678da80ee3f1e0a9de511309dfd4b51 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.3 Gerrit-Owner: Sandro Bonazzola <sbona...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches