Prepare for future i18n use of _() in nova notifier.

Use the correct verion of _() function in nova notifier.

This is part of the blueprint gettext-i18n-issue.

Change-Id: I5204d7268c4c6124c7aef9c88cd4efacf7d00b5b
This commit is contained in:
Lianhao Lu 2013-04-03 14:50:36 +08:00
parent 40fa8f43b9
commit 9d77054863
2 changed files with 10 additions and 7 deletions

View File

@ -25,6 +25,7 @@ from nova import db as instance_info_source
from oslo.config import cfg
from ceilometer.compute import manager as compute_manager
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log as logging
# This module runs inside the nova compute
@ -58,7 +59,7 @@ 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)
LOG.debug(_('polling final stats for %r'), instance_id)
_agent_manager.poll_instance(context,
instance_info_source.instance_get_by_uuid(
context,

View File

@ -44,6 +44,8 @@ from oslo.config import cfg
from ceilometer import extension_manager
from ceilometer.compute.virt import inspector
from ceilometer.openstack.common.gettextutils import _
# This module runs inside the nova compute
# agent, which only configures the "nova" logger.
@ -86,10 +88,10 @@ def initialize_gatherer(gatherer=None):
"""
global _gatherer
if gatherer is not None:
LOG.debug('using provided stats gatherer %r', gatherer)
LOG.debug(_('using provided stats gatherer %r'), gatherer)
_gatherer = gatherer
if _gatherer is None:
LOG.debug('making a new stats gatherer')
LOG.debug(_('making a new stats gatherer'))
mgr = extension_manager.ActivatedExtensionManager(
namespace='ceilometer.poll.compute',
disabled_names=cfg.CONF.disabled_compute_pollsters,
@ -109,7 +111,7 @@ class Instance(object):
def __init__(self, info):
for k, v in info.iteritems():
setattr(self, k, v)
LOG.debug('INFO %r', info)
LOG.debug(_('INFO %r'), info)
@property
def tenant_id(self):
@ -133,13 +135,13 @@ class Instance(object):
def notify(context, message):
if message['event_type'] != 'compute.instance.delete.start':
LOG.debug('ignoring %s', message['event_type'])
LOG.debug(_('ignoring %s'), message['event_type'])
return
LOG.info('processing %s', message['event_type'])
LOG.info(_('processing %s'), message['event_type'])
gatherer = initialize_gatherer()
instance_id = message['payload']['instance_id']
LOG.debug('polling final stats for %r', instance_id)
LOG.debug(_('polling final stats for %r'), instance_id)
# Ask for the instance details
instance_ref = instance_info_source.instance_get_by_uuid(