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
...@@ -844,7 +844,11 @@ def ExecNoded(options, _): ...@@ -844,7 +844,11 @@ def ExecNoded(options, _):
"""Main node daemon function, executed with the PID file held. """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 # Read SSL certificate
if options.ssl: if options.ssl:
...@@ -863,7 +867,7 @@ def ExecNoded(options, _): ...@@ -863,7 +867,7 @@ def ExecNoded(options, _):
mainloop = daemon.Mainloop() mainloop = daemon.Mainloop()
server = NodeHttpServer(mainloop, options.bind_address, options.port, server = NodeHttpServer(mainloop, options.bind_address, options.port,
ssl_params=ssl_params, ssl_verify_peer=True, ssl_params=ssl_params, ssl_verify_peer=True,
request_executor_class=MlockallRequestExecutor) request_executor_class=request_executor_class)
server.Start() server.Start()
try: try:
mainloop.Run() mainloop.Run()
...@@ -879,6 +883,10 @@ def main(): ...@@ -879,6 +883,10 @@ def main():
usage="%prog [-f] [-d] [-p port] [-b ADDRESS]", usage="%prog [-f] [-d] [-p port] [-b ADDRESS]",
version="%%prog (ganeti) %s" % version="%%prog (ganeti) %s" %
constants.RELEASE_VERSION) 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 = [(val, constants.RUN_DIRS_MODE) for val in constants.SUB_RUN_DIRS]
dirs.append((constants.LOG_OS_DIR, 0750)) dirs.append((constants.LOG_OS_DIR, 0750))
dirs.append((constants.LOCK_DIR, 1777)) dirs.append((constants.LOCK_DIR, 1777))
......
...@@ -52,6 +52,13 @@ ...@@ -52,6 +52,13 @@
responsible for the node functions in the ganeti system. responsible for the node functions in the ganeti system.
</para> </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> <para>
For testing purposes, you can give the <option>-f</option> For testing purposes, you can give the <option>-f</option>
option and the program won't detach from the running terminal. option and the program won't detach from the running terminal.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment