While mlock on noded is definitely good in most situations, there are some - namely my laptop - where it has no benefit, and uses precious non-swappable memory. To avoid this we make it optional, with a new --no-mlock option. Note that only the main node daemon and its http children are affected: the powercycle node child still uses mlock, which doesn't harm, since it's a short lived process happening just before node reboot anyway. The manpage is updated.
Signed-off-by: Guido Trotter <[email protected]> --- daemons/ganeti-noded | 12 ++++++++++-- man/ganeti-noded.sgml | 7 +++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded index 76fcb1b..e40771c 100755 --- a/daemons/ganeti-noded +++ b/daemons/ganeti-noded @@ -844,7 +844,11 @@ def ExecNoded(options, _): """Main node daemon function, executed with the PID file held. """ - utils.Mlockall() + if options.mlock: + utils.Mlockall() + request_executor_class = MlockallRequestExecutor + else: + request_executor_class = http.server.HttpServerRequestExecutor # Read SSL certificate if options.ssl: @@ -863,7 +867,7 @@ def ExecNoded(options, _): mainloop = daemon.Mainloop() server = NodeHttpServer(mainloop, options.bind_address, options.port, ssl_params=ssl_params, ssl_verify_peer=True, - request_executor_class=MlockallRequestExecutor) + request_executor_class=request_executor_class) server.Start() try: mainloop.Run() @@ -879,6 +883,10 @@ def main(): usage="%prog [-f] [-d] [-p port] [-b ADDRESS]", version="%%prog (ganeti) %s" % constants.RELEASE_VERSION) + parser.add_option("--no-mlock", dest="mlock", + help="Do not mlock the node memory in ram", + default=True, action="store_false") + dirs = [(val, constants.RUN_DIRS_MODE) for val in constants.SUB_RUN_DIRS] dirs.append((constants.LOG_OS_DIR, 0750)) dirs.append((constants.LOCK_DIR, 1777)) diff --git a/man/ganeti-noded.sgml b/man/ganeti-noded.sgml index 2693700..d590fe2 100644 --- a/man/ganeti-noded.sgml +++ b/man/ganeti-noded.sgml @@ -53,6 +53,13 @@ </para> <para> + By default, in order to be able to support features such as node + powercycling even on systems with a very damaged root disk, ganeti-noded + mlocks itself in ram. You can disable this feature by passing in the + <option>--no-mlock</option>. + </para> + + <para> For testing purposes, you can give the <option>-f</option> option and the program won't detach from the running terminal. </para> -- 1.7.1
