Merge "Correct logging translation markers"
This commit is contained in:
commit
43974d8ccd
@ -11,7 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.i18n import _
|
||||
from karbor.i18n import _LI
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_service import loopingcall
|
||||
@ -52,7 +52,7 @@ class SyncCheckpointStatusTask(task.Task):
|
||||
self._status_getters = status_getters
|
||||
|
||||
def execute(self, checkpoint):
|
||||
LOG.info(_("Start sync checkpoint status,checkpoint_id:%s"),
|
||||
LOG.info(_LI("Start sync checkpoint status,checkpoint_id: %s"),
|
||||
checkpoint.id)
|
||||
sync_status = loopingcall.FixedIntervalLoopingCall(
|
||||
self._sync_status, checkpoint, self._status_getters)
|
||||
@ -76,9 +76,9 @@ class SyncCheckpointStatusTask(task.Task):
|
||||
else:
|
||||
checkpoint.status = constants.CHECKPOINT_STATUS_AVAILABLE
|
||||
checkpoint.commit()
|
||||
LOG.info(_("Stop sync checkpoint status,checkpoint_id:"
|
||||
"%(checkpoint_id)s,checkpoint status:"
|
||||
"%(checkpoint_status)s") %
|
||||
LOG.info(_LI("Stop sync checkpoint status,checkpoint_id: "
|
||||
"%(checkpoint_id)s,checkpoint status: "
|
||||
"%(checkpoint_status)s"),
|
||||
{"checkpoint_id": checkpoint.id,
|
||||
"checkpoint_status": checkpoint.status})
|
||||
raise loopingcall.LoopingCallDone()
|
||||
|
@ -16,7 +16,7 @@ from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_service import loopingcall
|
||||
|
||||
from karbor.i18n import _, _LE
|
||||
from karbor.i18n import _LE, _LI
|
||||
from karbor.services.protection.client_factory import ClientFactory
|
||||
from karbor.services.protection.restore_heat import HeatTemplate
|
||||
from taskflow import task
|
||||
@ -42,7 +42,7 @@ class CreateStackTask(task.Task):
|
||||
|
||||
def execute(self):
|
||||
stack_name = "restore_%s" % str(uuid4())
|
||||
LOG.info(_("creating stack, stack_name:%s"), stack_name)
|
||||
LOG.info(_LI("creating stack, stack_name: %s"), stack_name)
|
||||
try:
|
||||
body = self._heat_client.stacks.create(
|
||||
stack_name=stack_name,
|
||||
@ -61,7 +61,7 @@ class SyncStackStatusTask(task.Task):
|
||||
self._checkpoint = checkpoint
|
||||
|
||||
def execute(self, stack_id):
|
||||
LOG.info(_("syncing stack status, stack_id:%s"), stack_id)
|
||||
LOG.info(_LI("syncing stack status, stack_id: %s"), stack_id)
|
||||
sync_status_loop = loopingcall.FixedIntervalLoopingCall(
|
||||
self._sync_status, self._checkpoint, stack_id)
|
||||
sync_status_loop.start(interval=CONF.sync_status_interval)
|
||||
@ -75,7 +75,7 @@ class SyncStackStatusTask(task.Task):
|
||||
|
||||
raise loopingcall.LoopingCallDone()
|
||||
except Exception:
|
||||
LOG.info(_("stop sync stack status, stack_id:%s"), stack_id)
|
||||
LOG.info(_LI("stop sync stack status, stack_id: %s"), stack_id)
|
||||
raise
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.i18n import _
|
||||
from karbor.i18n import _LI
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_service import loopingcall
|
||||
@ -36,7 +36,7 @@ class SyncCheckpointStatusTask(task.Task):
|
||||
self._checkpoint = checkpoint
|
||||
|
||||
def execute(self):
|
||||
LOG.info(_("Start sync checkpoint status,checkpoint_id:%s"),
|
||||
LOG.info(_LI("Start sync checkpoint status,checkpoint_id:%s"),
|
||||
self._checkpoint.id)
|
||||
sync_status = loopingcall.FixedIntervalLoopingCall(
|
||||
self._sync_status, self._checkpoint, self._status_getters)
|
||||
@ -48,9 +48,9 @@ class SyncCheckpointStatusTask(task.Task):
|
||||
resource_id = s.get('resource_id')
|
||||
get_resource_stats = s.get('get_resource_stats')
|
||||
statuses.add(get_resource_stats(checkpoint, resource_id))
|
||||
LOG.info(_("Start sync checkpoint status,checkpoint_id:"
|
||||
"%(checkpoint_id)s, resource_status:"
|
||||
"%(resource_status)s") %
|
||||
LOG.info(_LI("Start sync checkpoint status,checkpoint_id:"
|
||||
"%(checkpoint_id)s, resource_status:"
|
||||
"%(resource_status)s") %
|
||||
{"checkpoint_id": checkpoint.id,
|
||||
"resource_status": statuses})
|
||||
if constants.RESOURCE_STATUS_ERROR in statuses:
|
||||
@ -59,9 +59,9 @@ class SyncCheckpointStatusTask(task.Task):
|
||||
raise loopingcall.LoopingCallDone()
|
||||
elif statuses == {constants.RESOURCE_STATUS_DELETED, }:
|
||||
checkpoint.delete()
|
||||
LOG.info(_("Stop sync checkpoint status,checkpoint_id:"
|
||||
"%(checkpoint_id)s,checkpoint status:"
|
||||
"%(checkpoint_status)s") %
|
||||
LOG.info(_LI("Stop sync checkpoint status,checkpoint_id: "
|
||||
"%(checkpoint_id)s,checkpoint status: "
|
||||
"%(checkpoint_status)s"),
|
||||
{"checkpoint_id": checkpoint.id,
|
||||
"checkpoint_status": checkpoint.status})
|
||||
raise loopingcall.LoopingCallDone()
|
||||
@ -74,7 +74,7 @@ def get_flow(context, workflow_engine, operation_type, checkpoint, provider):
|
||||
'workflow_engine': workflow_engine,
|
||||
'operation_type': operation_type,
|
||||
}
|
||||
LOG.info(_("Start get checkpoint flow,checkpoint_id:%s"),
|
||||
LOG.info(_LI("Start get checkpoint flow,checkpoint_id: %s"),
|
||||
checkpoint.id)
|
||||
flow_name = "delete_checkpoint_" + checkpoint.id
|
||||
delete_flow = workflow_engine.build_flow(flow_name, 'linear')
|
||||
|
@ -16,7 +16,7 @@ import os
|
||||
from io import BytesIO
|
||||
from karbor.common import constants
|
||||
from karbor import exception
|
||||
from karbor.i18n import _, _LE
|
||||
from karbor.i18n import _LE, _LI
|
||||
from karbor.services.protection.client_factory import ClientFactory
|
||||
from karbor.services.protection.protection_plugins.base_protection_plugin \
|
||||
import BaseProtectionPlugin
|
||||
@ -82,7 +82,7 @@ class GlanceProtectionPlugin(BaseProtectionPlugin):
|
||||
resource_definition = {"resource_id": image_id}
|
||||
glance_client = self._glance_client(cntxt)
|
||||
|
||||
LOG.info(_("creating image backup, image_id: %s."), image_id)
|
||||
LOG.info(_LI("creating image backup, image_id: %s."), image_id)
|
||||
try:
|
||||
bank_section.create_object("status",
|
||||
constants.RESOURCE_STATUS_PROTECTING)
|
||||
@ -138,7 +138,7 @@ class GlanceProtectionPlugin(BaseProtectionPlugin):
|
||||
# update resource_definition backup_status
|
||||
bank_section.update_object("status",
|
||||
constants.RESOURCE_STATUS_AVAILABLE)
|
||||
LOG.info(_("finish backup image, image_id: %s."), image_id)
|
||||
LOG.info(_LI("finish backup image, image_id: %s."), image_id)
|
||||
except Exception as err:
|
||||
# update resource_definition backup_status
|
||||
LOG.error(_LE("create image backup failed, image_id: %s."),
|
||||
@ -156,7 +156,7 @@ class GlanceProtectionPlugin(BaseProtectionPlugin):
|
||||
heat_template = kwargs.get("heat_template")
|
||||
|
||||
name = kwargs.get("restore_name", "karbor-restore-image")
|
||||
LOG.info(_("restoring image backup, image_id: %s."),
|
||||
LOG.info(_LI("restoring image backup, image_id: %s."),
|
||||
original_image_id)
|
||||
|
||||
glance_client = self._glance_client(cntxt)
|
||||
|
@ -18,7 +18,7 @@ from uuid import uuid4
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor import exception
|
||||
from karbor.i18n import _, _LE
|
||||
from karbor.i18n import _LE, _LI
|
||||
from karbor.services.protection.client_factory import ClientFactory
|
||||
from karbor.services.protection.protection_plugins.base_protection_plugin \
|
||||
import BaseProtectionPlugin
|
||||
@ -93,7 +93,7 @@ class NovaProtectionPlugin(BaseProtectionPlugin):
|
||||
child_nodes = resource_node.child_nodes
|
||||
attach_metadata = {}
|
||||
|
||||
LOG.info(_("creating server backup, server_id: %s."), server_id)
|
||||
LOG.info(_LI("creating server backup, server_id: %s."), server_id)
|
||||
|
||||
try:
|
||||
bank_section.create_object("status",
|
||||
@ -266,7 +266,7 @@ class NovaProtectionPlugin(BaseProtectionPlugin):
|
||||
# update resource_definition backup_status
|
||||
bank_section.update_object("status",
|
||||
constants.RESOURCE_STATUS_AVAILABLE)
|
||||
LOG.info(_("finish backup server, server_id: %s."), server_id)
|
||||
LOG.info(_LI("finish backup server, server_id: %s."), server_id)
|
||||
except Exception as err:
|
||||
LOG.error(_LE("create backup failed, server_id: %s."), server_id)
|
||||
bank_section.update_object("status",
|
||||
@ -284,7 +284,7 @@ class NovaProtectionPlugin(BaseProtectionPlugin):
|
||||
|
||||
restore_name = kwargs.get("restore_name", "karbor-restore-server")
|
||||
|
||||
LOG.info(_("restoring server backup, server_id: %s."),
|
||||
LOG.info(_LI("restoring server backup, server_id: %s."),
|
||||
original_server_id)
|
||||
|
||||
bank_section = checkpoint.get_resource_bank_section(original_server_id)
|
||||
@ -465,7 +465,7 @@ class NovaProtectionPlugin(BaseProtectionPlugin):
|
||||
resource_id = resource_node.value.id
|
||||
bank_section = checkpoint.get_resource_bank_section(resource_id)
|
||||
|
||||
LOG.info(_("deleting server backup, server_id: %s."), resource_id)
|
||||
LOG.info(_LI("deleting server backup, server_id: %s."), resource_id)
|
||||
|
||||
try:
|
||||
bank_section.update_object("status",
|
||||
|
@ -16,7 +16,7 @@ from uuid import uuid4
|
||||
from cinderclient.exceptions import NotFound
|
||||
from karbor.common import constants
|
||||
from karbor import exception
|
||||
from karbor.i18n import _, _LE
|
||||
from karbor.i18n import _LE, _LI
|
||||
from karbor.services.protection.client_factory import ClientFactory
|
||||
from karbor.services.protection.protection_plugins.base_protection_plugin \
|
||||
import BaseProtectionPlugin
|
||||
@ -82,7 +82,7 @@ class CinderProtectionPlugin(BaseProtectionPlugin):
|
||||
resource_definition = {"volume_id": volume_id}
|
||||
cinder_client = self._cinder_client(cntxt)
|
||||
|
||||
LOG.info(_("creating volume backup, volume_id: %s."), volume_id)
|
||||
LOG.info(_LI("creating volume backup, volume_id: %s."), volume_id)
|
||||
try:
|
||||
bank_section.create_object("status",
|
||||
constants.RESOURCE_STATUS_PROTECTING)
|
||||
@ -115,7 +115,7 @@ class CinderProtectionPlugin(BaseProtectionPlugin):
|
||||
|
||||
bank_section = checkpoint.get_resource_bank_section(resource_id)
|
||||
cinder_client = self._cinder_client(cntxt)
|
||||
LOG.info(_("deleting volume backup, volume_id: %s."), resource_id)
|
||||
LOG.info(_LI("deleting volume backup, volume_id: %s."), resource_id)
|
||||
try:
|
||||
bank_section.update_object("status",
|
||||
constants.RESOURCE_STATUS_DELETING)
|
||||
@ -164,10 +164,10 @@ class CinderProtectionPlugin(BaseProtectionPlugin):
|
||||
bank_section.update_object(
|
||||
"status",
|
||||
constants.RESOURCE_STATUS_DELETED)
|
||||
LOG.info(_("deleting volume backup finished."
|
||||
"backup id: %s"), backup_id)
|
||||
LOG.info(_LI("deleting volume backup finished, "
|
||||
"backup id: %s"), backup_id)
|
||||
else:
|
||||
LOG.error(_LE("deleting volume backup error.exc:%s."),
|
||||
LOG.error(_LE("deleting volume backup error.exc: %s"),
|
||||
six.text_type(exc))
|
||||
self.protection_resource_map.pop(resource_id)
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
from karbor.common import constants
|
||||
from karbor.i18n import _, _LE
|
||||
from karbor.i18n import _, _LE, _LI
|
||||
from karbor.services.protection.graph import GraphWalkerListener
|
||||
from oslo_log import log as logging
|
||||
|
||||
@ -66,7 +66,7 @@ class ResourceGraphWalkerListener(GraphWalkerListener):
|
||||
def on_node_enter(self, node, already_visited):
|
||||
resource = node.value
|
||||
resource_type = resource.type
|
||||
LOG.info(_("on_node_enter, node resource_type:%s"), resource_type)
|
||||
LOG.info(_LI("on_node_enter, node resource_type: %s"), resource_type)
|
||||
protection_plugin = self._get_protection_plugin(resource_type)
|
||||
|
||||
# get node context
|
||||
@ -87,7 +87,7 @@ class ResourceGraphWalkerListener(GraphWalkerListener):
|
||||
def on_node_exit(self, node):
|
||||
resource = node.value
|
||||
resource_type = resource.type
|
||||
LOG.info(_("on_node_exit, node resource_type:%s"), resource_type)
|
||||
LOG.info(_LI("on_node_exit, node resource_type: %s"), resource_type)
|
||||
protection_plugin = self._get_protection_plugin(resource_type)
|
||||
|
||||
# get node context
|
||||
|
@ -114,8 +114,8 @@ def load_plugin(namespace, plugin_name, *args, **kwargs):
|
||||
try:
|
||||
plugin_class = importutils.import_class(plugin_name)
|
||||
except ImportError as e2:
|
||||
LOG.exception(_LE("Error loading plugin by name, %s"), e1)
|
||||
LOG.exception(_LE("Error loading plugin by class, %s"), e2)
|
||||
LOG.error(_LE("Error loading plugin by name, %s"), e1)
|
||||
LOG.error(_LE("Error loading plugin by class, %s"), e2)
|
||||
raise ImportError(_("Class not found."))
|
||||
return plugin_class(*args, **kwargs)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user