Revision 3c9a0742

b/configure.ac
21 21
# Checks for library functions.
22 22

  
23 23
AC_CONFIG_FILES([Makefile man/Makefile docs/Makefile 
24
		testing/Makefile tools/Makefile
25
		lib/Makefile scripts/Makefile daemons/Makefile])
24
  testing/Makefile tools/Makefile
25
  lib/Makefile scripts/Makefile daemons/Makefile])
26 26
AC_OUTPUT
b/daemons/ganeti-noded
366 366
    pid = os.fork()
367 367
  except OSError, e:
368 368
    raise Exception, "%s [%d]" % (e.strerror, e.errno)
369
  if (pid == 0):	# The first child.
369
  if (pid == 0):  # The first child.
370 370
    os.setsid()
371 371
    try:
372
      pid = os.fork()	# Fork a second child.
372
      pid = os.fork() # Fork a second child.
373 373
    except OSError, e:
374 374
      raise Exception, "%s [%d]" % (e.strerror, e.errno)
375
    if (pid == 0):	# The second child.
375
    if (pid == 0):  # The second child.
376 376
      os.chdir(WORKDIR)
377 377
      os.umask(UMASK)
378 378
    else:
379 379
      # exit() or _exit()?  See below.
380
      os._exit(0)	# Exit parent (the first child) of the second child.
380
      os._exit(0) # Exit parent (the first child) of the second child.
381 381
  else:
382
    os._exit(0)	# Exit parent of the first child.
382
    os._exit(0) # Exit parent of the first child.
383 383
  maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
384 384
  if (maxfd == resource.RLIM_INFINITY):
385 385
    maxfd = MAXFD
......
388 388
  for fd in range(0, maxfd):
389 389
    try:
390 390
      os.close(fd)
391
    except OSError:	# ERROR, fd wasn't open to begin with (ignored)
391
    except OSError: # ERROR, fd wasn't open to begin with (ignored)
392 392
      pass
393 393
  os.open(REDIRECT_TO, os.O_RDWR|os.O_CREAT|os.O_APPEND) # standard input (0)
394 394
  # Duplicate standard input to standard output and standard error.
395
  os.dup2(0, 1)			# standard output (1)
396
  os.dup2(0, 2)			# standard error (2)
395
  os.dup2(0, 1)     # standard output (1)
396
  os.dup2(0, 2)     # standard error (2)
397 397
  return(0)
398 398

  
399 399

  
b/ganeti.initd
15 15
. /lib/lsb/init-functions
16 16

  
17 17
check_config() {
18
	for fname in /var/lib/ganeti/ssconf_node_pass /var/lib/ganeti/server.pem; do
19
		if ! [ -f "$fname" ]; then
20
			log_end_msg 0
21
			log_warning_msg "Config $fname not there, will not run."
22
			exit 0
23
		fi
24
	done
18
    for fname in /var/lib/ganeti/ssconf_node_pass /var/lib/ganeti/server.pem; do
19
        if ! [ -f "$fname" ]; then
20
            log_end_msg 0
21
            log_warning_msg "Config $fname not there, will not run."
22
            exit 0
23
        fi
24
    done
25 25
}
26 26

  
27 27
case "$1" in
28
  start)
29
	log_begin_msg "Starting $DESC..."
30
	check_config
31
	start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1
32
	log_end_msg 0
33
	;;
34
  stop)
35
	log_begin_msg "Stopping $DESC..."
36
	start-stop-daemon --stop --quiet --name $NAME || log_end_msg 1
37
	log_end_msg 0
38
	;;
39
  restart|force-reload)
40
	log_begin_msg "Reloading $DESC..."
41
	start-stop-daemon --stop --quiet --oknodo --retry 30 --name $NAME
42
	check_config
43
	start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1
44
	log_end_msg 0
45
	;;
46
  *)
47
	log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}"
48
	exit 1
49
	;;
28
    start)
29
        log_begin_msg "Starting $DESC..."
30
        check_config
31
        start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1
32
        log_end_msg 0
33
    ;;
34
    stop)
35
        log_begin_msg "Stopping $DESC..."
36
        start-stop-daemon --stop --quiet --name $NAME || log_end_msg 1
37
        log_end_msg 0
38
    ;;
39
    restart|force-reload)
40
        log_begin_msg "Reloading $DESC..."
41
        start-stop-daemon --stop --quiet --oknodo --retry 30 --name $NAME
42
        check_config
43
        start-stop-daemon --start --quiet --exec $DAEMON || log_end_msg 1
44
        log_end_msg 0
45
    ;;
46
    *)
47
        log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}"
48
        exit 1
49
    ;;
50 50
esac
51 51

  
52 52
exit 0
53

  
54
# vim: set sw=4 sts=4 et foldmethod=marker :
b/tools/lvmstrap
376 376
  for name in os.listdir("/sys/block"):
377 377
    if (not name.startswith("hd") and
378 378
        not name.startswith("sd") and
379
	not name.startswith("ubd")):
379
        not name.startswith("ubd")):
380 380
      continue
381 381

  
382 382
    size = ReadSize("/sys/block/%s" % name)

Also available in: Unified diff