New config strategy to adapt to oslo-messaging

* Extract and remove --config-file amqp_openstack.conf(or
  amqp-openstack-neutron and --config-file amqp-powervc.conf from sys.argv to
  create 2 AMQP cfg.ConfigOpts objects without conflicting with other options
  parsing as before, particularly those OpenStack AMQP configurations in
  [DEFAULT] section of nova.conf, cinder.conf.

* adapt all affected code to the new config strategy

Implements: blueprint
https://blueprints.launchpad.net/powervc-driver/+spec/new-configuration-strategy-needed-to-adapt-to-oslo-messaging

Closes-Bug: 1356225
Change-Id: I61a4fd0c28148e31a8cb85acea3793f40028dfb4
This commit is contained in:
Le Tian Ren 2014-08-25 18:46:04 +08:00
parent faba4c3767
commit 05a8443e12
15 changed files with 552 additions and 107 deletions

View File

@ -24,6 +24,10 @@ from cinder.openstack.common import gettextutils
# This should go in the base __init__ folder I think
gettextutils.install('cinder')
# NOTE: Import powervc driver common config at the very beginning to parse
# AMQP.
from powervc.common import config
from cinder import utils
from cinder.openstack.common import log as logging
# Currently cinder service uses threading instead of eventlet's event,
@ -40,7 +44,6 @@ nova_common.log = logging
from nova.openstack.common import service
from cinder.common import config as cinder_config
from powervc.common import config
# NOTE: parse config before import manager
config.parse_power_config(sys.argv, 'cinder')
@ -60,7 +63,7 @@ if __name__ == '__main__':
LOG.info(_('Launching PowerVC Driver StorageManager service...'))
launcher = service.ServiceLauncher()
launcher.launch_service(manager.PowerVCCinderManager())
launcher.wait()
launcher.wait()
LOG.info(_('PowerVC Driver StorageManager service ended'))
except Exception:
traceback.print_exc()

View File

@ -0,0 +1,148 @@
[DEFAULT]
###############################################################################
# Transport options
#
# A URL representing the messaging driver to use and its full configuration. If
# not set, we fall back to the rpc_backend option and driver specific
# configuration.
# e.g. rabbit://me:passwd@host:5672/virtual_host
# transport_url=
# The messaging driver to use, defaults to rabbit. Other drivers include qpid
# and zmq
# rpc_backend=rabbit
# The default exchange under which topics are scoped. May be overridden by an
# exchange name specified in the tranport_url option
# control_exchange=openstack
###############################################################################
# AMQP options
#
# User durable queues in amqp
# amqp_durable_queues=False
# Auto-delete queues in amqp
# amqp_auto_delete=False
# Size of RPC connection pool
# rpc_conn_pool_size=30
# Seconds to wait for a response from a call
# rpc_response_timeout=60
###############################################################################
# Notification options
#
# Driver or drivers to handle sending notifications
# notification_driver=[]
# AMQP topic used for OpenStack notifications
# notification_topics=['notifications', ]
###############################################################################
# Eventlet options
#
# Size of RPC greenthread pool
# rpc_thread_pool_size=64
###############################################################################
# Qpid driver configuration
#
# Qpid broker hostname
# qpid_hostname=localhost
# Qpid broker port
# qpid_port=5672
# Qpid HA cluster host:port pairs
# qpid_hosts=['$qpid_hostname:$qpid_port']
# Username for Qpid connection
# qpid_username=
# Password for Qpid connection
# qpid_password=
# Space separted list of SASL mechanisms to use for auth
# qpid_sasl_mechanisms=
# Seconds between connection keepalive heartbeats
# qpid_heartbeat=60
# Transport to use either 'tcp' or 'ssl'
# qpid_protocol=tcp
# Whether to disable the Nagle algorithm
#qpid_tcp_nodelay=True
# The Qpid topology verson to use. Version 1 is what was originally used by
# impl_qpid. Version 2 includes some backwards-incompatible changes that allow
# broker federation to work. Users should update to version 2 when they are
# able to take everything down, as it requires a clean break.
# qpid_topology_version=1
###############################################################################
# RabbitMQ driver configuration
#
# SSL version to use (valid only if SSL enabled), valid values are TLSv1,
# SSLv23 and SSLv3. SSLv2 may be avialable on some distributions.
# kombu_ssl_version=
# SSL key file (valid only if SSL enabled)
# kombu_ssl_keyfile=
# SSL cert file (valid only if SSL enabled)
# kombu_ssl_certfile=
# SSL certificaiton authority file (valid only if SSL enabled)
# kombu_ssl_ca_certs
# How long to wait before reconnectin in response to an AMPQ consumer cancel
# notification
# kombu_reconnect_delay=1.0
# The RabbitMQ broker address where a single node is used
# rabbit_host=localhost
# The RabbitMQ broker port where a single node is used
# rabbit_port=5672
# RabbitMQ HA cluster host:port pairs
# rabbit_hosts=['$rabbit_host:$rabbit_port']
# Connect over SSL for RabbitMQ
# rabbit_use_ssl=False
# The RabbitMQ userid
# rabbit_userid=guest
# The RabbitMQ password
# rabbit_password=guest
# The RabbitMQ login method
# rabbit_login_method=AMQPLAIN
# The RabbitMQ virtual host
# rabbit_virtual_host=/
# How frequently to retry connecting with RabbitMQ
# rabbit_retry_interval=1
# How long to backoff for between retries when connection to RabbitMQ
# rabbit_retry_backoff=2
# Maximum nubmer of RabbitMQ connection retries. Default is 0 (infinite retry
# count)
# rabbit_max_retries=0
# Use HA queues in RabbitMQ (x-ha-policy: all). If you change this option, you
# must wipe the RabbitMQ database
# rabbit_ha_queues=False
# If passed, use a fake RabbitMQ provider
# fake_rabbit=False
###############################################################################
# ZeroMQ driver configuration(Not supported yet)

View File

@ -0,0 +1,148 @@
[DEFAULT]
###############################################################################
# Transport options
#
# A URL representing the messaging driver to use and its full configuration. If
# not set, we fall back to the rpc_backend option and driver specific
# configuration.
# e.g. rabbit://me:passwd@host:5672/virtual_host
# transport_url=
# The messaging driver to use, defaults to rabbit. Other drivers include qpid
# and zmq
# rpc_backend=rabbit
# The default exchange under which topics are scoped. May be overridden by an
# exchange name specified in the tranport_url option
# control_exchange=openstack
###############################################################################
# AMQP options
#
# User durable queues in amqp
# amqp_durable_queues=False
# Auto-delete queues in amqp
# amqp_auto_delete=False
# Size of RPC connection pool
# rpc_conn_pool_size=30
# Seconds to wait for a response from a call
# rpc_response_timeout=60
###############################################################################
# Notification options
#
# Driver or drivers to handle sending notifications
# notification_driver=[]
# AMQP topic used for OpenStack notifications
# notification_topics=['notifications', ]
###############################################################################
# Eventlet options
#
# Size of RPC greenthread pool
# rpc_thread_pool_size=64
###############################################################################
# Qpid driver configuration
#
# Qpid broker hostname
# qpid_hostname=localhost
# Qpid broker port
# qpid_port=5672
# Qpid HA cluster host:port pairs
# qpid_hosts=['$qpid_hostname:$qpid_port']
# Username for Qpid connection
# qpid_username=
# Password for Qpid connection
# qpid_password=
# Space separted list of SASL mechanisms to use for auth
# qpid_sasl_mechanisms=
# Seconds between connection keepalive heartbeats
# qpid_heartbeat=60
# Transport to use either 'tcp' or 'ssl'
# qpid_protocol=tcp
# Whether to disable the Nagle algorithm
#qpid_tcp_nodelay=True
# The Qpid topology verson to use. Version 1 is what was originally used by
# impl_qpid. Version 2 includes some backwards-incompatible changes that allow
# broker federation to work. Users should update to version 2 when they are
# able to take everything down, as it requires a clean break.
# qpid_topology_version=1
###############################################################################
# RabbitMQ driver configuration
#
# SSL version to use (valid only if SSL enabled), valid values are TLSv1,
# SSLv23 and SSLv3. SSLv2 may be avialable on some distributions.
# kombu_ssl_version=
# SSL key file (valid only if SSL enabled)
# kombu_ssl_keyfile=
# SSL cert file (valid only if SSL enabled)
# kombu_ssl_certfile=
# SSL certificaiton authority file (valid only if SSL enabled)
# kombu_ssl_ca_certs
# How long to wait before reconnectin in response to an AMPQ consumer cancel
# notification
# kombu_reconnect_delay=1.0
# The RabbitMQ broker address where a single node is used
# rabbit_host=localhost
# The RabbitMQ broker port where a single node is used
# rabbit_port=5672
# RabbitMQ HA cluster host:port pairs
# rabbit_hosts=['$rabbit_host:$rabbit_port']
# Connect over SSL for RabbitMQ
# rabbit_use_ssl=False
# The RabbitMQ userid
# rabbit_userid=guest
# The RabbitMQ password
# rabbit_password=guest
# The RabbitMQ login method
# rabbit_login_method=AMQPLAIN
# The RabbitMQ virtual host
# rabbit_virtual_host=/
# How frequently to retry connecting with RabbitMQ
# rabbit_retry_interval=1
# How long to backoff for between retries when connection to RabbitMQ
# rabbit_retry_backoff=2
# Maximum nubmer of RabbitMQ connection retries. Default is 0 (infinite retry
# count)
# rabbit_max_retries=0
# Use HA queues in RabbitMQ (x-ha-policy: all). If you change this option, you
# must wipe the RabbitMQ database
# rabbit_ha_queues=False
# If passed, use a fake RabbitMQ provider
# fake_rabbit=False
###############################################################################
# ZeroMQ driver configuration(Not supported yet)

View File

@ -50,25 +50,6 @@ keystone_max_try_times = 30
# The interval in seconds to retry the keystone service
keystone_retry_interval = 2
#
# Qpid connection information
#
# Qpid broker hostname (string value)
qpid_hostname =
# Qpid broker port (integer value)
qpid_port = 5672
# Username for qpid connection (string value)
qpid_username =
# Password for qpid connection (string value)
qpid_password =
# Transport to use, either 'tcp'(default) or 'ssl'
qpid_protocol = tcp
[powervc]
# Full class name for the manager for PowerVC Manager Service (string value)
@ -125,38 +106,7 @@ expiration_stale_duration = 3600
# Note: The value of this property must exactly match the value as specified on the
# PowerVC server, including case, punctuation, and spaces.
storage_connectivity_group = Any host, all VIOS
#storage_connectivity_group =
#
# Qpid connection information for PowerVC
#
# Qpid broker hostname (string value)
# INPUT REQUIRED
# Change 'host' to the hostname of the PowerVC system
qpid_hostname = host
# Qpid broker port (integer value)
# uncomment following line for non-ssl
# qpid_port = 5672
qpid_port = 5671
# Username for qpid connection (string value)
qpid_username = powervc_qpid
# Password for qpid connection (string value)
# INPUT REQUIRED
# Provide the qpid connection password from the PowerVC system
# by using the cat command on the pw.file in the directory where
# PowerVC is installed (e.g. cat /opt/ibm/powervc/data/pw.file)
qpid_password =
# Transport to use, either 'tcp'(default) or 'ssl'
# uncomment following line for non-ssl
# qpid_protocol = tcp
qpid_protocol = ssl
#storage_connectivity_group =
#
# Sync variables

View File

@ -1,17 +1,60 @@
# Copyright 2013 IBM Corp.
# Copyright 2013, 2014 IBM Corp.
"""Config file utility
"""
import constants
import os
import sys
from powervc.common import constants
from oslo.config import cfg
if 'powervc' in sys.argv[0]:
# Extract and remove --config-file amqp_openstack.conf and --config-file
# amqp-powervc.conf from sys.argv to create 2 AMQP cfg.ConfigOpts objects
# without conflicting with other options parsing as before, particularly
# those OpenStack AMQP configurations in [DEFAULT] section of nova.conf,
# cinder.conf.
argv = sys.argv[1:]
argv1 = None
argv2 = None
argv1_index = -1
argv2_index = -1
for i in range(len(argv)):
if argv[i] == '--config-file':
# for amqp-openstack.conf or amqp-openstack-neutron.conf
if 'amqp-openstack' in os.path.basename(argv[i+1]):
argv1 = argv[i:i+2]
argv1_index = i+1
elif os.path.basename(argv[i+1]) == 'amqp-powervc.conf':
argv2 = argv[i:i+2]
argv2_index = i+1
if argv1 is None or argv2 is None:
sys.exit("Invalid configuration: amqp-powervc.conf and"
+ " amqp-openstack.conf(or openstack-neutron.conf)"
+ " are required.")
else:
sys.argv = (sys.argv[:argv1_index]
+ sys.argv[argv1_index+2:argv2_index]
+ sys.argv[argv2_index+2:])
AMQP_OPENSTACK_CONF = cfg.ConfigOpts()
AMQP_POWERVC_CONF = cfg.ConfigOpts()
AMQP_OPENSTACK_CONF(args=argv1)
AMQP_POWERVC_CONF(args=argv2)
# print(dict(AMQP_OPENSTACK_CONF))
# print(sys.argv)
from oslo.messaging import transport
trans_os = transport.get_transport(AMQP_OPENSTACK_CONF)
trans_pvc = transport.get_transport(AMQP_POWERVC_CONF)
# print(dict(AMQP_OPENSTACK_CONF))
CONF = cfg.CONF
def parse_power_config(argv, base_project, base_prog=None):
"""
Loads configuration information from powervc.conf as well as a project
"""Loads configuration information from powervc.conf as well as a project
specific file. Expectation is that all powervc config options will be in
the common powervc.conf file and the base_project will represent open stack
component configuration like nova.conf or cinder.conf. A base_prog file
@ -54,12 +97,7 @@ FILE_OPTIONS = {
cfg.StrOpt('region_name', default=None),
cfg.IntOpt('keystone_max_try_times', default=30),
cfg.IntOpt('keystone_retry_interval', default=2),
# Hosting OS Qpid connection info
cfg.StrOpt('qpid_hostname'),
cfg.IntOpt('qpid_port', default=5672),
cfg.StrOpt('qpid_username', default='anonymous'),
cfg.StrOpt('qpid_password', secret=True, default=''),
cfg.StrOpt('qpid_protocol', default='tcp')],
],
'powervc': [
# Keystone info
cfg.StrOpt('auth_url', default='http://localhost:5000/v2.0/'),
@ -72,12 +110,6 @@ FILE_OPTIONS = {
cfg.BoolOpt('http_insecure', default=False),
cfg.StrOpt('keystone_version', default="v3"),
cfg.IntOpt('expiration_stale_duration', default=3600),
# Hosting OS Qpid connection info
cfg.StrOpt('qpid_hostname'),
cfg.IntOpt('qpid_port', default=5672),
cfg.StrOpt('qpid_username', default='anonymous'),
cfg.StrOpt('qpid_password', secret=True, default=''),
cfg.StrOpt('qpid_protocol', default='tcp'),
# manager
cfg.StrOpt('powervc_manager',
default='powervc.compute.manager.PowerVCCloudManager'),

View File

@ -34,23 +34,21 @@ Examples:
conn.start()
"""
import fnmatch
import json
import sys
import threading
import traceback
import fnmatch
import json
from time import sleep
from qpid.messaging import Connection
from qpid.messaging.exceptions import ConnectionError
from oslo.config import cfg
from powervc.common import config
from powervc.common.gettextutils import _
CONF = cfg.CONF
def log(log, level, msg):
"""
@ -223,18 +221,18 @@ class PowerVCConnection(QpidConnection):
:param: log The logging module used for logging messages. If not
provided then no logging will be done.
"""
if CONF.powervc.qpid_protocol == 'ssl':
if config.AMQP_POWERVC_CONF.qpid_protocol == 'ssl':
transport = 'ssl'
else:
transport = 'tcp'
super(PowerVCConnection,
self).__init__('%s:%d' % (CONF.powervc.qpid_hostname,
CONF.powervc.qpid_port),
CONF.powervc.qpid_username,
CONF.powervc.qpid_password,
reconnect_handler=reconnect_handler,
context=context, log=log,
transport=transport)
self).__init__('%s:%d' % (
config.AMQP_POWERVC_CONF.qpid_hostname,
config.AMQP_POWERVC_CONF.qpid_port),
config.AMQP_POWERVC_CONF.qpid_username,
config.AMQP_POWERVC_CONF.qpid_password,
reconnect_handler=reconnect_handler,
context=context, log=log, transport=transport)
class LocalConnection(QpidConnection):
@ -257,18 +255,18 @@ class LocalConnection(QpidConnection):
:param: log The logging module used for logging messages. If not
provided then no logging will be done.
"""
if CONF.openstack.qpid_protocol == 'ssl':
if config.AMQP_OPENSTACK_CONF.qpid_protocol == 'ssl':
transport = 'ssl'
else:
transport = 'tcp'
super(LocalConnection,
self).__init__('%s:%d' % (CONF.openstack.qpid_hostname,
CONF.openstack.qpid_port),
CONF.openstack.qpid_username,
CONF.openstack.qpid_password,
reconnect_handler=reconnect_handler,
context=context, log=log,
transport=transport)
self).__init__('%s:%d' % (
config.AMQP_OPENSTACK_CONF.qpid_hostname,
config.AMQP_OPENSTACK_CONF.qpid_port),
config.AMQP_OPENSTACK_CONF.qpid_username,
config.AMQP_OPENSTACK_CONF.qpid_password,
reconnect_handler=reconnect_handler,
context=context, log=log, transport=transport)
class QpidListener(object):

View File

@ -33,7 +33,8 @@ class PVCConfigTest(testtools.TestCase):
self.assertEqual(config.CONF.powervc.auth_url,
"http://localhost:5000/v2.0/")
# value in file
self.assertEqual(config.CONF.powervc.qpid_port, 5679)
self.assertEqual(config.CONF.powervc.staging_project_name,
"Public")
finally:
p1.stop()
@ -53,7 +54,6 @@ class PVCConfigTest(testtools.TestCase):
p2.start()
config.parse_power_config([], "baseproject", None)
# extend value in second file
self.assertEqual(config.CONF.powervc.qpid_username,
"powervc_qpid_2")
self.assertEqual(config.CONF.powervc.staging_user, "admin")
finally:
p2.stop()

View File

@ -27,19 +27,24 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'powervc', '__init__.py')):
from nova.openstack.common import gettextutils
gettextutils.install('glance')
from powervc.glance.common import config
# NOTE: Import powervc driver common config at the very beginning to parse
# AMQP.
from powervc.common import config
from powervc.glance.common import config as glance_config
from nova.openstack.common import log
from nova.openstack.common import service
from nova.openstack.common import importutils
CONF = config.CONF
CONF = glance_config.CONF
LOG = log.getLogger(__name__)
if __name__ == '__main__':
try:
# Obtain glance opts from glance-api.conf
config.parse_config(sys.argv, 'glance', 'glance-api')
glance_config.parse_config(sys.argv, 'glance', 'glance-api')
log.setup('powervc')
LOG.info(_('Launching PowerVC Driver ImageManager service...'))
manager = importutils.import_object(

View File

@ -13,6 +13,8 @@ import itertools
from operator import itemgetter
import HTMLParser
from powervc.common import config
from nova.openstack.common import service
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
@ -26,10 +28,10 @@ from powervc.common.exception import StorageConnectivityGroupNotFound
from powervc.common.gettextutils import _
from powervc.common.client import factory as clients
from powervc.glance.common import constants
from powervc.glance.common import config
from powervc.glance.common import config as glance_config
from powervc.common import utils
CONF = config.CONF
CONF = glance_config.CONF
LOG = logging.getLogger(__name__)
@ -2326,7 +2328,7 @@ class PowerVCImageManager(service.Service):
# See if the host is specified. If not, do not attempt to connect
# and register the event handler
host = CONF['openstack'].qpid_hostname
host = config.AMQP_OPENSTACK_CONF.qpid_hostname
if host and host is not None:
local_conn = messaging.LocalConnection(
reconnect_handler=local_event_reconnect_handler,
@ -2375,7 +2377,7 @@ class PowerVCImageManager(service.Service):
# See if the host is specified. If not, do not attempt to connect
# and register the event handler
host = CONF['powervc'].qpid_hostname
host = config.AMQP_POWERVC_CONF.qpid_hostname
if host and host is not None:
pvc_conn = messaging.PowerVCConnection(
reconnect_handler=pvc_event_reconnect_handler, log=logging)

View File

@ -15,13 +15,16 @@ os.environ['EVENTLET_NO_GREENDNS'] = 'yes'
import eventlet
eventlet.patcher.monkey_patch(os=False, thread=False)
# NOTE: Import powervc driver common config at the very beginning to parse
# AMQP.
from powervc.common import config
from oslo.config import cfg
from neutron import context
from neutron.common import config as logging_config
from neutron.openstack.common import log as logging
from powervc.common import config
from powervc.neutron.api.client_rpc import RpcClient
LOG = logging.getLogger(__name__)
@ -109,7 +112,7 @@ def main():
rpc.get_pvc_port_uuid(opt)
else:
usage()
except Exception:
traceback.print_exc()
raise

View File

@ -34,9 +34,12 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'powervc', '__init__.py')):
from neutron.openstack.common import gettextutils
gettextutils.install('neutron')
from neutron.common import config as logging_config
# NOTE: Import powervc driver common config at the very beginning to parse
# AMQP.
from powervc.common import config
from neutron.common import config as logging_config
config.parse_power_config(sys.argv, 'powervc-neutron')
logging_config.setup_logging()

