From 37ad9fe7f292a7bbe969be78b1db2fec1c4c4813 Mon Sep 17 00:00:00 2001 From: "Munoz, Obed N" Date: Tue, 23 Jun 2015 10:54:15 -0500 Subject: [PATCH] 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 --- glance/cmd/api.py | 3 ++- glance/cmd/registry.py | 3 ++- glance/cmd/search.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/glance/cmd/api.py b/glance/cmd/api.py index 28fdeafd96..c0be0f85a5 100755 --- a/glance/cmd/api.py +++ b/glance/cmd/api.py @@ -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) diff --git a/glance/cmd/registry.py b/glance/cmd/registry.py index 58393b686b..08d77f2834 100755 --- a/glance/cmd/registry.py +++ b/glance/cmd/registry.py @@ -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) diff --git a/glance/cmd/search.py b/glance/cmd/search.py index 5c30027daa..5989a12da1 100755 --- a/glance/cmd/search.py +++ b/glance/cmd/search.py @@ -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)