Fix OSProfiler exception when is enabled

When OSProfiler is enabled in glance-api.conf or glance-registry.conf,
the services are failing to start. They raise an AtttributeError
exception when not finding messaging module from notifier

When oslo removed namespaced packages in kilo, the code was changed
in glance.notifier from doing

	from oslo import messaging

To doing

        import oslo_messaging

And all references were changed from messaging to oslo_messaging. When
osprofiler integration was added, the author choose to use the notifier
module's reference to oslo.messaging instead of importing it directly.
When the rename occurred, this was not caught. So, oslo_messaging is
directly imported in glance.cmd.{api,registry,search} and use it as
it was intended

Closes-Bug: #1467982

Change-Id: I87c0d4f0885f5714e966218eabf06134772babfa
Signed-off-by: Munoz, Obed N <obed.n.munoz@intel.com>
This commit is contained in:
Munoz, Obed N 2015-06-23 10:54:15 -05:00
parent 5edf7e8f5a
commit 37ad9fe7f2
3 changed files with 6 additions and 3 deletions

View File

@ -43,6 +43,7 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')):
import glance_store
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging
import osprofiler.notifier
import osprofiler.web
@ -75,7 +76,7 @@ def main():
if cfg.CONF.profiler.enabled:
_notifier = osprofiler.notifier.create("Messaging",
notifier.messaging, {},
oslo_messaging, {},
notifier.get_transport(),
"glance", "api",
cfg.CONF.bind_host)

View File

@ -39,6 +39,7 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')):
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging
import osprofiler.notifier
import osprofiler.web
@ -60,7 +61,7 @@ def main():
if cfg.CONF.profiler.enabled:
_notifier = osprofiler.notifier.create("Messaging",
notifier.messaging, {},
oslo_messaging, {},
notifier.get_transport(),
"glance", "registry",
cfg.CONF.bind_host)

View File

@ -42,6 +42,7 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')):
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging
import osprofiler.notifier
import osprofiler.web
@ -73,7 +74,7 @@ def main():
if cfg.CONF.profiler.enabled:
_notifier = osprofiler.notifier.create("Messaging",
notifier.messaging, {},
oslo_messaging, {},
notifier.get_transport(),
"glance", "search",
cfg.CONF.bind_host)