More fixups to get it to work.

This commit is contained in:
Joshua Harlow 2012-02-24 14:15:04 -08:00
parent e06e0ce626
commit 6e2b534ea7
6 changed files with 26 additions and 14 deletions

View File

@ -116,7 +116,7 @@ class HorizonInstaller(comp.PythonInstallComponent):
links[source_fn] = sh.joinpths("/", "etc", "horizon", fn)
src = self._get_target_config_name(HORIZON_APACHE_CONF)
links[src] = APACHE_CONF_TARGETS[self.distro]
if settings.QUANTUM_CLIENT in self.instances:
if utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False):
#TODO remove this junk, blah, puke that we have to do this
qc = self.instances[settings.QUANTUM_CLIENT]
src_pth = sh.joinpths(qc.appdir, 'quantum')
@ -171,7 +171,7 @@ class HorizonInstaller(comp.PythonInstallComponent):
#Horizon currently imports quantum even if you aren't using it.
#Instead of installing quantum we can create a simple module
#that will pass the initial imports.
if settings.QUANTUM_CLIENT in self.instances:
if utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False):
return
else:
#Make the fake quantum
@ -256,7 +256,7 @@ class HorizonInstaller(comp.PythonInstallComponent):
mp['ERROR_LOG'] = sh.joinpths(self.log_dir, "error.log")
else:
#Enable quantum in dashboard, if requested
mp['QUANTUM_ENABLED'] = "%s" % (settings.QUANTUM_CLIENT in self.instances)
mp['QUANTUM_ENABLED'] = "%s" % (utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False))
mp['OPENSTACK_HOST'] = self.cfg.get('host', 'ip')
return mp

View File

@ -180,9 +180,9 @@ class KeystoneInstaller(comp.PythonInstallComponent):
#nothing modified so just return the original
elif name == CATALOG_CONF:
nlines = list()
if settings.SWIFT in self.instances or not self.instances:
if utils.service_enabled(settings.SWIFT, self.instances):
nlines.extend(SWIFT_TEMPL_ADDS)
if settings.QUANTUM in self.instances or not self.instances:
if utils.service_enabled(settings.QUANTUM, self.instances):
nlines.extend(QUANTUM_TEMPL_ADDS)
if nlines:
nlines.insert(0, "")

View File

@ -318,7 +318,7 @@ class NovaInstaller(comp.PythonInstallComponent):
mp['TEST_FLOATING_POOL'] = self.cfg.get('nova', 'test_floating_pool')
mp['FIXED_NETWORK_SIZE'] = self.cfg.get('nova', 'fixed_network_size')
mp['FIXED_RANGE'] = self.cfg.get('nova', 'fixed_range')
if settings.QUANTUM in self.instances:
if utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False):
cmds = NETWORK_SETUP_CMDS[0:1]
else:
cmds = NETWORK_SETUP_CMDS
@ -370,7 +370,7 @@ class NovaInstaller(comp.PythonInstallComponent):
def _config_adjust(self, contents, config_fn):
if config_fn not in ADJUST_CONFIGS:
return contents
if config_fn == PASTE_CONF and settings.KEYSTONE in self.instances:
if config_fn == PASTE_CONF and utils.service_enabled(settings.KEYSTONE, self.instances, False):
newcontents = contents
with io.BytesIO(contents) as stream:
config = cfg.IgnoreMissingConfigParser()
@ -401,7 +401,10 @@ class NovaInstaller(comp.PythonInstallComponent):
return (srcfn, contents)
def _get_param_map(self, config_fn):
return keystone.get_shared_params(self.cfg)
mp = keystone.get_shared_params(self.cfg)
mp['SERVICE_PASSWORD'] = "???"
mp['SERVICE_USER'] = "???"
return mp
def configure(self):
configs_made = comp.PythonInstallComponent.configure(self)
@ -540,7 +543,7 @@ class NovaConfConfigurator(object):
self.cfgdir = ni.cfgdir
self.xvnc_enabled = ni.xvnc_enabled
self.volumes_enabled = ni.volumes_enabled
self.novnc_enabled = settings.NOVNC in self.instances
self.novnc_enabled = utils.service_enabled(settings.NOVNC, self.instances)
def _getbool(self, name):
return self.cfg.getboolean('nova', name)
@ -705,7 +708,7 @@ class NovaConfConfigurator(object):
nova_conf.add('iscsi_help', 'tgtadm')
def _configure_network_settings(self, nova_conf):
if settings.QUANTUM in self.instances:
if utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False):
nova_conf.add('network_manager', QUANTUM_MANAGER)
nova_conf.add('quantum_connection_host', self.cfg.get('quantum', 'q_host'))
nova_conf.add('quantum_connection_port', self.cfg.get('quantum', 'q_port'))
@ -715,7 +718,7 @@ class NovaConfConfigurator(object):
nova_conf.add_simple(key)
else:
nova_conf.add(key, value)
if settings.MELANGE_CLIENT in self.instances:
if utils.service_enabled(settings.MELANGE_CLIENT, self.instances, False):
nova_conf.add('quantum_ipam_lib', QUANTUM_IPAM_LIB)
nova_conf.add_simple('use_melange_mac_generation')
nova_conf.add('melange_host', self.cfg.get('melange', 'm_host'))

View File

@ -18,6 +18,7 @@ from devstack import component as comp
from devstack import log as logging
from devstack import settings
from devstack import shell as sh
from devstack import utils
from devstack.components import nova
@ -84,9 +85,9 @@ class NoVNCRuntime(comp.ProgramRuntime):
def _get_param_map(self, app_name):
root_params = comp.ProgramRuntime._get_param_map(self, app_name)
if app_name == VNC_PROXY_APP and settings.NOVA in self.instances:
nova_runtime = self.instances.get(settings.NOVA)
if app_name == VNC_PROXY_APP and utils.service_enabled(settings.NOVA, self.instances, False):
#have to reach into the nova conf (puke)
nova_runtime = self.instances[settings.NOVA]
root_params['NOVA_CONF'] = sh.joinpths(nova_runtime.cfgdir, nova.API_CONF)
return root_params

View File

@ -198,7 +198,7 @@ class QuantumInstaller(comp.PkgInstallComponent):
def post_install(self):
comp.PkgInstallComponent.post_install(self)
if self.q_vswitch_service and settings.DB in self.instances:
if self.q_vswitch_service and utils.service_enabled(settings.DB, self.instances, False):
self._setup_db()
if self.q_vswitch_agent:
self._setup_bridge()

View File

@ -304,6 +304,14 @@ def joinlinesep(*pieces):
return os.linesep.join(pieces)
def service_enabled(name, components, empty_true=True):
if not components and empty_true:
return True
if name in components:
return True
return False
def param_replace(text, replacements, ignore_missing=False):
if not replacements: