Skip to content
Snippets Groups Projects
Commit 3c9a0742 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Replace tabs with spaces.

Reviewed-by: iustinp
parent 9f13fc7a
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,6 @@ AM_PATH_PYTHON(2.4) ...@@ -21,6 +21,6 @@ AM_PATH_PYTHON(2.4)
# Checks for library functions. # Checks for library functions.
AC_CONFIG_FILES([Makefile man/Makefile docs/Makefile AC_CONFIG_FILES([Makefile man/Makefile docs/Makefile
testing/Makefile tools/Makefile testing/Makefile tools/Makefile
lib/Makefile scripts/Makefile daemons/Makefile]) lib/Makefile scripts/Makefile daemons/Makefile])
AC_OUTPUT AC_OUTPUT
...@@ -366,20 +366,20 @@ def createDaemon(): ...@@ -366,20 +366,20 @@ def createDaemon():
pid = os.fork() pid = os.fork()
except OSError, e: except OSError, e:
raise Exception, "%s [%d]" % (e.strerror, e.errno) raise Exception, "%s [%d]" % (e.strerror, e.errno)
if (pid == 0): # The first child. if (pid == 0): # The first child.
os.setsid() os.setsid()
try: try:
pid = os.fork() # Fork a second child. pid = os.fork() # Fork a second child.
except OSError, e: except OSError, e:
raise Exception, "%s [%d]" % (e.strerror, e.errno) raise Exception, "%s [%d]" % (e.strerror, e.errno)
if (pid == 0): # The second child. if (pid == 0): # The second child.
os.chdir(WORKDIR) os.chdir(WORKDIR)
os.umask(UMASK) os.umask(UMASK)
else: else:
# exit() or _exit()? See below. # exit() or _exit()? See below.
os._exit(0) # Exit parent (the first child) of the second child. os._exit(0) # Exit parent (the first child) of the second child.
else: else:
os._exit(0) # Exit parent of the first child. os._exit(0) # Exit parent of the first child.
maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1] maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
if (maxfd == resource.RLIM_INFINITY): if (maxfd == resource.RLIM_INFINITY):
maxfd = MAXFD maxfd = MAXFD
...@@ -388,12 +388,12 @@ def createDaemon(): ...@@ -388,12 +388,12 @@ def createDaemon():
for fd in range(0, maxfd): for fd in range(0, maxfd):
try: try:
os.close(fd) os.close(fd)
except OSError: # ERROR, fd wasn't open to begin with (ignored) except OSError: # ERROR, fd wasn't open to begin with (ignored)
pass pass
os.open(REDIRECT_TO, os.O_RDWR|os.O_CREAT|os.O_APPEND) # standard input (0) os.open(REDIRECT_TO, os.O_RDWR|os.O_CREAT|os.O_APPEND) # standard input (0)
# Duplicate standard input to standard output and standard error. # Duplicate standard input to standard output and standard error.
os.dup2(0, 1) # standard output (1) os.dup2(0, 1) # standard output (1)
os.dup2(0, 2) # standard error (2) os.dup2(0, 2) # standard error (2)
return(0) return(0)
......
...@@ -15,38 +15,40 @@ set -e ...@@ -15,38 +15,40 @@ set -e
. /lib/lsb/init-functions . /lib/lsb/init-functions
check_config() { check_config() {
for fname in /var/lib/ganeti/ssconf_node_pass /var/lib/ganeti/server.pem; do for fname in /var/lib/ganeti/ssconf_node_pass /var/lib/ganeti/server.pem; do
if ! [ -f "$fname" ]; then if ! [ -f "$fname" ]; then
log_end_msg 0 log_end_msg 0
log_warning_msg "Config $fname not there, will not run." log_warning_msg "Config $fname not there, will not run."
exit 0 exit 0
fi fi
done done
} }
case "$1" in case "$1" in
start) start)
log_begin_msg "Starting $DESC..." log_begin_msg "Starting $DESC..."
check_config check_config
start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1 start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1
log_end_msg 0 log_end_msg 0
;; ;;
stop) stop)
log_begin_msg "Stopping $DESC..." log_begin_msg "Stopping $DESC..."
start-stop-daemon --stop --quiet --name $NAME || log_end_msg 1 start-stop-daemon --stop --quiet --name $NAME || log_end_msg 1
log_end_msg 0 log_end_msg 0
;; ;;
restart|force-reload) restart|force-reload)
log_begin_msg "Reloading $DESC..." log_begin_msg "Reloading $DESC..."
start-stop-daemon --stop --quiet --oknodo --retry 30 --name $NAME start-stop-daemon --stop --quiet --oknodo --retry 30 --name $NAME
check_config check_config
start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1 start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1
log_end_msg 0 log_end_msg 0
;; ;;
*) *)
log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}" log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}"
exit 1 exit 1
;; ;;
esac esac
exit 0 exit 0
# vim: set sw=4 sts=4 et foldmethod=marker :
...@@ -376,7 +376,7 @@ def GetDiskList(): ...@@ -376,7 +376,7 @@ def GetDiskList():
for name in os.listdir("/sys/block"): for name in os.listdir("/sys/block"):
if (not name.startswith("hd") and if (not name.startswith("hd") and
not name.startswith("sd") and not name.startswith("sd") and
not name.startswith("ubd")): not name.startswith("ubd")):
continue continue
size = ReadSize("/sys/block/%s" % name) size = ReadSize("/sys/block/%s" % name)
......
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