diff options
| author | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-09-03 00:12:54 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-09-03 00:12:54 -0700 |
| commit | b333090284a5e2b763ea55678429808d96abb1cc (patch) | |
| tree | c1386f7c9655d492e1575aeb3d07309d4dc3f925 | |
| parent | dd8c1d1bc45dc1249a3c1372f6e51a0afe443d0a (diff) | |
| parent | 03e2ae4a4237c200f5960845abf56df63239c0f9 (diff) | |
merged server.py change from orm branch
| -rw-r--r-- | nova/server.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/nova/server.py b/nova/server.py index 8cc1e0ffa..d4563bfe0 100644 --- a/nova/server.py +++ b/nova/server.py @@ -17,11 +17,11 @@ # under the License. """ -Base functionality for nova services - gradually being replaced with twistd.py. +Base functionality for nova daemons - gradually being replaced with twistd.py. """ -import service -from service import pidlockfile +import daemon +from daemon import pidlockfile import logging import logging.handlers import os @@ -33,14 +33,14 @@ from nova import flags FLAGS = flags.FLAGS -flags.DEFINE_bool('serviceize', False, 'serviceize this process') -# NOTE(termie): right now I am defaulting to using syslog when we serviceize +flags.DEFINE_bool('daemonize', False, 'daemonize this process') +# NOTE(termie): right now I am defaulting to using syslog when we daemonize # it may be better to do something else -shrug- # NOTE(Devin): I think we should let each process have its own log file # and put it in /var/logs/nova/(appname).log # This makes debugging much easier and cuts down on sys log # clutter. -flags.DEFINE_bool('use_syslog', True, 'output to syslog when serviceizing') +flags.DEFINE_bool('use_syslog', True, 'output to syslog when daemonizing') flags.DEFINE_string('logfile', None, 'log file to output to') flags.DEFINE_string('pidfile', None, 'pid file to output to') flags.DEFINE_string('working_directory', './', 'working directory...') @@ -50,17 +50,17 @@ flags.DEFINE_integer('gid', os.getgid(), 'gid under which to run') def stop(pidfile): """ - Stop the service + Stop the daemon """ # Get the pid from the pidfile try: pid = int(open(pidfile,'r').read().strip()) except IOError: - message = "pidfile %s does not exist. Service not running?\n" + message = "pidfile %s does not exist. Daemon not running?\n" sys.stderr.write(message % pidfile) return # not an error in a restart - # Try killing the service process + # Try killing the daemon process try: while 1: os.kill(pid, signal.SIGTERM) @@ -100,13 +100,13 @@ def serve(name, main): else: print 'usage: %s [options] [start|stop|restart]' % argv[0] sys.exit(1) - serviceize(argv, name, main) + daemonize(argv, name, main) -def serviceize(args, name, main): - """Does the work of serviceizing the process""" +def daemonize(args, name, main): + """Does the work of daemonizing the process""" logging.getLogger('amqplib').setLevel(logging.WARN) - if FLAGS.serviceize: + if FLAGS.daemonize: logger = logging.getLogger() formatter = logging.Formatter( name + '(%(name)s): %(levelname)s %(message)s') @@ -129,8 +129,8 @@ def serviceize(args, name, main): else: logging.getLogger().setLevel(logging.WARNING) - with service.ServiceContext( - detach_process=FLAGS.serviceize, + with daemon.DaemonContext( + detach_process=FLAGS.daemonize, working_directory=FLAGS.working_directory, pidfile=pidlockfile.TimeoutPIDLockFile(FLAGS.pidfile, acquire_timeout=1, |