View File

@ -0,0 +1,149 @@
[DEFAULT]
###############################################################################
# Transport options
#
# A URL representing the messaging driver to use and its full configuration. If
# not set, we fall back to the rpc_backend option and driver specific
# configuration.
# e.g. rabbit://me:passwd@host:5672/virtual_host
# transport_url=
# The messaging driver to use, defaults to rabbit. Other drivers include qpid
# and zmq
# rpc_backend=rabbit
# The default exchange under which topics are scoped. May be overridden by an
# exchange name specified in the tranport_url option
# Keep this the same as PowerVC Nova exchange
control_exchange=nova
###############################################################################
# AMQP options
#
# User durable queues in amqp
# amqp_durable_queues=False
# Auto-delete queues in amqp
# amqp_auto_delete=False
# Size of RPC connection pool
# rpc_conn_pool_size=30
# Seconds to wait for a response from a call
# rpc_response_timeout=60
###############################################################################
# Notification options
#
# Driver or drivers to handle sending notifications
# notification_driver=[]
# AMQP topic used for OpenStack notifications
# notification_topics=['notifications', ]
###############################################################################
# Eventlet options
#
# Size of RPC greenthread pool
# rpc_thread_pool_size=64
###############################################################################
# Qpid driver configuration
#
# Qpid broker hostname
# qpid_hostname=localhost
# Qpid broker port
# qpid_port=5672
# Qpid HA cluster host:port pairs
# qpid_hosts=['$qpid_hostname:$qpid_port']
# Username for Qpid connection
# qpid_username=
# Password for Qpid connection
# qpid_password=
# Space separted list of SASL mechanisms to use for auth
# qpid_sasl_mechanisms=
# Seconds between connection keepalive heartbeats
# qpid_heartbeat=60
# Transport to use either 'tcp' or 'ssl'
# qpid_protocol=tcp
# Whether to disable the Nagle algorithm
#qpid_tcp_nodelay=True
# The Qpid topology verson to use. Version 1 is what was originally used by
# impl_qpid. Version 2 includes some backwards-incompatible changes that allow
# broker federation to work. Users should update to version 2 when they are
# able to take everything down, as it requires a clean break.
# qpid_topology_version=1
###############################################################################
# RabbitMQ driver configuration
#
# SSL version to use (valid only if SSL enabled), valid values are TLSv1,
# SSLv23 and SSLv3. SSLv2 may be avialable on some distributions.
# kombu_ssl_version=
# SSL key file (valid only if SSL enabled)
# kombu_ssl_keyfile=
# SSL cert file (valid only if SSL enabled)
# kombu_ssl_certfile=
# SSL certificaiton authority file (valid only if SSL enabled)
# kombu_ssl_ca_certs
# How long to wait before reconnectin in response to an AMPQ consumer cancel
# notification
# kombu_reconnect_delay=1.0
# The RabbitMQ broker address where a single node is used
# rabbit_host=localhost
# The RabbitMQ broker port where a single node is used
# rabbit_port=5672
# RabbitMQ HA cluster host:port pairs
# rabbit_hosts=['$rabbit_host:$rabbit_port']
# Connect over SSL for RabbitMQ
# rabbit_use_ssl=False
# The RabbitMQ userid
# rabbit_userid=guest
# The RabbitMQ password
# rabbit_password=guest
# The RabbitMQ login method
# rabbit_login_method=AMQPLAIN
# The RabbitMQ virtual host
# rabbit_virtual_host=/
# How frequently to retry connecting with RabbitMQ
# rabbit_retry_interval=1
# How long to backoff for between retries when connection to RabbitMQ
# rabbit_retry_backoff=2
# Maximum nubmer of RabbitMQ connection retries. Default is 0 (infinite retry
# count)
# rabbit_max_retries=0
# Use HA queues in RabbitMQ (x-ha-policy: all). If you change this option, you
# must wipe the RabbitMQ database
# rabbit_ha_queues=False
# If passed, use a fake RabbitMQ provider
# fake_rabbit=False
###############################################################################
# ZeroMQ driver configuration(Not supported yet)

View File

@ -20,7 +20,7 @@ verbose = True
# upon receiving exception data from an rpc call.
# allowed_rpc_exception_modules = neutron.openstack.common.exception, nova.exception
# AMQP exchange to connect to if using RabbitMQ or QPID
control_exchange = nova
#control_exchange = nova
# QPID
# rpc_backend=neutron.openstack.common.rpc.impl_qpid

View File

@ -735,7 +735,8 @@ class PowerVCNeutronAgent(object):
"""
set up RPC support
"""
rpc.init(CONF)
from powervc.common import config
rpc.init(config.AMQP_OPENSTACK_CONF)
self.topic = PVC_TOPIC
self.conn = rpc.create_connection(new=True)
self.endpoints = [powervc_rpc.PVCRpcCallbacks(self)]

View File

@ -1,8 +1,11 @@
# Copyright 2013 IBM Corp.
from oslo.config import cfg
from prettytable import PrettyTable
from powervc.common import config
from oslo.config import cfg
from neutron.common.rpc import RpcProxy
from neutron.common import rpc
from neutron.openstack.common import log as logging
@ -23,7 +26,7 @@ class RpcClient(RpcProxy):
self.topic = 'powervcrpc'
self.context = context
self.host = cfg.CONF.host
rpc.init(cfg.CONF)
rpc.init(config.AMQP_OPENSTACK_CONF)
super(RpcClient, self).__init__(
topic=self.topic, default_version=self.BASE_RPC_API_VERSION)