Checkpoint changes to build the upstart conf files
This commit is contained in:
parent
18a9617940
commit
191cb45402
@ -34,6 +34,12 @@ rabbit_host = ${RABBIT_HOST:-$(host:ip)}
|
|||||||
# Sys log enabled or not
|
# Sys log enabled or not
|
||||||
syslog = 0
|
syslog = 0
|
||||||
|
|
||||||
|
# These flags are used for starting components under upstart
|
||||||
|
[upstart]
|
||||||
|
respawn = 1
|
||||||
|
start_event = nova_start
|
||||||
|
stop_event = nova_stop
|
||||||
|
|
||||||
[host]
|
[host]
|
||||||
|
|
||||||
# Set api host endpoint
|
# Set api host endpoint
|
||||||
@ -71,6 +77,7 @@ admin_user = admin
|
|||||||
|
|
||||||
# Should nova be in verbose mode?
|
# Should nova be in verbose mode?
|
||||||
verbose = ${NOVA_VERBOSE:-1}
|
verbose = ${NOVA_VERBOSE:-1}
|
||||||
|
logdir = ${NOVA_LOGDIR:-/var/log/nova}
|
||||||
|
|
||||||
# Allow the admin api to be accessible?
|
# Allow the admin api to be accessible?
|
||||||
allow_admin_api = 1
|
allow_admin_api = 1
|
||||||
|
11
conf/templates/general/upstart.conf.tpl
Normal file
11
conf/templates/general/upstart.conf.tpl
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# This is a primative starting point for generic upstart configuration files
|
||||||
|
# for various nova components.
|
||||||
|
author "DevstackPy"
|
||||||
|
description "This is the upstart file for %IMAGE%"
|
||||||
|
|
||||||
|
start on %START_EVENT%
|
||||||
|
stop on %STOP_EVENT%
|
||||||
|
|
||||||
|
%RESPAWN%
|
||||||
|
|
||||||
|
exec python %BINDIR%/%IMAGE% --flagfile %CFGFILE%
|
@ -39,8 +39,10 @@ LOG = logging.getLogger('devstack.components.nova')
|
|||||||
#special generated conf
|
#special generated conf
|
||||||
API_CONF = 'nova.conf'
|
API_CONF = 'nova.conf'
|
||||||
|
|
||||||
|
UPSTART_CONF_TMPL = 'upstart.conf'
|
||||||
#normal conf
|
#normal conf
|
||||||
PASTE_CONF = 'nova-api-paste.ini'
|
PASTE_CONF = 'nova-api-paste.ini'
|
||||||
|
|
||||||
CONFIGS = [PASTE_CONF]
|
CONFIGS = [PASTE_CONF]
|
||||||
|
|
||||||
#this db will be dropped then created
|
#this db will be dropped then created
|
||||||
@ -142,7 +144,7 @@ APP_OPTIONS = {
|
|||||||
'nova-scheduler': ['--flagfile', '%CFGFILE%'],
|
'nova-scheduler': ['--flagfile', '%CFGFILE%'],
|
||||||
'nova-cert': ['--flagfile', '%CFGFILE%'],
|
'nova-cert': ['--flagfile', '%CFGFILE%'],
|
||||||
'nova-objectstore': ['--flagfile', '%CFGFILE%'],
|
'nova-objectstore': ['--flagfile', '%CFGFILE%'],
|
||||||
'nova-consoleauth': [],
|
'nova-consoleauth': ['--flagfile', '%CFGFILE%'],
|
||||||
'nova-xvpvncproxy': ['--flagfile', '%CFGFILE%'],
|
'nova-xvpvncproxy': ['--flagfile', '%CFGFILE%'],
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +277,14 @@ class NovaInstaller(comp.PythonInstallComponent):
|
|||||||
def _get_symlinks(self):
|
def _get_symlinks(self):
|
||||||
links = dict()
|
links = dict()
|
||||||
for fn in self._get_config_files():
|
for fn in self._get_config_files():
|
||||||
|
LOG.info("getting symlink for fn:%s" % (fn))
|
||||||
source_fn = self._get_target_config_name(fn)
|
source_fn = self._get_target_config_name(fn)
|
||||||
|
LOG.info("symlink for source_fn:%s" % (source_fn))
|
||||||
|
# Anything in APP_OPTIONS is actually an upstart config
|
||||||
|
# and will go into /etc/init
|
||||||
|
if fn in APP_OPTIONS:
|
||||||
|
links[source_fn] = sh.joinpths("/", "etc", "init", fn + ".conf")
|
||||||
|
else:
|
||||||
links[source_fn] = sh.joinpths("/", "etc", "nova", fn)
|
links[source_fn] = sh.joinpths("/", "etc", "nova", fn)
|
||||||
source_fn = sh.joinpths(self.cfgdir, API_CONF)
|
source_fn = sh.joinpths(self.cfgdir, API_CONF)
|
||||||
links[source_fn] = sh.joinpths("/", "etc", "nova", API_CONF)
|
links[source_fn] = sh.joinpths("/", "etc", "nova", API_CONF)
|
||||||
@ -297,7 +306,9 @@ class NovaInstaller(comp.PythonInstallComponent):
|
|||||||
self.cfg.get("passwords", pw_key)
|
self.cfg.get("passwords", pw_key)
|
||||||
|
|
||||||
def _get_config_files(self):
|
def _get_config_files(self):
|
||||||
return list(CONFIGS)
|
# We'll include the keys from APP_OPTIONS since we want to create
|
||||||
|
# upstart config files for those.
|
||||||
|
return CONFIGS + APP_OPTIONS.keys()
|
||||||
|
|
||||||
def _setup_network(self):
|
def _setup_network(self):
|
||||||
LOG.info("Creating your nova network to be used with instances.")
|
LOG.info("Creating your nova network to be used with instances.")
|
||||||
@ -385,10 +396,44 @@ class NovaInstaller(comp.PythonInstallComponent):
|
|||||||
srcfn = sh.joinpths(self.appdir, "etc", "nova", 'api-paste.ini')
|
srcfn = sh.joinpths(self.appdir, "etc", "nova", 'api-paste.ini')
|
||||||
contents = sh.load_file(srcfn)
|
contents = sh.load_file(srcfn)
|
||||||
return (srcfn, contents)
|
return (srcfn, contents)
|
||||||
|
elif config_fn in APP_OPTIONS:
|
||||||
|
# This is one of the upstart configs, use our general template
|
||||||
|
# for the source
|
||||||
|
LOG.info("Loading upstart template to be used by:%s" % (config_fn))
|
||||||
|
(_, contents) = utils.load_template('general', UPSTART_CONF_TMPL)
|
||||||
|
return (config_fn, contents)
|
||||||
else:
|
else:
|
||||||
|
# It's not an upstart config, just do what we used to do
|
||||||
return comp.PythonInstallComponent._get_source_config(self, config_fn)
|
return comp.PythonInstallComponent._get_source_config(self, config_fn)
|
||||||
|
|
||||||
|
def _get_target_config_name(self, config_fn):
|
||||||
|
if config_fn in APP_OPTIONS:
|
||||||
|
# This is one of the upstart configs. It'll eventually get
|
||||||
|
# symlinked to /etc/init. Use the APP_OPTIONS key as the base filename
|
||||||
|
result = sh.joinpths(self.cfgdir, config_fn + ".conf")
|
||||||
|
LOG.info("Generated upstart config name:%s" % (result))
|
||||||
|
return result
|
||||||
|
else:
|
||||||
|
# It's not an upstart config, just do what we used to do
|
||||||
|
return comp.PkgInstallComponent._get_target_config_name(self, config_fn)
|
||||||
|
|
||||||
def _get_param_map(self, config_fn):
|
def _get_param_map(self, config_fn):
|
||||||
|
if config_fn in APP_OPTIONS:
|
||||||
|
# We're processing an upstart config file. We'll need to set
|
||||||
|
# specific values from the general upstart config template
|
||||||
|
LOG.info("Returning parms for update config:%s" % (config_fn))
|
||||||
|
params = dict()
|
||||||
|
params['CFGFILE'] = sh.joinpths(self.cfgdir, API_CONF)
|
||||||
|
params['BINDIR'] = self.bindir
|
||||||
|
params['IMAGE'] = config_fn
|
||||||
|
if self.cfg.get('upstart', 'respawn'):
|
||||||
|
params['RESPAWN'] = "respawn"
|
||||||
|
else:
|
||||||
|
params['RESPAWN'] = ""
|
||||||
|
params['START_EVENT'] = self.cfg.get('upstart', 'start_event')
|
||||||
|
params['STOP_EVENT'] = self.cfg.get('upstart', 'stop_event')
|
||||||
|
return params
|
||||||
|
else:
|
||||||
return keystone.get_shared_params(self.cfg)
|
return keystone.get_shared_params(self.cfg)
|
||||||
|
|
||||||
def configure(self):
|
def configure(self):
|
||||||
@ -547,6 +592,14 @@ class NovaConfConfigurator(object):
|
|||||||
#verbose on?
|
#verbose on?
|
||||||
if self._getbool('verbose'):
|
if self._getbool('verbose'):
|
||||||
nova_conf.add_simple('verbose')
|
nova_conf.add_simple('verbose')
|
||||||
|
# Check if we have a logdir specified. If we do, we'll make
|
||||||
|
# sure that it exists. We will *not* use tracewrite because we
|
||||||
|
# don't want to lose the logs when we uninstall
|
||||||
|
logdir = self._getstr('logdir', '/var/log/nova')
|
||||||
|
if logdir:
|
||||||
|
LOG.info("Making sure that logdir exists:%s" % logdir)
|
||||||
|
nova_conf.add('logdir', logdir)
|
||||||
|
sh.mkdir(logdir, True)
|
||||||
|
|
||||||
#allow the admin api?
|
#allow the admin api?
|
||||||
if self._getbool('allow_admin_api'):
|
if self._getbool('allow_admin_api'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user