Skip to content
Snippets Groups Projects
Commit bebf68d3 authored by Guido Trotter's avatar Guido Trotter
Browse files

ganeti-noded: add the --no-mlock option


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: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarLuca Bigliardi <shammash@google.com>
parent 2e98275a
No related branches found
No related tags found
No related merge requests found
......@@ -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))
......
......@@ -52,6 +52,13 @@
responsible for the node functions in the ganeti system.
</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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment