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:
parent
faba4c3767
commit
05a8443e12
@ -24,6 +24,10 @@ from cinder.openstack.common import gettextutils
|
|||||||
# This should go in the base __init__ folder I think
|
# This should go in the base __init__ folder I think
|
||||||
gettextutils.install('cinder')
|
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 import utils
|
||||||
from cinder.openstack.common import log as logging
|
from cinder.openstack.common import log as logging
|
||||||
# Currently cinder service uses threading instead of eventlet's event,
|
# 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 nova.openstack.common import service
|
||||||
|
|
||||||
from cinder.common import config as cinder_config
|
from cinder.common import config as cinder_config
|
||||||
from powervc.common import config
|
|
||||||
# NOTE: parse config before import manager
|
# NOTE: parse config before import manager
|
||||||
config.parse_power_config(sys.argv, 'cinder')
|
config.parse_power_config(sys.argv, 'cinder')
|
||||||
|
|
||||||
|
148
common-powervc/etc/amqp-openstack.conf
Normal file
148
common-powervc/etc/amqp-openstack.conf
Normal 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)
|
148
common-powervc/etc/amqp-powervc.conf
Normal file
148
common-powervc/etc/amqp-powervc.conf
Normal 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)
|
@ -50,25 +50,6 @@ keystone_max_try_times = 30
|
|||||||
# The interval in seconds to retry the keystone service
|
# The interval in seconds to retry the keystone service
|
||||||
keystone_retry_interval = 2
|
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]
|
[powervc]
|
||||||
|
|
||||||
# Full class name for the manager for PowerVC Manager Service (string value)
|
# Full class name for the manager for PowerVC Manager Service (string value)
|
||||||
@ -127,37 +108,6 @@ expiration_stale_duration = 3600
|
|||||||
storage_connectivity_group = Any host, all VIOS
|
storage_connectivity_group = Any host, all VIOS
|
||||||
#storage_connectivity_group =
|
#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
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Sync variables
|
# Sync variables
|
||||||
#
|
#
|
||||||
|
@ -1,17 +1,60 @@
|
|||||||
# Copyright 2013 IBM Corp.
|
# Copyright 2013, 2014 IBM Corp.
|
||||||
|
|
||||||
"""Config file utility
|
"""Config file utility
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import constants
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from powervc.common import constants
|
||||||
|
|
||||||
from oslo.config import cfg
|
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
|
CONF = cfg.CONF
|
||||||
|
|
||||||
|
|
||||||
def parse_power_config(argv, base_project, base_prog=None):
|
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
|
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
|
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
|
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.StrOpt('region_name', default=None),
|
||||||
cfg.IntOpt('keystone_max_try_times', default=30),
|
cfg.IntOpt('keystone_max_try_times', default=30),
|
||||||
cfg.IntOpt('keystone_retry_interval', default=2),
|
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': [
|
'powervc': [
|
||||||
# Keystone info
|
# Keystone info
|
||||||
cfg.StrOpt('auth_url', default='http://localhost:5000/v2.0/'),
|
cfg.StrOpt('auth_url', default='http://localhost:5000/v2.0/'),
|
||||||
@ -72,12 +110,6 @@ FILE_OPTIONS = {
|
|||||||
cfg.BoolOpt('http_insecure', default=False),
|
cfg.BoolOpt('http_insecure', default=False),
|
||||||
cfg.StrOpt('keystone_version', default="v3"),
|
cfg.StrOpt('keystone_version', default="v3"),
|
||||||
cfg.IntOpt('expiration_stale_duration', default=3600),
|
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
|
# manager
|
||||||
cfg.StrOpt('powervc_manager',
|
cfg.StrOpt('powervc_manager',
|
||||||
default='powervc.compute.manager.PowerVCCloudManager'),
|
default='powervc.compute.manager.PowerVCCloudManager'),
|
||||||
|
@ -34,23 +34,21 @@ Examples:
|
|||||||
conn.start()
|
conn.start()
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import fnmatch
|
||||||
|
import json
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import traceback
|
import traceback
|
||||||
import fnmatch
|
|
||||||
import json
|
|
||||||
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
from qpid.messaging import Connection
|
from qpid.messaging import Connection
|
||||||
from qpid.messaging.exceptions import ConnectionError
|
from qpid.messaging.exceptions import ConnectionError
|
||||||
|
|
||||||
from oslo.config import cfg
|
from powervc.common import config
|
||||||
|
|
||||||
from powervc.common.gettextutils import _
|
from powervc.common.gettextutils import _
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
|
|
||||||
|
|
||||||
def log(log, level, msg):
|
def log(log, level, msg):
|
||||||
"""
|
"""
|
||||||
@ -223,18 +221,18 @@ class PowerVCConnection(QpidConnection):
|
|||||||
:param: log The logging module used for logging messages. If not
|
:param: log The logging module used for logging messages. If not
|
||||||
provided then no logging will be done.
|
provided then no logging will be done.
|
||||||
"""
|
"""
|
||||||
if CONF.powervc.qpid_protocol == 'ssl':
|
if config.AMQP_POWERVC_CONF.qpid_protocol == 'ssl':
|
||||||
transport = 'ssl'
|
transport = 'ssl'
|
||||||
else:
|
else:
|
||||||
transport = 'tcp'
|
transport = 'tcp'
|
||||||
super(PowerVCConnection,
|
super(PowerVCConnection,
|
||||||
self).__init__('%s:%d' % (CONF.powervc.qpid_hostname,
|
self).__init__('%s:%d' % (
|
||||||
CONF.powervc.qpid_port),
|
config.AMQP_POWERVC_CONF.qpid_hostname,
|
||||||
CONF.powervc.qpid_username,
|
config.AMQP_POWERVC_CONF.qpid_port),
|
||||||
CONF.powervc.qpid_password,
|
config.AMQP_POWERVC_CONF.qpid_username,
|
||||||
|
config.AMQP_POWERVC_CONF.qpid_password,
|
||||||
reconnect_handler=reconnect_handler,
|
reconnect_handler=reconnect_handler,
|
||||||
context=context, log=log,
|
context=context, log=log, transport=transport)
|
||||||
transport=transport)
|
|
||||||
|
|
||||||
|
|
||||||
class LocalConnection(QpidConnection):
|
class LocalConnection(QpidConnection):
|
||||||
@ -257,18 +255,18 @@ class LocalConnection(QpidConnection):
|
|||||||
:param: log The logging module used for logging messages. If not
|
:param: log The logging module used for logging messages. If not
|
||||||
provided then no logging will be done.
|
provided then no logging will be done.
|
||||||
"""
|
"""
|
||||||
if CONF.openstack.qpid_protocol == 'ssl':
|
if config.AMQP_OPENSTACK_CONF.qpid_protocol == 'ssl':
|
||||||
transport = 'ssl'
|
transport = 'ssl'
|
||||||
else:
|
else:
|
||||||
transport = 'tcp'
|
transport = 'tcp'
|
||||||
super(LocalConnection,
|
super(LocalConnection,
|
||||||
self).__init__('%s:%d' % (CONF.openstack.qpid_hostname,
|
self).__init__('%s:%d' % (
|
||||||
CONF.openstack.qpid_port),
|
config.AMQP_OPENSTACK_CONF.qpid_hostname,
|
||||||
CONF.openstack.qpid_username,
|
config.AMQP_OPENSTACK_CONF.qpid_port),
|
||||||
CONF.openstack.qpid_password,
|
config.AMQP_OPENSTACK_CONF.qpid_username,
|
||||||
|
config.AMQP_OPENSTACK_CONF.qpid_password,
|
||||||
reconnect_handler=reconnect_handler,
|
reconnect_handler=reconnect_handler,
|
||||||
context=context, log=log,
|
context=context, log=log, transport=transport)
|
||||||
transport=transport)
|
|
||||||
|
|
||||||
|
|
||||||
class QpidListener(object):
|
class QpidListener(object):
|
||||||
|
@ -33,7 +33,8 @@ class PVCConfigTest(testtools.TestCase):
|
|||||||
self.assertEqual(config.CONF.powervc.auth_url,
|
self.assertEqual(config.CONF.powervc.auth_url,
|
||||||
"http://localhost:5000/v2.0/")
|
"http://localhost:5000/v2.0/")
|
||||||
# value in file
|
# value in file
|
||||||
self.assertEqual(config.CONF.powervc.qpid_port, 5679)
|
self.assertEqual(config.CONF.powervc.staging_project_name,
|
||||||
|
"Public")
|
||||||
finally:
|
finally:
|
||||||
p1.stop()
|
p1.stop()
|
||||||
|
|
||||||
@ -53,7 +54,6 @@ class PVCConfigTest(testtools.TestCase):
|
|||||||
p2.start()
|
p2.start()
|
||||||
config.parse_power_config([], "baseproject", None)
|
config.parse_power_config([], "baseproject", None)
|
||||||
# extend value in second file
|
# extend value in second file
|
||||||
self.assertEqual(config.CONF.powervc.qpid_username,
|
self.assertEqual(config.CONF.powervc.staging_user, "admin")
|
||||||
"powervc_qpid_2")
|
|
||||||
finally:
|
finally:
|
||||||
p2.stop()
|
p2.stop()
|
||||||
|
@ -27,19 +27,24 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'powervc', '__init__.py')):
|
|||||||
from nova.openstack.common import gettextutils
|
from nova.openstack.common import gettextutils
|
||||||
gettextutils.install('glance')
|
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 log
|
||||||
from nova.openstack.common import service
|
from nova.openstack.common import service
|
||||||
from nova.openstack.common import importutils
|
from nova.openstack.common import importutils
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = glance_config.CONF
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
# Obtain glance opts from glance-api.conf
|
# 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.setup('powervc')
|
||||||
LOG.info(_('Launching PowerVC Driver ImageManager service...'))
|
LOG.info(_('Launching PowerVC Driver ImageManager service...'))
|
||||||
manager = importutils.import_object(
|
manager = importutils.import_object(
|
||||||
|
@ -13,6 +13,8 @@ import itertools
|
|||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
import HTMLParser
|
import HTMLParser
|
||||||
|
|
||||||
|
from powervc.common import config
|
||||||
|
|
||||||
from nova.openstack.common import service
|
from nova.openstack.common import service
|
||||||
from nova.openstack.common import log as logging
|
from nova.openstack.common import log as logging
|
||||||
from nova.openstack.common import timeutils
|
from nova.openstack.common import timeutils
|
||||||
@ -26,10 +28,10 @@ from powervc.common.exception import StorageConnectivityGroupNotFound
|
|||||||
from powervc.common.gettextutils import _
|
from powervc.common.gettextutils import _
|
||||||
from powervc.common.client import factory as clients
|
from powervc.common.client import factory as clients
|
||||||
from powervc.glance.common import constants
|
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
|
from powervc.common import utils
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = glance_config.CONF
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
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
|
# See if the host is specified. If not, do not attempt to connect
|
||||||
# and register the event handler
|
# and register the event handler
|
||||||
host = CONF['openstack'].qpid_hostname
|
host = config.AMQP_OPENSTACK_CONF.qpid_hostname
|
||||||
if host and host is not None:
|
if host and host is not None:
|
||||||
local_conn = messaging.LocalConnection(
|
local_conn = messaging.LocalConnection(
|
||||||
reconnect_handler=local_event_reconnect_handler,
|
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
|
# See if the host is specified. If not, do not attempt to connect
|
||||||
# and register the event handler
|
# and register the event handler
|
||||||
host = CONF['powervc'].qpid_hostname
|
host = config.AMQP_POWERVC_CONF.qpid_hostname
|
||||||
if host and host is not None:
|
if host and host is not None:
|
||||||
pvc_conn = messaging.PowerVCConnection(
|
pvc_conn = messaging.PowerVCConnection(
|
||||||
reconnect_handler=pvc_event_reconnect_handler, log=logging)
|
reconnect_handler=pvc_event_reconnect_handler, log=logging)
|
||||||
|
@ -15,13 +15,16 @@ os.environ['EVENTLET_NO_GREENDNS'] = 'yes'
|
|||||||
import eventlet
|
import eventlet
|
||||||
eventlet.patcher.monkey_patch(os=False, thread=False)
|
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 oslo.config import cfg
|
||||||
|
|
||||||
from neutron import context
|
from neutron import context
|
||||||
from neutron.common import config as logging_config
|
from neutron.common import config as logging_config
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
|
|
||||||
from powervc.common import config
|
|
||||||
from powervc.neutron.api.client_rpc import RpcClient
|
from powervc.neutron.api.client_rpc import RpcClient
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
@ -34,9 +34,12 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'powervc', '__init__.py')):
|
|||||||
from neutron.openstack.common import gettextutils
|
from neutron.openstack.common import gettextutils
|
||||||
gettextutils.install('neutron')
|
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 powervc.common import config
|
||||||
|
|
||||||
|
from neutron.common import config as logging_config
|
||||||
|
|
||||||
config.parse_power_config(sys.argv, 'powervc-neutron')
|
config.parse_power_config(sys.argv, 'powervc-neutron')
|
||||||
logging_config.setup_logging()
|
logging_config.setup_logging()
|
||||||
|
|
||||||
|
149
neutron-powervc/etc/amqp-openstack-neutron.conf
Normal file
149
neutron-powervc/etc/amqp-openstack-neutron.conf
Normal 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)
|
@ -20,7 +20,7 @@ verbose = True
|
|||||||
# upon receiving exception data from an rpc call.
|
# upon receiving exception data from an rpc call.
|
||||||
# allowed_rpc_exception_modules = neutron.openstack.common.exception, nova.exception
|
# allowed_rpc_exception_modules = neutron.openstack.common.exception, nova.exception
|
||||||
# AMQP exchange to connect to if using RabbitMQ or QPID
|
# AMQP exchange to connect to if using RabbitMQ or QPID
|
||||||
control_exchange = nova
|
#control_exchange = nova
|
||||||
|
|
||||||
# QPID
|
# QPID
|
||||||
# rpc_backend=neutron.openstack.common.rpc.impl_qpid
|
# rpc_backend=neutron.openstack.common.rpc.impl_qpid
|
||||||
|
@ -735,7 +735,8 @@ class PowerVCNeutronAgent(object):
|
|||||||
"""
|
"""
|
||||||
set up RPC support
|
set up RPC support
|
||||||
"""
|
"""
|
||||||
rpc.init(CONF)
|
from powervc.common import config
|
||||||
|
rpc.init(config.AMQP_OPENSTACK_CONF)
|
||||||
self.topic = PVC_TOPIC
|
self.topic = PVC_TOPIC
|
||||||
self.conn = rpc.create_connection(new=True)
|
self.conn = rpc.create_connection(new=True)
|
||||||
self.endpoints = [powervc_rpc.PVCRpcCallbacks(self)]
|
self.endpoints = [powervc_rpc.PVCRpcCallbacks(self)]
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
# Copyright 2013 IBM Corp.
|
# Copyright 2013 IBM Corp.
|
||||||
|
|
||||||
from oslo.config import cfg
|
|
||||||
from prettytable import PrettyTable
|
from prettytable import PrettyTable
|
||||||
|
|
||||||
|
from powervc.common import config
|
||||||
|
|
||||||
|
from oslo.config import cfg
|
||||||
|
|
||||||
from neutron.common.rpc import RpcProxy
|
from neutron.common.rpc import RpcProxy
|
||||||
from neutron.common import rpc
|
from neutron.common import rpc
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
@ -23,7 +26,7 @@ class RpcClient(RpcProxy):
|
|||||||
self.topic = 'powervcrpc'
|
self.topic = 'powervcrpc'
|
||||||
self.context = context
|
self.context = context
|
||||||
self.host = cfg.CONF.host
|
self.host = cfg.CONF.host
|
||||||
rpc.init(cfg.CONF)
|
rpc.init(config.AMQP_OPENSTACK_CONF)
|
||||||
super(RpcClient, self).__init__(
|
super(RpcClient, self).__init__(
|
||||||
topic=self.topic, default_version=self.BASE_RPC_API_VERSION)
|
topic=self.topic, default_version=self.BASE_RPC_API_VERSION)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user