From 9894ece7cac241a51f5a6310e1e074058f6f514e Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Mon, 18 Aug 2008 11:12:06 +0000 Subject: [PATCH] Use Linux-specific way to name master socket 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). For a more detailed description, see the comment in the patch. Reviewed-by: schreiberal --- daemons/ganeti-masterd | 1 - lib/constants.py | 14 +++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/daemons/ganeti-masterd b/daemons/ganeti-masterd index 6400e2f77..035c229b1 100755 --- a/daemons/ganeti-masterd +++ b/daemons/ganeti-masterd @@ -127,7 +127,6 @@ class IOServer(SocketServer.UnixStreamServer): """ try: self.server_close() - utils.RemoveFile(constants.MASTER_SOCKET) finally: if self.request_workers: self.request_workers.TerminateWorkers() diff --git a/lib/constants.py b/lib/constants.py index 4d48cbf20..fe13e27b4 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -95,7 +95,19 @@ SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts" QUEUE_DIR = DATA_DIR + "/queue" ETC_HOSTS = "/etc/hosts" DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR -MASTER_SOCKET = RUN_GANETI_DIR + "/master.sock" + +# 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" # PID files MASTERD_PID = "ganeti-masterd" -- GitLab