Drop use of 'oslo' namespace package.

The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names.

The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.

Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.

Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages

Change-Id: I2eeef93ee2e61a721c69f62add819f93f62f077d
This commit is contained in:
Doug Hellmann 2015-04-28 16:05:49 +00:00
parent 1b593e9b00
commit e41b259a1e
40 changed files with 141 additions and 139 deletions

View File

@ -16,8 +16,8 @@ from __future__ import absolute_import
import datetime
import os
from oslo.db.sqlalchemy import session as db_session
from oslo_config import cfg
from oslo_db.sqlalchemy import session as db_session
from oslo_utils import timeutils
from sqlalchemy import desc
@ -90,7 +90,7 @@ class Connection(base.Connection):
def upgrade(self):
# NOTE(gordc): to minimise memory, only import migration when needed
from oslo.db.sqlalchemy import migration
from oslo_db.sqlalchemy import migration
path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'..', '..', 'storage', 'sqlalchemy',
'migrate_repo')

View File

@ -16,8 +16,8 @@
import socket
import msgpack
import oslo.messaging
from oslo_config import cfg
import oslo_messaging
from oslo_utils import netutils
from oslo_utils import timeutils
from oslo_utils import units
@ -82,7 +82,7 @@ class CollectorService(os_service.Service):
self.rpc_server = messaging.get_rpc_server(
transport, cfg.CONF.publisher_rpc.metering_topic, self)
sample_target = oslo.messaging.Target(
sample_target = oslo_messaging.Target(
topic=cfg.CONF.publisher_notifier.metering_topic)
self.sample_listener = messaging.get_notification_listener(
transport, [sample_target],
@ -91,7 +91,7 @@ class CollectorService(os_service.Service):
requeue_sample_on_dispatcher_error))
if cfg.CONF.notification.store_events:
event_target = oslo.messaging.Target(
event_target = oslo_messaging.Target(
topic=cfg.CONF.publisher_notifier.event_topic)
self.event_listener = messaging.get_notification_listener(
transport, [event_target],
@ -169,7 +169,7 @@ class CollectorEndpoint(object):
if self.requeue_on_error:
LOG.exception(_LE("Dispatcher failed to handle the %s, "
"requeue it."), self.ep_type)
return oslo.messaging.NotificationResult.REQUEUE
return oslo_messaging.NotificationResult.REQUEUE
raise

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import oslo.messaging
from oslo_config import cfg
import oslo_messaging
from ceilometer.agent import plugin_base
@ -32,11 +32,11 @@ cfg.CONF.register_opts(OPTS)
class ComputeNotificationBase(plugin_base.NotificationBase):
@staticmethod
def get_targets(conf):
"""Return a sequence of oslo.messaging.Target
"""Return a sequence of oslo_messaging.Target
This sequence is defining the exchange and topics to be connected for
this plugin.
"""
return [oslo.messaging.Target(topic=topic,
return [oslo_messaging.Target(topic=topic,
exchange=conf.nova_control_exchange)
for topic in conf.notification_topics]

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import oslo.messaging
from oslo_config import cfg
import oslo_messaging
from ceilometer.agent import plugin_base
from ceilometer import sample
@ -45,11 +45,11 @@ class DataProcessing(plugin_base.NotificationBase,
@staticmethod
def get_targets(conf):
"""Return a sequence of oslo.messaging.Target
"""Return a sequence of oslo_messaging.Target
It is defining the exchange and topics to be connected for this plugin.
"""
return [oslo.messaging.Target(topic=topic,
return [oslo_messaging.Target(topic=topic,
exchange=conf.sahara_control_exchange)
for topic in conf.notification_topics]

View File

@ -15,9 +15,9 @@
import logging
import oslo.messaging
from oslo_config import cfg
from oslo_context import context
import oslo_messaging
from stevedore import extension
from ceilometer.event import converter as event_converter
@ -40,7 +40,7 @@ class EventsNotificationEndpoint(object):
def info(self, ctxt, publisher_id, event_type, payload, metadata):
"""Convert message to Ceilometer Event.
:param ctxt: oslo.messaging context
:param ctxt: oslo_messaging context
:param publisher_id: publisher of the notification
:param event_type: type of notification
:param payload: notification payload
@ -57,7 +57,7 @@ class EventsNotificationEndpoint(object):
def error(self, ctxt, publisher_id, event_type, payload, metadata):
"""Convert error message to Ceilometer Event.
:param ctxt: oslo.messaging context
:param ctxt: oslo_messaging context
:param publisher_id: publisher of the notification
:param event_type: type of notification
:param payload: notification payload
@ -79,6 +79,6 @@ class EventsNotificationEndpoint(object):
p(event)
except Exception:
if not cfg.CONF.notification.ack_on_event_error:
return oslo.messaging.NotificationResult.REQUEUE
return oslo_messaging.NotificationResult.REQUEUE
raise
return oslo.messaging.NotificationResult.HANDLED
return oslo_messaging.NotificationResult.HANDLED

View File

@ -17,9 +17,9 @@ from __future__ import absolute_import
import datetime
import os
from oslo.db import exception as dbexc
from oslo.db.sqlalchemy import session as db_session
from oslo_config import cfg
from oslo_db import exception as dbexc
from oslo_db.sqlalchemy import session as db_session
from oslo_utils import timeutils
import sqlalchemy as sa
@ -134,7 +134,7 @@ class Connection(base.Connection):
def upgrade(self):
# NOTE(gordc): to minimise memory, only import migration when needed
from oslo.db.sqlalchemy import migration
from oslo_db.sqlalchemy import migration
path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'..', '..', 'storage', 'sqlalchemy',
'migrate_repo')

View File

@ -11,8 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import oslo.messaging
from oslo_config import cfg
import oslo_messaging
from ceilometer.agent import plugin_base
from ceilometer import sample
@ -38,12 +38,12 @@ class _Base(plugin_base.NotificationBase,
@staticmethod
def get_targets(conf):
"""Return a sequence of oslo.messaging.Target
"""Return a sequence of oslo_messaging.Target
Sequence defining the exchange and topics to be connected for this
plugin.
"""
return [oslo.messaging.Target(topic=topic,
return [oslo_messaging.Target(topic=topic,
exchange=conf.keystone_control_exchange)
for topic in conf.notification_topics]

View File

@ -16,8 +16,8 @@
events.
"""
import oslo.messaging
from oslo_config import cfg
import oslo_messaging
from ceilometer.agent import plugin_base
from ceilometer import sample
@ -37,12 +37,12 @@ class ImageBase(plugin_base.NotificationBase):
@staticmethod
def get_targets(conf):
"""Return a sequence of oslo.messaging.Target
"""Return a sequence of oslo_messaging.Target
This sequence is defining the exchange and topics to be connected for
this plugin.
"""
return [oslo.messaging.Target(topic=topic,
return [oslo_messaging.Target(topic=topic,
exchange=conf.glance_control_exchange)
for topic in conf.notification_topics]

View File

@ -16,8 +16,8 @@
notification events.
"""
from oslo import messaging
from oslo_config import cfg
import oslo_messaging as messaging
from ceilometer.agent import plugin_base
from ceilometer.openstack.common import log

View File

@ -10,8 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import oslo.messaging
from oslo_config import cfg
import oslo_messaging
from ceilometer.agent import plugin_base
from ceilometer import sample
@ -31,12 +31,12 @@ class _Base(plugin_base.NotificationBase):
@staticmethod
def get_targets(conf):
"""Return a sequence of oslo.messaging.Target
"""Return a sequence of oslo_messaging.Target
Sequence defining the exchange and topics to be connected for this
plugin.
"""
return [oslo.messaging.Target(topic=topic,
return [oslo_messaging.Target(topic=topic,
exchange=conf.magnetodb_control_exchange)
for topic in conf.notification_topics]

View File

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import oslo.messaging
from oslo_config import cfg
from oslo_context import context
import oslo_messaging
from oslo_serialization import jsonutils
DEFAULT_URL = "__default__"
@ -28,7 +28,7 @@ _ALIASES = {
}
class RequestContextSerializer(oslo.messaging.Serializer):
class RequestContextSerializer(oslo_messaging.Serializer):
def __init__(self, base):
self._base = base
@ -51,28 +51,28 @@ class RequestContextSerializer(oslo.messaging.Serializer):
return context.RequestContext(ctxt)
class JsonPayloadSerializer(oslo.messaging.NoOpSerializer):
class JsonPayloadSerializer(oslo_messaging.NoOpSerializer):
@classmethod
def serialize_entity(cls, context, entity):
return jsonutils.to_primitive(entity, convert_instances=True)
def setup():
oslo.messaging.set_transport_defaults('ceilometer')
oslo_messaging.set_transport_defaults('ceilometer')
def get_transport(url=None, optional=False, cache=True):
"""Initialise the oslo.messaging layer."""
"""Initialise the oslo_messaging layer."""
global TRANSPORTS, DEFAULT_URL
cache_key = url or DEFAULT_URL
transport = TRANSPORTS.get(cache_key)
if not transport or not cache:
try:
transport = oslo.messaging.get_transport(cfg.CONF, url,
transport = oslo_messaging.get_transport(cfg.CONF, url,
aliases=_ALIASES)
except oslo.messaging.InvalidTransportURL as e:
except oslo_messaging.InvalidTransportURL as e:
if not optional or e.url:
# NOTE(sileht): oslo.messaging is configured but unloadable
# NOTE(sileht): oslo_messaging is configured but unloadable
# so reraise the exception
raise
return None
@ -83,7 +83,7 @@ def get_transport(url=None, optional=False, cache=True):
def cleanup():
"""Cleanup the oslo.messaging layer."""
"""Cleanup the oslo_messaging layer."""
global TRANSPORTS, NOTIFIERS
NOTIFIERS = {}
for url in TRANSPORTS:
@ -92,44 +92,44 @@ def cleanup():
def get_rpc_server(transport, topic, endpoint):
"""Return a configured oslo.messaging rpc server."""
"""Return a configured oslo_messaging rpc server."""
cfg.CONF.import_opt('host', 'ceilometer.service')
target = oslo.messaging.Target(server=cfg.CONF.host, topic=topic)
target = oslo_messaging.Target(server=cfg.CONF.host, topic=topic)
serializer = RequestContextSerializer(JsonPayloadSerializer())
return oslo.messaging.get_rpc_server(transport, target,
return oslo_messaging.get_rpc_server(transport, target,
[endpoint], executor='eventlet',
serializer=serializer)
def get_rpc_client(transport, retry=None, **kwargs):
"""Return a configured oslo.messaging RPCClient."""
target = oslo.messaging.Target(**kwargs)
"""Return a configured oslo_messaging RPCClient."""
target = oslo_messaging.Target(**kwargs)
serializer = RequestContextSerializer(JsonPayloadSerializer())
return oslo.messaging.RPCClient(transport, target,
return oslo_messaging.RPCClient(transport, target,
serializer=serializer,
retry=retry)
def get_notification_listener(transport, targets, endpoints,
allow_requeue=False):
"""Return a configured oslo.messaging notification listener."""
return oslo.messaging.get_notification_listener(
"""Return a configured oslo_messaging notification listener."""
return oslo_messaging.get_notification_listener(
transport, targets, endpoints, executor='eventlet',
allow_requeue=allow_requeue)
def get_notifier(transport, publisher_id):
"""Return a configured oslo.messaging notifier."""
"""Return a configured oslo_messaging notifier."""
serializer = RequestContextSerializer(JsonPayloadSerializer())
notifier = oslo.messaging.Notifier(transport, serializer=serializer)
notifier = oslo_messaging.Notifier(transport, serializer=serializer)
return notifier.prepare(publisher_id=publisher_id)
def convert_to_old_notification_format(priority, ctxt, publisher_id,
event_type, payload, metadata):
# FIXME(sileht): temporary convert notification to old format
# to focus on oslo.messaging migration before refactoring the code to
# use the new oslo.messaging facilities
# to focus on oslo_messaging migration before refactoring the code to
# use the new oslo_messaging facilities
notification = {'priority': priority,
'payload': payload,
'event_type': event_type,

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import oslo.messaging
from oslo_config import cfg
import oslo_messaging
from ceilometer.agent import plugin_base
from ceilometer import sample
@ -46,12 +46,12 @@ class HTTPRequest(plugin_base.NotificationBase,
@staticmethod
def get_targets(conf):
"""Return a sequence of oslo.messaging.Target
"""Return a sequence of oslo_messaging.Target
This sequence is defining the exchange and topics to be connected for
this plugin.
"""
return [oslo.messaging.Target(topic=topic, exchange=exchange)
return [oslo_messaging.Target(topic=topic, exchange=exchange)
for topic in conf.notification_topics
for exchange in conf.http_control_exchanges]

View File

@ -17,8 +17,8 @@
"""
import oslo.messaging
from oslo_config import cfg
import oslo_messaging
from ceilometer.agent import plugin_base
from ceilometer.openstack.common import log
@ -61,12 +61,12 @@ class NetworkNotificationBase(plugin_base.NotificationBase):
@staticmethod
def get_targets(conf):
"""Return a sequence of oslo.messaging.Target
"""Return a sequence of oslo_messaging.Target
This sequence is defining the exchange and topics to be connected for
this plugin.
"""
return [oslo.messaging.Target(topic=topic,
return [oslo_messaging.Target(topic=topic,
exchange=conf.neutron_control_exchange)
for topic in conf.notification_topics]

View File

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import oslo.messaging
from oslo_config import cfg
from oslo_context import context
import oslo_messaging
from stevedore import extension
from ceilometer.agent import plugin_base as base
@ -94,7 +94,7 @@ class NotificationService(os_service.Service):
)
def _get_notifier(self, transport, pipe):
return oslo.messaging.Notifier(
return oslo_messaging.Notifier(
transport,
driver=cfg.CONF.publisher_notifier.telemetry_driver,
publisher_id='ceilometer.notification',
@ -128,11 +128,11 @@ class NotificationService(os_service.Service):
self.group_id = self.NOTIFICATION_NAMESPACE
else:
# FIXME(sileht): endpoint use notification_topics option
# and it should not because this is oslo.messaging option
# and it should not because this is oslo_messaging option
# not a ceilometer, until we have a something to get
# the notification_topics in an other way
# we must create a transport to ensure the option have
# beeen registered by oslo.messaging
# beeen registered by oslo_messaging
messaging.get_notifier(transport, '')
pipe_manager = self.pipeline_manager
if cfg.CONF.notification.store_events:
@ -185,7 +185,7 @@ class NotificationService(os_service.Service):
{'name': ext.name,
'type': ', '.join(handler.event_types),
'error': ack_on_error})
# NOTE(gordc): this could be a set check but oslo.messaging issue
# NOTE(gordc): this could be a set check but oslo_messaging issue
# https://bugs.launchpad.net/oslo.messaging/+bug/1398511
# This ensures we don't create multiple duplicate consumers.
for new_tar in handler.get_targets(cfg.CONF):
@ -220,7 +220,7 @@ class NotificationService(os_service.Service):
pipeline.SamplePipelineEndpoint)
listener = messaging.get_notification_listener(
transport,
[oslo.messaging.Target(
[oslo_messaging.Target(
topic='%s-%s' % (self.NOTIFICATION_IPC, pipe.name))],
[pipe_endpoint(self.ctxt, pipe)])
listener.start()

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import oslo.messaging
from oslo_config import cfg
import oslo_messaging
from ceilometer.agent import plugin_base
from ceilometer import sample
@ -34,12 +34,12 @@ class _Base(plugin_base.NotificationBase):
@staticmethod
def get_targets(conf):
"""Return a sequence of oslo.messaging.Target
"""Return a sequence of oslo_messaging.Target
Sequence defining the exchange and topics to be connected for this
plugin.
"""
return [oslo.messaging.Target(topic=topic,
return [oslo_messaging.Target(topic=topic,
exchange=conf.swift_control_exchange)
for topic in conf.notification_topics]

View File

@ -17,14 +17,14 @@ See http://docs.openstack.org/developer/oslo.i18n/usage.html
"""
try:
import oslo.i18n
import oslo_i18n
# NOTE(dhellmann): This reference to o-s-l-o will be replaced by the
# application name when this module is synced into the separate
# repository. It is OK to have more than one translation function
# using the same domain, since there will still only be one message
# catalog.
_translators = oslo.i18n.TranslatorFactory(domain='ceilometer')
_translators = oslo_i18n.TranslatorFactory(domain='ceilometer')
# The primary translation function using the well-known name "_"
_ = _translators.primary

View File

@ -28,7 +28,7 @@ import traceback
import eventlet.backdoor
import greenlet
from oslo.config import cfg
from oslo_config import cfg
from ceilometer.openstack.common._i18n import _LI

View File

@ -20,7 +20,7 @@ import os
import stat
import tempfile
from oslo.utils import excutils
from oslo_utils import excutils
LOG = logging.getLogger(__name__)

View File

@ -38,8 +38,8 @@ import socket
import sys
import traceback
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo_config import cfg
from oslo_serialization import jsonutils
from oslo_utils import importutils
import six
from six import moves

View File

@ -35,7 +35,7 @@ except ImportError:
import eventlet
from eventlet import event
from oslo.config import cfg
from oslo_config import cfg
from ceilometer.openstack.common import eventlet_backdoor
from ceilometer.openstack.common._i18n import _LE, _LI, _LW

View File

@ -21,7 +21,7 @@ import functools
import inspect
import logging
from oslo.config import cfg
from oslo_config import cfg
import pkg_resources
import six

View File

@ -13,8 +13,8 @@
events.
"""
import oslo.messaging
from oslo_config import cfg
import oslo_messaging
from ceilometer.agent import plugin_base
from ceilometer import sample
@ -47,11 +47,11 @@ class StackCRUD(plugin_base.NotificationBase,
@staticmethod
def get_targets(conf):
"""Return a sequence of oslo.messaging.Target
"""Return a sequence of oslo_messaging.Target
It is defining the exchange and topics to be connected for this plugin.
"""
return [oslo.messaging.Target(topic=topic,
return [oslo_messaging.Target(topic=topic,
exchange=conf.heat_control_exchange)
for topic in conf.notification_topics]

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import oslo.messaging
from oslo_config import cfg
import oslo_messaging
from ceilometer.agent import plugin_base
from ceilometer import sample
@ -41,7 +41,7 @@ class ProfilerNotifications(plugin_base.NotificationBase,
event_types = ["profiler.*"]
def get_targets(self, conf):
"""Return a sequence of oslo.messaging.Target
"""Return a sequence of oslo_messaging.Target
It is defining the exchange and topics to be connected for this plugin.
:param conf: Configuration.
@ -60,7 +60,7 @@ class ProfilerNotifications(plugin_base.NotificationBase,
]
for exchange in exchanges:
targets.extend(oslo.messaging.Target(topic=topic,
targets.extend(oslo_messaging.Target(topic=topic,
exchange=exchange)
for topic in conf.notification_topics)
return targets

View File

@ -19,8 +19,8 @@ import abc
import itertools
import operator
import oslo.messaging
from oslo_config import cfg
import oslo_messaging
import six
import six.moves.urllib.parse as urlparse
@ -148,7 +148,7 @@ class MessagingPublisher(publisher.PublisherBase):
context, topic, data = queue[0]
try:
self._send(context, topic, data)
except oslo.messaging.MessageDeliveryFailure:
except oslo_messaging.MessageDeliveryFailure:
data = sum([len(m) for __, __, m in queue])
if policy == 'queue':
LOG.warn(_("Failed to publish %d datapoints, queue them"),
@ -204,7 +204,7 @@ class NotifierPublisher(MessagingPublisher):
super(NotifierPublisher, self).__init__(parsed_url)
options = urlparse.parse_qs(parsed_url.query)
topic = options.get('topic', [default_topic])[-1]
self.notifier = oslo.messaging.Notifier(
self.notifier = oslo_messaging.Notifier(
messaging.get_transport(),
driver=cfg.CONF.publisher_notifier.telemetry_driver,
publisher_id='telemetry.publisher.%s' % cfg.CONF.host,

View File

@ -18,8 +18,8 @@ import os
import socket
import sys
from oslo import i18n
from oslo_config import cfg
import oslo_i18n
from ceilometer.i18n import _
from ceilometer import messaging
@ -108,7 +108,7 @@ def get_workers(name):
def prepare_service(argv=None):
i18n.enable_lazy()
oslo_i18n.enable_lazy()
log_levels = (cfg.CONF.default_log_levels +
['stevedore=INFO', 'keystoneclient=INFO'])
cfg.set_defaults(log.log_opts,

View File

@ -15,8 +15,8 @@
"""Storage backend management
"""
from oslo.db import options as db_options
from oslo_config import cfg
from oslo_db import options as db_options
import retrying
import six
import six.moves.urllib.parse as urlparse

View File

@ -18,10 +18,10 @@ import datetime
import hashlib
import os
from oslo.db import api
from oslo.db import exception as dbexc
from oslo.db.sqlalchemy import session as db_session
from oslo_config import cfg
from oslo_db import api
from oslo_db import exception as dbexc
from oslo_db.sqlalchemy import session as db_session
from oslo_serialization import jsonutils
from oslo_utils import timeutils
import six
@ -227,7 +227,7 @@ class Connection(base.Connection):
def upgrade(self):
# NOTE(gordc): to minimise memory, only import migration when needed
from oslo.db.sqlalchemy import migration
from oslo_db.sqlalchemy import migration
path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'sqlalchemy', 'migrate_repo')
migration.db_sync(self._engine_facade.get_engine(), path)

View File

@ -32,8 +32,10 @@ from ceilometer.openstack.common import log
LOG = log.getLogger(__name__)
cfg.CONF.import_opt('max_retries', 'oslo.db.options', group="database")
cfg.CONF.import_opt('retry_interval', 'oslo.db.options', group="database")
# FIXME(dhellmann): Configuration options are not part of the Oslo
# library APIs, and should not be used like this.
cfg.CONF.import_opt('max_retries', 'oslo_db.options', group="database")
cfg.CONF.import_opt('retry_interval', 'oslo_db.options', group="database")
EVENT_TRAIT_TYPES = {'none': 0, 'string': 1, 'integer': 2, 'float': 3,
'datetime': 4}

View File

@ -18,7 +18,7 @@ import datetime
import uuid
import mock
import oslo.messaging.conffixture
import oslo_messaging.conffixture
from oslo_serialization import jsonutils
import requests
import six
@ -2458,7 +2458,7 @@ class TestAlarms(v2.FunctionalTest,
}
endpoint = mock.MagicMock()
target = oslo.messaging.Target(topic="notifications")
target = oslo_messaging.Target(topic="notifications")
listener = messaging.get_notification_listener(
self.transport, [target], [endpoint])
listener.start()

View File

@ -38,7 +38,7 @@ class TestPostSamples(v2.FunctionalTest,
self.published = []
notifier = mock.Mock()
notifier.sample.side_effect = self.fake_notifier_sample
self.useFixture(mockpatch.Patch('oslo.messaging.Notifier',
self.useFixture(mockpatch.Patch('oslo_messaging.Notifier',
return_value=notifier))
super(TestPostSamples, self).setUp()

View File

@ -19,7 +19,7 @@ import functools
import os.path
import eventlet
import oslo.messaging.conffixture
import oslo_messaging.conffixture
from oslo_utils import timeutils
from oslotest import base
from oslotest import mockpatch
@ -33,7 +33,7 @@ from ceilometer import messaging
class BaseTestCase(base.BaseTestCase):
def setup_messaging(self, conf, exchange=None):
self.useFixture(oslo.messaging.conffixture.ConfFixture(conf))
self.useFixture(oslo_messaging.conffixture.ConfFixture(conf))
conf.set_override("notification_driver", "messaging")
if not exchange:
exchange = 'ceilometer'

View File

@ -15,9 +15,9 @@
"""Tests for Ceilometer notify daemon."""
import mock
import oslo.messaging
from oslo_config import cfg
from oslo_config import fixture as fixture_config
import oslo_messaging
from ceilometer.event import endpoint as event_endpoint
from ceilometer.tests import base as tests_base
@ -105,4 +105,4 @@ class TestEventEndpoint(tests_base.BaseTestCase):
self.mock_pm.publisher.side_effect = Exception
message = {'event_type': "foo", 'message_id': "abc"}
ret = self.endpoint.process_notification(message)
self.assertEqual(oslo.messaging.NotificationResult.REQUEUE, ret)
self.assertEqual(oslo_messaging.NotificationResult.REQUEUE, ret)

View File

@ -19,9 +19,9 @@ import uuid
import eventlet
import mock
import oslo.messaging
from oslo_config import fixture as fixture_config
from oslo_context import context
import oslo_messaging
from oslo_utils import netutils
import testscenarios.testcase
@ -178,7 +178,7 @@ class RpcOnlyPublisherTest(BasePublisherTestCase):
class NotifierOnlyPublisherTest(BasePublisherTestCase):
@mock.patch('oslo.messaging.Notifier')
@mock.patch('oslo_messaging.Notifier')
def test_publish_topic_override(self, notifier):
msg_publisher.SampleNotifierPublisher(
netutils.urlsplit('notifier://?topic=custom_topic'))
@ -248,11 +248,11 @@ class TestPublisher(testscenarios.testcase.WithScenarios,
def test_published_with_no_policy(self, mylog):
publisher = self.publisher_cls(
netutils.urlsplit('%s://' % self.protocol))
side_effect = oslo.messaging.MessageDeliveryFailure()
side_effect = oslo_messaging.MessageDeliveryFailure()
with mock.patch.object(publisher, '_send') as fake_send:
fake_send.side_effect = side_effect
self.assertRaises(
oslo.messaging.MessageDeliveryFailure,
oslo_messaging.MessageDeliveryFailure,
getattr(publisher, self.pub_func),
mock.MagicMock(), self.test_data)
self.assertTrue(mylog.info.called)
@ -265,11 +265,11 @@ class TestPublisher(testscenarios.testcase.WithScenarios,
def test_published_with_policy_block(self, mylog):
publisher = self.publisher_cls(
netutils.urlsplit('%s://?policy=default' % self.protocol))
side_effect = oslo.messaging.MessageDeliveryFailure()
side_effect = oslo_messaging.MessageDeliveryFailure()
with mock.patch.object(publisher, '_send') as fake_send:
fake_send.side_effect = side_effect
self.assertRaises(
oslo.messaging.MessageDeliveryFailure,
oslo_messaging.MessageDeliveryFailure,
getattr(publisher, self.pub_func),
mock.MagicMock(), self.test_data)
self.assertTrue(mylog.info.called)
@ -281,11 +281,11 @@ class TestPublisher(testscenarios.testcase.WithScenarios,
def test_published_with_policy_incorrect(self, mylog):
publisher = self.publisher_cls(
netutils.urlsplit('%s://?policy=notexist' % self.protocol))
side_effect = oslo.messaging.MessageDeliveryFailure()
side_effect = oslo_messaging.MessageDeliveryFailure()
with mock.patch.object(publisher, '_send') as fake_send:
fake_send.side_effect = side_effect
self.assertRaises(
oslo.messaging.MessageDeliveryFailure,
oslo_messaging.MessageDeliveryFailure,
getattr(publisher, self.pub_func),
mock.MagicMock(), self.test_data)
self.assertTrue(mylog.warn.called)
@ -297,7 +297,7 @@ class TestPublisher(testscenarios.testcase.WithScenarios,
def test_published_with_policy_drop_and_rpc_down(self):
publisher = self.publisher_cls(
netutils.urlsplit('%s://?policy=drop' % self.protocol))
side_effect = oslo.messaging.MessageDeliveryFailure()
side_effect = oslo_messaging.MessageDeliveryFailure()
with mock.patch.object(publisher, '_send') as fake_send:
fake_send.side_effect = side_effect
getattr(publisher, self.pub_func)(mock.MagicMock(),
@ -309,7 +309,7 @@ class TestPublisher(testscenarios.testcase.WithScenarios,
def test_published_with_policy_queue_and_rpc_down(self):
publisher = self.publisher_cls(
netutils.urlsplit('%s://?policy=queue' % self.protocol))
side_effect = oslo.messaging.MessageDeliveryFailure()
side_effect = oslo_messaging.MessageDeliveryFailure()
with mock.patch.object(publisher, '_send') as fake_send:
fake_send.side_effect = side_effect
@ -324,7 +324,7 @@ class TestPublisher(testscenarios.testcase.WithScenarios,
publisher = self.publisher_cls(
netutils.urlsplit('%s://?policy=queue' % self.protocol))
side_effect = oslo.messaging.MessageDeliveryFailure()
side_effect = oslo_messaging.MessageDeliveryFailure()
with mock.patch.object(publisher, '_send') as fake_send:
fake_send.side_effect = side_effect
getattr(publisher, self.pub_func)(mock.MagicMock(),
@ -348,7 +348,7 @@ class TestPublisher(testscenarios.testcase.WithScenarios,
publisher = self.publisher_cls(netutils.urlsplit(
'%s://?policy=queue&max_queue_length=3' % self.protocol))
side_effect = oslo.messaging.MessageDeliveryFailure()
side_effect = oslo_messaging.MessageDeliveryFailure()
with mock.patch.object(publisher, '_send') as fake_send:
fake_send.side_effect = side_effect
for i in range(0, 5):
@ -375,7 +375,7 @@ class TestPublisher(testscenarios.testcase.WithScenarios,
publisher = self.publisher_cls(
netutils.urlsplit('%s://?policy=queue' % self.protocol))
side_effect = oslo.messaging.MessageDeliveryFailure()
side_effect = oslo_messaging.MessageDeliveryFailure()
with mock.patch.object(publisher, '_send') as fake_send:
fake_send.side_effect = side_effect
for i in range(0, 2000):

View File

@ -19,9 +19,9 @@ import datetime
import operator
import mock
from oslo.db import api
from oslo.db import exception as dbexc
from oslo_config import cfg
from oslo_db import api
from oslo_db import exception as dbexc
from oslo_utils import timeutils
import pymongo

View File

@ -17,9 +17,9 @@ import socket
import mock
import msgpack
import oslo.messaging
from oslo_config import fixture as fixture_config
from oslo_context import context
import oslo_messaging
from oslo_utils import timeutils
from oslotest import mockpatch
from stevedore import extension
@ -45,7 +45,7 @@ class TestCollector(tests_base.BaseTestCase):
def setUp(self):
super(TestCollector, self).setUp()
self.CONF = self.useFixture(fixture_config.Config()).conf
self.CONF.import_opt("connection", "oslo.db.options", group="database")
self.CONF.import_opt("connection", "oslo_db.options", group="database")
self.CONF.set_override("connection", "log://", group='database')
self.CONF.set_override('telemetry_secret', 'not-so-secret',
group='publisher')
@ -196,7 +196,7 @@ class TestCollector(tests_base.BaseTestCase):
self._verify_udp_socket(udp_socket)
@mock.patch.object(oslo.messaging.MessageHandlingServer, 'start')
@mock.patch.object(oslo_messaging.MessageHandlingServer, 'start')
@mock.patch.object(collector.CollectorService, 'start_udp')
def test_only_udp(self, udp_start, rpc_start):
"""Check that only UDP is started if messaging transport is unset."""
@ -207,7 +207,7 @@ class TestCollector(tests_base.BaseTestCase):
self.assertEqual(0, rpc_start.call_count)
self.assertEqual(1, udp_start.call_count)
@mock.patch.object(oslo.messaging.MessageHandlingServer, 'start')
@mock.patch.object(oslo_messaging.MessageHandlingServer, 'start')
@mock.patch.object(collector.CollectorService, 'start_udp')
def test_only_rpc(self, udp_start, rpc_start):
"""Check that only RPC is started if udp_address is empty."""
@ -253,10 +253,10 @@ class TestCollector(tests_base.BaseTestCase):
self.srv.start()
endp = getattr(self.srv, listener).dispatcher.endpoints[0]
ret = endp.sample({}, 'pub_id', 'event', {}, {})
self.assertEqual(oslo.messaging.NotificationResult.REQUEUE,
self.assertEqual(oslo_messaging.NotificationResult.REQUEUE,
ret)
@mock.patch.object(oslo.messaging.MessageHandlingServer, 'start',
@mock.patch.object(oslo_messaging.MessageHandlingServer, 'start',
mock.Mock())
@mock.patch.object(collector.CollectorService, 'start_udp', mock.Mock())
def test_collector_sample_requeue(self):
@ -264,7 +264,7 @@ class TestCollector(tests_base.BaseTestCase):
group='collector')
self._test_collector_requeue('sample_listener')
@mock.patch.object(oslo.messaging.MessageHandlingServer, 'start',
@mock.patch.object(oslo_messaging.MessageHandlingServer, 'start',
mock.Mock())
@mock.patch.object(collector.CollectorService, 'start_udp', mock.Mock())
def test_collector_event_requeue(self):
@ -286,7 +286,7 @@ class TestCollector(tests_base.BaseTestCase):
self.assertRaises(FakeException, endp.sample, {}, 'pub_id',
'event', {}, {})
@mock.patch.object(oslo.messaging.MessageHandlingServer, 'start',
@mock.patch.object(oslo_messaging.MessageHandlingServer, 'start',
mock.Mock())
@mock.patch.object(collector.CollectorService, 'start_udp', mock.Mock())
def test_collector_sample_no_requeue(self):
@ -294,7 +294,7 @@ class TestCollector(tests_base.BaseTestCase):
group='collector')
self._test_collector_no_requeue('sample_listener')
@mock.patch.object(oslo.messaging.MessageHandlingServer, 'start',
@mock.patch.object(oslo_messaging.MessageHandlingServer, 'start',
mock.Mock())
@mock.patch.object(collector.CollectorService, 'start_udp', mock.Mock())
def test_collector_event_no_requeue(self):

View File

@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import oslo.messaging
from oslo_config import fixture as fixture_config
import oslo_messaging
from oslotest import base
from ceilometer import messaging
@ -23,10 +23,10 @@ class MessagingTests(base.BaseTestCase):
def setUp(self):
super(MessagingTests, self).setUp()
self.CONF = self.useFixture(fixture_config.Config()).conf
self.useFixture(oslo.messaging.conffixture.ConfFixture(self.CONF))
self.useFixture(oslo_messaging.conffixture.ConfFixture(self.CONF))
def test_get_transport_invalid_url(self):
self.assertRaises(oslo.messaging.InvalidTransportURL,
self.assertRaises(oslo_messaging.InvalidTransportURL,
messaging.get_transport, "notvalid!")
def test_get_transport_url_caching(self):

View File

@ -16,10 +16,10 @@
import eventlet
import mock
import oslo.messaging
import oslo.messaging.conffixture
from oslo_config import fixture as fixture_config
from oslo_context import context
import oslo_messaging
import oslo_messaging.conffixture
from oslo_utils import timeutils
from stevedore import extension
import yaml
@ -108,7 +108,7 @@ class TestNotification(tests_base.BaseTestCase):
)
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
@mock.patch.object(oslo.messaging.MessageHandlingServer, 'start',
@mock.patch.object(oslo_messaging.MessageHandlingServer, 'start',
mock.MagicMock())
@mock.patch('ceilometer.event.endpoint.EventsNotificationEndpoint')
def _do_process_notification_manager_start(self,
@ -151,7 +151,7 @@ class TestNotification(tests_base.BaseTestCase):
self.srv.listeners[0].dispatcher.endpoints[0])
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
@mock.patch.object(oslo.messaging.MessageHandlingServer, 'start',
@mock.patch.object(oslo_messaging.MessageHandlingServer, 'start',
mock.MagicMock())
@mock.patch('ceilometer.event.endpoint.EventsNotificationEndpoint')
def test_unique_consumers(self, fake_event_endpoint_class):
@ -327,7 +327,7 @@ class TestRealNotificationHA(BaseRealNotification):
self.assertEqual(2, len(self.srv.pipeline_listeners))
self.srv.stop()
@mock.patch('oslo.messaging.Notifier.sample')
@mock.patch('oslo_messaging.Notifier.sample')
def test_broadcast_to_relevant_pipes_only(self, mock_notifier):
self.srv.start()
for endpoint in self.srv.listeners[0].dispatcher.endpoints:

View File

@ -16,8 +16,8 @@
events.
"""
import oslo.messaging
from oslo_config import cfg
import oslo_messaging
from ceilometer.agent import plugin_base
from ceilometer import sample
@ -42,7 +42,7 @@ class VolumeBase(plugin_base.NotificationBase):
Sequence defining the exchange and topics to be connected for this
plugin.
"""
return [oslo.messaging.Target(topic=topic,
return [oslo_messaging.Target(topic=topic,
exchange=conf.cinder_control_exchange)
for topic in conf.notification_topics]

View File

@ -14,5 +14,5 @@ paste.app_factory = ceilometer.api.app:app_factory
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
[filter:request_id]
paste.filter_factory = oslo.middleware:RequestId.factory
paste.filter_factory = oslo_middleware:RequestId.factory

View File

@ -350,11 +350,11 @@ network.statistics.drivers =
# These are for backwards compat with Havana notification_driver configuration values
oslo.messaging.notify.drivers =
ceilometer.openstack.common.notifier.log_notifier = oslo.messaging.notify._impl_log:LogDriver
ceilometer.openstack.common.notifier.no_op_notifier = oslo.messaging.notify._impl_noop:NoOpDriver
ceilometer.openstack.common.notifier.rpc_notifier2 = oslo.messaging.notify._impl_messaging:MessagingV2Driver
ceilometer.openstack.common.notifier.rpc_notifier = oslo.messaging.notify._impl_messaging:MessagingDriver
ceilometer.openstack.common.notifier.test_notifier = oslo.messaging.notify._impl_test:TestDriver
ceilometer.openstack.common.notifier.log_notifier = oslo_messaging.notify._impl_log:LogDriver
ceilometer.openstack.common.notifier.no_op_notifier = oslo_messaging.notify._impl_noop:NoOpDriver
ceilometer.openstack.common.notifier.rpc_notifier2 = oslo_messaging.notify._impl_messaging:MessagingV2Driver
ceilometer.openstack.common.notifier.rpc_notifier = oslo_messaging.notify._impl_messaging:MessagingDriver
ceilometer.openstack.common.notifier.test_notifier = oslo_messaging.notify._impl_test:TestDriver
oslo.config.opts =
ceilometer = ceilometer.opts:list_opts