Ofer Schreiber has uploaded a new change for review. Change subject: packaging: verify sysctl.shmmax after modification ......................................................................
packaging: verify sysctl.shmmax after modification In non-developer mode, ovirt-engine-setup tries to modify sysctl.shmmax. This patch verifies that the above modification went correctly, and that the current sysctl.shmmax is above what we need. Change-Id: If2e1eafad9dacfa4d784526cdd0118c45cc47ccb Signed-off-by: Ofer Schreiber <oschr...@redhat.com> Bug-Url: https://bugzilla.redhat.com/1059355 (cherry picked from commit 809d795e53e5e1974e6f001b8ae18d5a72246fbb) --- M packaging/setup/plugins/ovirt-engine-setup/system/sysctl.py 1 file changed, 42 insertions(+), 23 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/66/23866/1 diff --git a/packaging/setup/plugins/ovirt-engine-setup/system/sysctl.py b/packaging/setup/plugins/ovirt-engine-setup/system/sysctl.py index 9e16bcb..550c691 100644 --- a/packaging/setup/plugins/ovirt-engine-setup/system/sysctl.py +++ b/packaging/setup/plugins/ovirt-engine-setup/system/sysctl.py @@ -68,14 +68,7 @@ interactive = self.environment[osetupcons.CoreEnv.DEVELOPER_MODE] while True: - rc, shmmax, stderr = self.execute( - ( - self.command.get('sysctl'), - '-n', - 'kernel.shmmax', - ), - ) - shmmax = int(shmmax[0]) + shmmax = self._get_shmmax() if shmmax >= self.environment[osetupcons.SystemEnv.SHMMAX]: break @@ -129,29 +122,55 @@ stage=plugin.Stages.STAGE_MISC, name=osetupcons.Stages.SYSTEM_SYSCTL_CONFIG_AVAILABLE, priority=plugin.Stages.PRIORITY_HIGH, - condition=lambda self: self._enabled, ) def _misc(self): - sysctl = filetransaction.FileTransaction( - name=osetupcons.FileLocations.OVIRT_ENGINE_SYSCTL, - content=self._content, - modifiedList=self.environment[ - otopicons.CoreEnv.MODIFIED_FILES - ], - ) - self.environment[ - osetupcons.CoreEnv.UNINSTALL_UNREMOVABLE_FILES - ].append(osetupcons.FileLocations.OVIRT_ENGINE_SYSCTL) + if self._enabled: + sysctl = filetransaction.FileTransaction( + name=osetupcons.FileLocations.OVIRT_ENGINE_SYSCTL, + content=self._content, + modifiedList=self.environment[ + 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) + self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append(sysctl) - # we must do this here as postgres requires it - self.execute( + # we must do this here as postgres requires it + self.execute( + ( + self.command.get('sysctl'), + '-p', sysctl.tmpname, + ), + ) + + # Verify shmmax is set correctly + shmmax = self._get_shmmax() + + if shmmax <= self.environment[osetupcons.SystemEnv.SHMMAX]: + self.logger.debug( + 'sysctl kernel.shmmax is %s lower than %s' % ( + shmmax, + self.environment[osetupcons.SystemEnv.SHMMAX], + ) + ) + + raise RuntimeError( + _('Unable to set sysctl kernel.shmmax to minimum requirement') + ) + + def _get_shmmax(self): + rc, shmmax, stderr = self.execute( ( self.command.get('sysctl'), - '-p', sysctl.tmpname, + '-n', + 'kernel.shmmax', ), ) + return int(shmmax[0]) + # vim: expandtab tabstop=4 shiftwidth=4 -- To view, visit http://gerrit.ovirt.org/23866 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If2e1eafad9dacfa4d784526cdd0118c45cc47ccb Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.3 Gerrit-Owner: Ofer Schreiber <oschr...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches