# Checks for library functions.
AC_CONFIG_FILES([Makefile man/Makefile docs/Makefile
- testing/Makefile tools/Makefile
- lib/Makefile scripts/Makefile daemons/Makefile])
+ testing/Makefile tools/Makefile
+ lib/Makefile scripts/Makefile daemons/Makefile])
AC_OUTPUT
pid = os.fork()
except OSError, e:
raise Exception, "%s [%d]" % (e.strerror, e.errno)
- if (pid == 0): # The first child.
+ if (pid == 0): # The first child.
os.setsid()
try:
- pid = os.fork() # Fork a second child.
+ pid = os.fork() # Fork a second child.
except OSError, e:
raise Exception, "%s [%d]" % (e.strerror, e.errno)
- if (pid == 0): # The second child.
+ if (pid == 0): # The second child.
os.chdir(WORKDIR)
os.umask(UMASK)
else:
# 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:
- 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]
if (maxfd == resource.RLIM_INFINITY):
maxfd = MAXFD
for fd in range(0, maxfd):
try:
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
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.
- os.dup2(0, 1) # standard output (1)
- os.dup2(0, 2) # standard error (2)
+ os.dup2(0, 1) # standard output (1)
+ os.dup2(0, 2) # standard error (2)
return(0)
. /lib/lsb/init-functions
check_config() {
- for fname in /var/lib/ganeti/ssconf_node_pass /var/lib/ganeti/server.pem; do
- if ! [ -f "$fname" ]; then
- log_end_msg 0
- log_warning_msg "Config $fname not there, will not run."
- exit 0
- fi
- done
+ for fname in /var/lib/ganeti/ssconf_node_pass /var/lib/ganeti/server.pem; do
+ if ! [ -f "$fname" ]; then
+ log_end_msg 0
+ log_warning_msg "Config $fname not there, will not run."
+ exit 0
+ fi
+ done
}
case "$1" in
- start)
- log_begin_msg "Starting $DESC..."
- check_config
- start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1
- log_end_msg 0
- ;;
- stop)
- log_begin_msg "Stopping $DESC..."
- start-stop-daemon --stop --quiet --name $NAME || log_end_msg 1
- log_end_msg 0
- ;;
- restart|force-reload)
- log_begin_msg "Reloading $DESC..."
- start-stop-daemon --stop --quiet --oknodo --retry 30 --name $NAME
- check_config
- start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1
- log_end_msg 0
- ;;
- *)
- log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}"
- exit 1
- ;;
+ start)
+ log_begin_msg "Starting $DESC..."
+ check_config
+ start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1
+ log_end_msg 0
+ ;;
+ stop)
+ log_begin_msg "Stopping $DESC..."
+ start-stop-daemon --stop --quiet --name $NAME || log_end_msg 1
+ log_end_msg 0
+ ;;
+ restart|force-reload)
+ log_begin_msg "Reloading $DESC..."
+ start-stop-daemon --stop --quiet --oknodo --retry 30 --name $NAME
+ check_config
+ start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1
+ log_end_msg 0
+ ;;
+ *)
+ log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}"
+ exit 1
+ ;;
esac
exit 0
+
+# vim: set sw=4 sts=4 et foldmethod=marker :
for name in os.listdir("/sys/block"):
if (not name.startswith("hd") and
not name.startswith("sd") and
- not name.startswith("ubd")):
+ not name.startswith("ubd")):
continue
size = ReadSize("/sys/block/%s" % name)