Merge "Import only once in nova_notifier"
This commit is contained in:
commit
652bd9822d
@ -22,6 +22,12 @@ from ceilometer.openstack.common import log as logging
|
||||
from nova import db
|
||||
from ceilometer.compute.manager import AgentManager
|
||||
|
||||
try:
|
||||
from nova.conductor import api
|
||||
instance_info_source = api.API()
|
||||
except ImportError:
|
||||
from nova import db as instance_info_source
|
||||
|
||||
# This module runs inside the nova compute
|
||||
# agent, which only configures the "nova" logger.
|
||||
# We use a fake logger name in that namespace
|
||||
@ -59,14 +65,5 @@ def notify(context, message):
|
||||
if message['event_type'] == 'compute.instance.delete.start':
|
||||
instance_id = message['payload']['instance_id']
|
||||
LOG.debug('polling final stats for %r', instance_id)
|
||||
try:
|
||||
from nova.conductor import api
|
||||
except ImportError:
|
||||
# Keep compatibility with folsom.
|
||||
_agent_manager.poll_instance(context,
|
||||
db.instance_get_by_uuid(context, instance_id))
|
||||
else:
|
||||
conductor_api = api.API()
|
||||
_agent_manager.poll_instance(context,
|
||||
conductor_api.instance_get_by_uuid(context, instance_id))
|
||||
return
|
||||
_agent_manager.poll_instance(context,
|
||||
instance_info_source.instance_get_by_uuid(context, instance_id))
|
||||
|
Loading…
x
Reference in New Issue
Block a user