Commit 227647ac authored by Guido Trotter's avatar Guido Trotter
Browse files

Move the MASTER_SOCKET to SOCKET_DIR

Before it was in the abstract linux namespace, where unfortunately we
couldn't easily check from python the credentials of the connecting
clients. Now we also have to remove the file on exit and when starting.

Reviewed-by: imsnah
parent d823660a
......@@ -445,6 +445,10 @@ def main():
raise errors.GenericError("Cannot create socket directory"
" '%s': %s" % (constants.SOCKET_DIR, err))
# This is safe to do as the pid file guarantees against
# concurrent execution.
utils.RemoveFile(constants.MASTER_SOCKET)
master = IOServer(constants.MASTER_SOCKET, ClientRqHandler)
finally:
rpc.Shutdown()
......@@ -477,6 +481,7 @@ def main():
rpc.Shutdown()
finally:
utils.RemovePidFile(constants.MASTERD_PID)
utils.RemoveFile(constants.MASTER_SOCKET)
if __name__ == "__main__":
......
......@@ -99,18 +99,7 @@ QUEUE_DIR = DATA_DIR + "/queue"
ETC_HOSTS = "/etc/hosts"
DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
# Quoting unix(7) on Linux:
# Linux also supports an abstract namespace which is independent of the file
# system. [...] If sun_path starts with a null byte ('\0'), then it refers to
# the abstract namespace maintained by the Unix protocol module. The socket's
# address in this namespace is given by the rest of the bytes in sun_path.
#
# By using this Linux-specific way we don't have to care about removing the
# socket file when quitting or starting (after an unclean shutdown).
#
# Sample output for "netstat -nlp":
# unix 2 [ ACC ] STREAM LISTENING 247919 1234/python @ganeti-master
MASTER_SOCKET = "\0ganeti-master"
MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
# PID files
MASTERD_PID = "ganeti-masterd"
......
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