Add option to use qpid.

Change-Id: If7965d3b7b21ce42e5997c851d9c67cc0ca4fa6f
This commit is contained in:
Joshua Harlow
2013-08-06 12:23:06 -07:00
parent 9c59fe3a39
commit da07a20fa6
10 changed files with 200 additions and 56 deletions

View File

@@ -23,7 +23,6 @@ from anvil import utils
from anvil.components.helpers import db as dbhelper
from anvil.components.helpers import keystone as khelper
from anvil.components.helpers import rabbit as rhelper
class Configurator(object):
@@ -76,21 +75,26 @@ class Configurator(object):
def target_config(self, config_fn):
return sh.joinpths(self.installer.cfg_dir, config_fn)
def setup_rpc(self, conf, rpc_backend=None):
def setup_rpc(self, conf, rpc_backend=None, mq_type=None):
# How is your message queue setup?
mq_type = utils.canon_mq_type(self.installer.get_option('mq-type'))
if not mq_type:
raw_mq_type = self.installer.get_option('mq-type')
if raw_mq_type:
mq_type = utils.canon_mq_type(raw_mq_type)
if rpc_backend:
conf.add('rpc_backend', rpc_backend)
if mq_type == 'rabbit':
conf.add(
'rabbit_host',
self.installer.get_option(
'rabbit', 'host',
default_value=self.installer.get_option('ip')))
conf.add('rabbit_password',
rhelper.get_shared_passwords(self.installer)['pw'])
conf.add('rabbit_userid',
self.installer.get_option('rabbit', 'user_id'))
if rpc_backend:
conf.add('rpc_backend', rpc_backend)
conf.add('rabbit_host',
self.installer.get_option('rabbit', 'host',
default_value=self.installer.get_option('ip')))
conf.add('rabbit_password', self.installer.get_password('rabbit'))
conf.add('rabbit_userid', self.installer.get_option('rabbit', 'user_id'))
if mq_type == 'qpid':
conf.add('qpid_hostname',
self.installer.get_option('qpid', 'host',
default_value=self.installer.get_option('ip')))
conf.add('qpid_password', self.installer.get_password('qpid'))
conf.add('qpid_username', self.installer.get_option('qpid', 'user_id'))
def fetch_dbdsn(self):
return dbhelper.fetch_dbdsn(

View File

@@ -29,6 +29,10 @@ PASTE_CONF = 'nova-api-paste.ini'
POLICY_CONF = 'policy.json'
LOGGING_CONF = "logging.conf"
CONFIGS = [PASTE_CONF, POLICY_CONF, LOGGING_CONF, API_CONF]
MQ_BACKEND = {
'qpid': 'nova.rpc.impl_qpid',
'rabbit': 'nova.rpc.impl_kombu',
}
LOG = logging.getLogger(__name__)
@@ -89,6 +93,7 @@ class NovaConfigurator(base.Configurator):
# The ip of where we are running
nova_conf.add('my_ip', hostip)
# Setup how the database will be connected.
nova_conf.add('sql_connection', self.fetch_dbdsn())
# Configure anything libvirt related?
@@ -138,7 +143,13 @@ class NovaConfigurator(base.Configurator):
nova_conf.add('s3_host', hostip)
# How is your message queue setup?
self.setup_rpc(nova_conf, 'nova.rpc.impl_kombu')
raw_mq_type = self.installer.get_option('mq-type')
if not raw_mq_type:
raise exceptions.ConfigException("Nova requires a message queue to operate, "
"please specify a 'mq-type' in configuration.")
mq_type = utils.canon_mq_type(raw_mq_type)
rpc_backend = MQ_BACKEND.get(mq_type, 'nova.rpc.impl_kombu')
self.setup_rpc(nova_conf, rpc_backend=rpc_backend, mq_type=mq_type)
# The USB tablet device is meant to improve mouse behavior in
# the VNC console, but it has the side effect of increasing