Remove log translations
Remove log translations Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: I35f03250707b8103b6f6b12cb16a1ebcea2aa925 Signed-off-by: Ranler Cao <caoran@fiberhome.com> Closes-Bug: #1674547 Signed-off-by: Ranler Cao <caoran@fiberhome.com>
This commit is contained in:
parent
c4c4422601
commit
cadcd46d38
@ -37,9 +37,6 @@ from nova.compute import flavors
|
|||||||
from nova.compute import power_state
|
from nova.compute import power_state
|
||||||
from nova import exception
|
from nova import exception
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
from nova.i18n import _LE
|
|
||||||
from nova.i18n import _LI
|
|
||||||
from nova.i18n import _LW
|
|
||||||
from nova import objects
|
from nova import objects
|
||||||
from nova.objects import fields
|
from nova.objects import fields
|
||||||
from nova import utils
|
from nova import utils
|
||||||
@ -427,15 +424,15 @@ class DockerDriver(driver.ComputeDriver):
|
|||||||
def _cleanup_instance_file(self, id):
|
def _cleanup_instance_file(self, id):
|
||||||
dir = os.path.join(CONF.instances_path, id)
|
dir = os.path.join(CONF.instances_path, id)
|
||||||
if os.path.exists(dir):
|
if os.path.exists(dir):
|
||||||
LOG.info(_LI('Deleting instance files %s'), dir)
|
LOG.info('Deleting instance files %s', dir)
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(dir)
|
shutil.rmtree(dir)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
LOG.error(_LE('Failed to cleanup directory %(target)s: '
|
LOG.error(('Failed to cleanup directory %(target)s: '
|
||||||
'%(e)s'), {'target': dir, 'e': e})
|
'%(e)s'), {'target': dir, 'e': e})
|
||||||
|
|
||||||
def _neutron_failed_callback(self, event_name, instance):
|
def _neutron_failed_callback(self, event_name, instance):
|
||||||
LOG.error(_LE('Neutron Reported failure on event '
|
LOG.error(('Neutron Reported failure on event '
|
||||||
'%(event)s for instance %(uuid)s'),
|
'%(event)s for instance %(uuid)s'),
|
||||||
{'event': event_name, 'uuid': instance.uuid},
|
{'event': event_name, 'uuid': instance.uuid},
|
||||||
instance=instance)
|
instance=instance)
|
||||||
@ -469,7 +466,7 @@ class DockerDriver(driver.ComputeDriver):
|
|||||||
self.plug_vifs(instance, network_info)
|
self.plug_vifs(instance, network_info)
|
||||||
self._attach_vifs(instance, network_info)
|
self._attach_vifs(instance, network_info)
|
||||||
except eventlet.timeout.Timeout:
|
except eventlet.timeout.Timeout:
|
||||||
LOG.warning(_LW('Timeout waiting for vif plugging callback for '
|
LOG.warning(('Timeout waiting for vif plugging callback for '
|
||||||
'instance %(uuid)s'), {'uuid': instance['name']})
|
'instance %(uuid)s'), {'uuid': instance['name']})
|
||||||
if CONF.vif_plugging_is_fatal:
|
if CONF.vif_plugging_is_fatal:
|
||||||
self.docker.kill(container_id)
|
self.docker.kill(container_id)
|
||||||
|
@ -20,7 +20,6 @@ import pecan
|
|||||||
from zun.api import config as api_config
|
from zun.api import config as api_config
|
||||||
from zun.api import middleware
|
from zun.api import middleware
|
||||||
from zun.common import config as common_config
|
from zun.common import config as common_config
|
||||||
from zun.common.i18n import _LI
|
|
||||||
import zun.conf
|
import zun.conf
|
||||||
|
|
||||||
CONF = zun.conf.CONF
|
CONF = zun.conf.CONF
|
||||||
@ -60,7 +59,7 @@ def load_app():
|
|||||||
|
|
||||||
if not cfg_file:
|
if not cfg_file:
|
||||||
raise cfg.ConfigFilesNotFoundError([CONF.api.api_paste_config])
|
raise cfg.ConfigFilesNotFoundError([CONF.api.api_paste_config])
|
||||||
LOG.info(_LI("Full WSGI config used: %s"), cfg_file)
|
LOG.info("Full WSGI config used: %s", cfg_file)
|
||||||
return deploy.loadapp("config:" + cfg_file)
|
return deploy.loadapp("config:" + cfg_file)
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ from oslo_utils import uuidutils
|
|||||||
|
|
||||||
from zun.common import exception
|
from zun.common import exception
|
||||||
from zun.common.i18n import _
|
from zun.common.i18n import _
|
||||||
from zun.common.i18n import _LE
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
restricted_name_chars = '[a-zA-Z0-9][a-zA-Z0-9_.-]'
|
restricted_name_chars = '[a-zA-Z0-9][a-zA-Z0-9_.-]'
|
||||||
@ -106,7 +105,7 @@ class Integer(object):
|
|||||||
try:
|
try:
|
||||||
value = int(value)
|
value = int(value)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_LE('Failed to convert value to int'))
|
LOG.exception('Failed to convert value to int')
|
||||||
raise exception.InvalidValue(value=value, type=cls.type_name)
|
raise exception.InvalidValue(value=value, type=cls.type_name)
|
||||||
|
|
||||||
if minimum is not None and value < minimum:
|
if minimum is not None and value < minimum:
|
||||||
@ -142,7 +141,7 @@ class Float(object):
|
|||||||
try:
|
try:
|
||||||
value = float(value)
|
value = float(value)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_LE('Failed to convert value to float'))
|
LOG.exception('Failed to convert value to float')
|
||||||
raise exception.InvalidValue(value=value, type=cls.type_name)
|
raise exception.InvalidValue(value=value, type=cls.type_name)
|
||||||
|
|
||||||
return value
|
return value
|
||||||
@ -160,7 +159,7 @@ class Bool(object):
|
|||||||
try:
|
try:
|
||||||
value = strutils.bool_from_string(value, strict=True)
|
value = strutils.bool_from_string(value, strict=True)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_LE('Failed to convert value to bool'))
|
LOG.exception('Failed to convert value to bool')
|
||||||
raise exception.InvalidValue(value=value, type=cls.type_name)
|
raise exception.InvalidValue(value=value, type=cls.type_name)
|
||||||
|
|
||||||
return value
|
return value
|
||||||
@ -180,7 +179,7 @@ class Custom(object):
|
|||||||
try:
|
try:
|
||||||
value = self.user_class(**value)
|
value = self.user_class(**value)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_LE('Failed to validate received value'))
|
LOG.exception('Failed to validate received value')
|
||||||
raise exception.InvalidValue(value=value, type=self.type_name)
|
raise exception.InvalidValue(value=value, type=self.type_name)
|
||||||
|
|
||||||
return value
|
return value
|
||||||
@ -202,7 +201,7 @@ class List(object):
|
|||||||
try:
|
try:
|
||||||
return [self.type.validate(v) for v in value]
|
return [self.type.validate(v) for v in value]
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_LE('Failed to validate received value'))
|
LOG.exception('Failed to validate received value')
|
||||||
raise exception.InvalidValue(value=value, type=self.type_name)
|
raise exception.InvalidValue(value=value, type=self.type_name)
|
||||||
|
|
||||||
|
|
||||||
@ -237,7 +236,7 @@ class Dict(object):
|
|||||||
return {self.key_type.validate(k): self.value_type.validate(v)
|
return {self.key_type.validate(k): self.value_type.validate(v)
|
||||||
for k, v in value.items()}
|
for k, v in value.items()}
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_LE('Failed to validate received value'))
|
LOG.exception('Failed to validate received value')
|
||||||
raise exception.InvalidValue(value=value, type=self.type_name)
|
raise exception.InvalidValue(value=value, type=self.type_name)
|
||||||
|
|
||||||
|
|
||||||
@ -281,7 +280,7 @@ class MemoryType(object):
|
|||||||
value[:-1].isdigit() and value[-1] in VALID_UNITS.keys()):
|
value[:-1].isdigit() and value[-1] in VALID_UNITS.keys()):
|
||||||
if int(value[:-1]) * VALID_UNITS[value[-1]] >= MIN_MEMORY_SIZE:
|
if int(value[:-1]) * VALID_UNITS[value[-1]] >= MIN_MEMORY_SIZE:
|
||||||
return value
|
return value
|
||||||
LOG.exception(_LE('Failed to validate container memory value'))
|
LOG.exception('Failed to validate container memory value')
|
||||||
message = """
|
message = """
|
||||||
memory must be either integer or string of below format.
|
memory must be either integer or string of below format.
|
||||||
<integer><memory_unit> memory_unit must be 'k','b','m','g'
|
<integer><memory_unit> memory_unit must be 'k','b','m','g'
|
||||||
@ -303,7 +302,7 @@ class ImageSize(object):
|
|||||||
value[:-1].isdigit() and value[-1] in VALID_UNITS.keys()):
|
value[:-1].isdigit() and value[-1] in VALID_UNITS.keys()):
|
||||||
return int(value[:-1]) * VALID_UNITS[value[-1]]
|
return int(value[:-1]) * VALID_UNITS[value[-1]]
|
||||||
else:
|
else:
|
||||||
LOG.exception(_LE('Failed to validate image size'))
|
LOG.exception('Failed to validate image size')
|
||||||
message = _("""
|
message = _("""
|
||||||
size must be either integer or string of below format.
|
size must be either integer or string of below format.
|
||||||
<integer><memory_unit> memory_unit must be 'k','b','m','g'
|
<integer><memory_unit> memory_unit must be 'k','b','m','g'
|
||||||
|
@ -26,7 +26,6 @@ from zun.api.controllers.v1.views import containers_view as view
|
|||||||
from zun.api import utils as api_utils
|
from zun.api import utils as api_utils
|
||||||
from zun.common import exception
|
from zun.common import exception
|
||||||
from zun.common.i18n import _
|
from zun.common.i18n import _
|
||||||
from zun.common.i18n import _LE
|
|
||||||
from zun.common import name_generator
|
from zun.common import name_generator
|
||||||
from zun.common import policy
|
from zun.common import policy
|
||||||
from zun.common import utils
|
from zun.common import utils
|
||||||
@ -43,7 +42,7 @@ LOG = logging.getLogger(__name__)
|
|||||||
def _get_container(container_id):
|
def _get_container(container_id):
|
||||||
container = api_utils.get_resource('Container', container_id)
|
container = api_utils.get_resource('Container', container_id)
|
||||||
if not container:
|
if not container:
|
||||||
pecan.abort(404, _LE('Not found; the container you requested '
|
pecan.abort(404, ('Not found; the container you requested '
|
||||||
'does not exist.'))
|
'does not exist.'))
|
||||||
|
|
||||||
return container
|
return container
|
||||||
@ -144,7 +143,7 @@ class ContainersController(rest.RestController):
|
|||||||
try:
|
try:
|
||||||
containers[i] = compute_api.container_show(context, c)
|
containers[i] = compute_api.container_show(context, c)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Error while list container %(uuid)s: "
|
LOG.exception(("Error while list container %(uuid)s: "
|
||||||
"%(e)s."),
|
"%(e)s."),
|
||||||
{'uuid': c.uuid, 'e': e})
|
{'uuid': c.uuid, 'e': e})
|
||||||
containers[i].status = fields.ContainerStatus.UNKNOWN
|
containers[i].status = fields.ContainerStatus.UNKNOWN
|
||||||
@ -183,7 +182,7 @@ class ContainersController(rest.RestController):
|
|||||||
count = int(num)
|
count = int(num)
|
||||||
if name in ['unless-stopped', 'always']:
|
if name in ['unless-stopped', 'always']:
|
||||||
if count != 0:
|
if count != 0:
|
||||||
raise exception.InvalidValue(_LE("maximum retry "
|
raise exception.InvalidValue(("maximum retry "
|
||||||
"count not valid "
|
"count not valid "
|
||||||
"with restart policy "
|
"with restart policy "
|
||||||
"of %s") % name)
|
"of %s") % name)
|
||||||
|
@ -18,7 +18,6 @@ import sys
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_service import service
|
from oslo_service import service
|
||||||
|
|
||||||
from zun.common.i18n import _LI
|
|
||||||
from zun.common import rpc_service
|
from zun.common import rpc_service
|
||||||
from zun.common import service as zun_service
|
from zun.common import service as zun_service
|
||||||
from zun.compute import manager as compute_manager
|
from zun.compute import manager as compute_manager
|
||||||
@ -31,7 +30,7 @@ LOG = logging.getLogger(__name__)
|
|||||||
def main():
|
def main():
|
||||||
zun_service.prepare_service(sys.argv)
|
zun_service.prepare_service(sys.argv)
|
||||||
|
|
||||||
LOG.info(_LI('Starting server in PID %s'), os.getpid())
|
LOG.info('Starting server in PID %s', os.getpid())
|
||||||
CONF.log_opt_values(LOG, logging.DEBUG)
|
CONF.log_opt_values(LOG, logging.DEBUG)
|
||||||
|
|
||||||
CONF.import_opt('topic', 'zun.conf.compute', group='compute')
|
CONF.import_opt('topic', 'zun.conf.compute', group='compute')
|
||||||
|
@ -32,7 +32,6 @@ import pecan
|
|||||||
import six
|
import six
|
||||||
|
|
||||||
from zun.common.i18n import _
|
from zun.common.i18n import _
|
||||||
from zun.common.i18n import _LE
|
|
||||||
import zun.conf
|
import zun.conf
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -118,7 +117,7 @@ def wrap_controller_exception(func, func_server_error, func_client_error):
|
|||||||
# log the error message with its associated
|
# log the error message with its associated
|
||||||
# correlation id
|
# correlation id
|
||||||
log_correlation_id = uuidutils.generate_uuid()
|
log_correlation_id = uuidutils.generate_uuid()
|
||||||
LOG.exception(_LE("%(correlation_id)s:%(excp)s") %
|
LOG.exception("%(correlation_id)s:%(excp)s" %
|
||||||
{'correlation_id': log_correlation_id,
|
{'correlation_id': log_correlation_id,
|
||||||
'excp': str(excp)})
|
'excp': str(excp)})
|
||||||
# raise a client error with an obfuscated message
|
# raise a client error with an obfuscated message
|
||||||
@ -195,7 +194,7 @@ class ZunException(Exception):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
# kwargs doesn't match a variable in the message
|
# kwargs doesn't match a variable in the message
|
||||||
# log the issue and the kwargs
|
# log the issue and the kwargs
|
||||||
LOG.exception(_LE('Exception in string format operation, '
|
LOG.exception(('Exception in string format operation, '
|
||||||
'kwargs: %s') % kwargs)
|
'kwargs: %s') % kwargs)
|
||||||
try:
|
try:
|
||||||
ferr = CONF.fatal_exception_format_errors
|
ferr = CONF.fatal_exception_format_errors
|
||||||
|
@ -23,13 +23,3 @@ _translators = oslo_i18n.TranslatorFactory(domain='zun')
|
|||||||
|
|
||||||
# The primary translation function using the well-known name "_"
|
# The primary translation function using the well-known name "_"
|
||||||
_ = _translators.primary
|
_ = _translators.primary
|
||||||
|
|
||||||
# Translators for log levels.
|
|
||||||
#
|
|
||||||
# The abbreviated names are meant to reflect the usual use of a short
|
|
||||||
# name like '_'. The "L" is for "log" and the other letter comes from
|
|
||||||
# the level.
|
|
||||||
_LI = _translators.log_info
|
|
||||||
_LW = _translators.log_warning
|
|
||||||
_LE = _translators.log_error
|
|
||||||
_LC = _translators.log_critical
|
|
||||||
|
@ -18,7 +18,6 @@ from keystoneclient.v3 import client as kc_v3
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from zun.common import exception
|
from zun.common import exception
|
||||||
from zun.common.i18n import _LE
|
|
||||||
import zun.conf
|
import zun.conf
|
||||||
|
|
||||||
CONF = zun.conf.CONF
|
CONF = zun.conf.CONF
|
||||||
@ -80,7 +79,7 @@ class KeystoneClientV3(object):
|
|||||||
auth = ka_v3.Token(auth_url=self.auth_url,
|
auth = ka_v3.Token(auth_url=self.auth_url,
|
||||||
token=self.context.auth_token)
|
token=self.context.auth_token)
|
||||||
else:
|
else:
|
||||||
msg = _LE('Keystone API connection failed: no password, '
|
msg = ('Keystone API connection failed: no password, '
|
||||||
'trust_id or token found.')
|
'trust_id or token found.')
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.AuthorizationFailure(client='keystone',
|
raise exception.AuthorizationFailure(client='keystone',
|
||||||
|
@ -22,7 +22,6 @@ from oslo_utils import uuidutils
|
|||||||
from zun.common import clients
|
from zun.common import clients
|
||||||
from zun.common import exception
|
from zun.common import exception
|
||||||
from zun.common.i18n import _
|
from zun.common.i18n import _
|
||||||
from zun.common.i18n import _LW
|
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -95,14 +94,14 @@ class NovaClient(object):
|
|||||||
try:
|
try:
|
||||||
server = self.client().servers.get(server_id)
|
server = self.client().servers.get(server_id)
|
||||||
except exceptions.OverLimit as exc:
|
except exceptions.OverLimit as exc:
|
||||||
LOG.warning(_LW("Received an OverLimit response when "
|
LOG.warning(("Received an OverLimit response when "
|
||||||
"fetching server (%(id)s) : %(exception)s"),
|
"fetching server (%(id)s) : %(exception)s"),
|
||||||
{'id': server_id,
|
{'id': server_id,
|
||||||
'exception': exc})
|
'exception': exc})
|
||||||
except exceptions.ClientException as exc:
|
except exceptions.ClientException as exc:
|
||||||
if ((getattr(exc, 'http_status', getattr(exc, 'code', None)) in
|
if ((getattr(exc, 'http_status', getattr(exc, 'code', None)) in
|
||||||
(500, 503))):
|
(500, 503))):
|
||||||
LOG.warning(_LW("Received the following exception when "
|
LOG.warning(("Received the following exception when "
|
||||||
"fetching server (%(id)s) : %(exception)s"),
|
"fetching server (%(id)s) : %(exception)s"),
|
||||||
{'id': server_id,
|
{'id': server_id,
|
||||||
'exception': exc})
|
'exception': exc})
|
||||||
@ -118,7 +117,7 @@ class NovaClient(object):
|
|||||||
try:
|
try:
|
||||||
server.get()
|
server.get()
|
||||||
except exceptions.OverLimit as exc:
|
except exceptions.OverLimit as exc:
|
||||||
LOG.warning(_LW("Server %(name)s (%(id)s) received an OverLimit "
|
LOG.warning(("Server %(name)s (%(id)s) received an OverLimit "
|
||||||
"response during server.get(): %(exception)s"),
|
"response during server.get(): %(exception)s"),
|
||||||
{'name': server.name,
|
{'name': server.name,
|
||||||
'id': server.id,
|
'id': server.id,
|
||||||
@ -126,7 +125,7 @@ class NovaClient(object):
|
|||||||
except exceptions.ClientException as exc:
|
except exceptions.ClientException as exc:
|
||||||
if ((getattr(exc, 'http_status', getattr(exc, 'code', None)) in
|
if ((getattr(exc, 'http_status', getattr(exc, 'code', None)) in
|
||||||
(500, 503))):
|
(500, 503))):
|
||||||
LOG.warning(_LW('Server "%(name)s" (%(id)s) received the '
|
LOG.warning(('Server "%(name)s" (%(id)s) received the '
|
||||||
'following exception during server.get(): '
|
'following exception during server.get(): '
|
||||||
'%(exception)s'),
|
'%(exception)s'),
|
||||||
{'name': server.name,
|
{'name': server.name,
|
||||||
@ -236,7 +235,7 @@ class NovaClient(object):
|
|||||||
server_id = self.get_server_id(server)
|
server_id = self.get_server_id(server)
|
||||||
server = self.client().servers.get(server_id)
|
server = self.client().servers.get(server_id)
|
||||||
except exceptions.NotFound as ex:
|
except exceptions.NotFound as ex:
|
||||||
LOG.warning(_LW('Instance (%(server)s) not found: %(ex)s'),
|
LOG.warning('Instance (%(server)s) not found: %(ex)s',
|
||||||
{'server': server, 'ex': ex})
|
{'server': server, 'ex': ex})
|
||||||
else:
|
else:
|
||||||
return server.addresses
|
return server.addresses
|
||||||
|
@ -28,8 +28,6 @@ import six
|
|||||||
|
|
||||||
from zun.common import exception
|
from zun.common import exception
|
||||||
from zun.common.i18n import _
|
from zun.common.i18n import _
|
||||||
from zun.common.i18n import _LE
|
|
||||||
from zun.common.i18n import _LW
|
|
||||||
import zun.conf
|
import zun.conf
|
||||||
|
|
||||||
CONF = zun.conf.CONF
|
CONF = zun.conf.CONF
|
||||||
@ -71,7 +69,7 @@ def safe_rstrip(value, chars=None):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
if not isinstance(value, six.string_types):
|
if not isinstance(value, six.string_types):
|
||||||
LOG.warning(_LW(
|
LOG.warning((
|
||||||
"Failed to remove trailing character. Returning original object. "
|
"Failed to remove trailing character. Returning original object. "
|
||||||
"Supplied object is not a string: %s."
|
"Supplied object is not a string: %s."
|
||||||
), value)
|
), value)
|
||||||
@ -147,7 +145,7 @@ def translate_exception(function):
|
|||||||
return function(self, context, *args, **kwargs)
|
return function(self, context, *args, **kwargs)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if not isinstance(e, exception.ZunException):
|
if not isinstance(e, exception.ZunException):
|
||||||
LOG.exception(_LE("Unexpected error: %s"), six.text_type(e))
|
LOG.exception("Unexpected error: %s", six.text_type(e))
|
||||||
e = exception.ZunException("Unexpected error: %s"
|
e = exception.ZunException("Unexpected error: %s"
|
||||||
% six.text_type(e))
|
% six.text_type(e))
|
||||||
raise e
|
raise e
|
||||||
@ -196,7 +194,7 @@ def poll_until(retriever, condition=lambda value: value,
|
|||||||
LOG.error(timeout_msg)
|
LOG.error(timeout_msg)
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception occurred: %s"),
|
LOG.exception("Unexpected exception occurred: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from zun.common import exception
|
from zun.common import exception
|
||||||
from zun.common.i18n import _LI
|
|
||||||
from zun.common.i18n import _LW
|
|
||||||
from zun import objects
|
from zun import objects
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -35,7 +33,7 @@ class ComputeNodeTracker(object):
|
|||||||
node = objects.NodeInfo(context)
|
node = objects.NodeInfo(context)
|
||||||
node.hostname = self.host
|
node.hostname = self.host
|
||||||
node.create()
|
node.create()
|
||||||
LOG.info(_LI('Node created for :%(host)s'), {'host': self.host})
|
LOG.info('Node created for :%(host)s', {'host': self.host})
|
||||||
self.container_driver.get_available_resources(node)
|
self.container_driver.get_available_resources(node)
|
||||||
# NOTE(sbiswas7): Consider removing the return statement if not needed
|
# NOTE(sbiswas7): Consider removing the return statement if not needed
|
||||||
return node
|
return node
|
||||||
@ -45,5 +43,5 @@ class ComputeNodeTracker(object):
|
|||||||
try:
|
try:
|
||||||
return objects.NodeInfo.get_by_hostname(context, self.host)
|
return objects.NodeInfo.get_by_hostname(context, self.host)
|
||||||
except exception.NotFound:
|
except exception.NotFound:
|
||||||
LOG.warning(_LW("No compute node record for: %(host)s"),
|
LOG.warning("No compute node record for: %(host)s",
|
||||||
{'host': self.host})
|
{'host': self.host})
|
||||||
|
@ -18,7 +18,6 @@ from oslo_log import log as logging
|
|||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from zun.common import exception
|
from zun.common import exception
|
||||||
from zun.common.i18n import _LE
|
|
||||||
from zun.common import utils
|
from zun.common import utils
|
||||||
from zun.common.utils import translate_exception
|
from zun.common.utils import translate_exception
|
||||||
import zun.conf
|
import zun.conf
|
||||||
@ -59,7 +58,7 @@ class Manager(object):
|
|||||||
try:
|
try:
|
||||||
self.driver.delete_sandbox(context, sandbox_id)
|
self.driver.delete_sandbox(context, sandbox_id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(_LE("Error occurred while deleting sandbox: %s"),
|
LOG.error("Error occurred while deleting sandbox: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
|
|
||||||
def _do_container_create(self, context, container, reraise=False):
|
def _do_container_create(self, context, container, reraise=False):
|
||||||
@ -82,7 +81,7 @@ class Manager(object):
|
|||||||
image=sandbox_image)
|
image=sandbox_image)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.exception(_LE("Unexpected exception: %s"),
|
LOG.exception("Unexpected exception: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
self._fail_container(context, container, six.text_type(e))
|
self._fail_container(context, container, six.text_type(e))
|
||||||
return
|
return
|
||||||
@ -107,15 +106,14 @@ class Manager(object):
|
|||||||
return
|
return
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.error(_LE(
|
LOG.error("Error occurred while calling Docker image API: %s",
|
||||||
"Error occurred while calling Docker image API: %s"),
|
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
self._do_sandbox_cleanup(context, sandbox_id)
|
self._do_sandbox_cleanup(context, sandbox_id)
|
||||||
self._fail_container(context, container, six.text_type(e))
|
self._fail_container(context, container, six.text_type(e))
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.exception(_LE("Unexpected exception: %s"),
|
LOG.exception("Unexpected exception: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
self._do_sandbox_cleanup(context, sandbox_id)
|
self._do_sandbox_cleanup(context, sandbox_id)
|
||||||
self._fail_container(context, container, six.text_type(e))
|
self._fail_container(context, container, six.text_type(e))
|
||||||
@ -134,15 +132,14 @@ class Manager(object):
|
|||||||
return container
|
return container
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.error(_LE(
|
LOG.error("Error occurred while calling Docker create API: %s",
|
||||||
"Error occurred while calling Docker create API: %s"),
|
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
self._do_sandbox_cleanup(context, sandbox_id)
|
self._do_sandbox_cleanup(context, sandbox_id)
|
||||||
self._fail_container(context, container, six.text_type(e))
|
self._fail_container(context, container, six.text_type(e))
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.exception(_LE("Unexpected exception: %s"),
|
LOG.exception("Unexpected exception: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
self._do_sandbox_cleanup(context, sandbox_id)
|
self._do_sandbox_cleanup(context, sandbox_id)
|
||||||
self._fail_container(context, container, six.text_type(e))
|
self._fail_container(context, container, six.text_type(e))
|
||||||
@ -159,13 +156,12 @@ class Manager(object):
|
|||||||
return container
|
return container
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.error(_LE(
|
LOG.error("Error occurred while calling Docker start API: %s",
|
||||||
"Error occurred while calling Docker start API: %s"),
|
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
self._fail_container(context, container, six.text_type(e))
|
self._fail_container(context, container, six.text_type(e))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.exception(_LE("Unexpected exception: %s"),
|
LOG.exception("Unexpected exception: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
self._fail_container(context, container, six.text_type(e))
|
self._fail_container(context, container, six.text_type(e))
|
||||||
|
|
||||||
@ -177,12 +173,12 @@ class Manager(object):
|
|||||||
try:
|
try:
|
||||||
self.driver.delete(container, force)
|
self.driver.delete(container, force)
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
LOG.error(_LE("Error occurred while calling Docker "
|
LOG.error(("Error occurred while calling Docker "
|
||||||
"delete API: %s"), six.text_type(e))
|
"delete API: %s"), six.text_type(e))
|
||||||
self._fail_container(context, container, six.text_type(e))
|
self._fail_container(context, container, six.text_type(e))
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||||
self._fail_container(context, container, six.text_type(e))
|
self._fail_container(context, container, six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -193,7 +189,7 @@ class Manager(object):
|
|||||||
try:
|
try:
|
||||||
self.driver.delete_sandbox(context, sandbox_id)
|
self.driver.delete_sandbox(context, sandbox_id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception: %s"),
|
LOG.exception("Unexpected exception: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
self._fail_container(context, container, six.text_type(e))
|
self._fail_container(context, container, six.text_type(e))
|
||||||
raise
|
raise
|
||||||
@ -208,11 +204,11 @@ class Manager(object):
|
|||||||
try:
|
try:
|
||||||
return self.driver.list()
|
return self.driver.list()
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
LOG.error(_LE("Error occurred while calling Docker list API: %s"),
|
LOG.error("Error occurred while calling Docker list API: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@translate_exception
|
@translate_exception
|
||||||
@ -223,11 +219,11 @@ class Manager(object):
|
|||||||
container.save(context)
|
container.save(context)
|
||||||
return container
|
return container
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
LOG.error(_LE("Error occurred while calling Docker show API: %s"),
|
LOG.error("Error occurred while calling Docker show API: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def _do_container_reboot(self, context, container, timeout, reraise=False):
|
def _do_container_reboot(self, context, container, timeout, reraise=False):
|
||||||
@ -241,12 +237,12 @@ class Manager(object):
|
|||||||
return container
|
return container
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.error(_LE("Error occurred while calling Docker reboot "
|
LOG.error(("Error occurred while calling Docker reboot "
|
||||||
"API: %s"), six.text_type(e))
|
"API: %s"), six.text_type(e))
|
||||||
self._fail_container(context, container, six.text_type(e))
|
self._fail_container(context, container, six.text_type(e))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.exception(_LE("Unexpected exception: %s"),
|
LOG.exception("Unexpected exception: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
self._fail_container(context, container, six.text_type(e))
|
self._fail_container(context, container, six.text_type(e))
|
||||||
|
|
||||||
@ -264,13 +260,12 @@ class Manager(object):
|
|||||||
return container
|
return container
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.error(_LE(
|
LOG.error("Error occurred while calling Docker stop API: %s",
|
||||||
"Error occurred while calling Docker stop API: %s"),
|
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
self._fail_container(context, container, six.text_type(e))
|
self._fail_container(context, container, six.text_type(e))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.exception(_LE("Unexpected exception: %s"),
|
LOG.exception("Unexpected exception: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
self._fail_container(context, container, six.text_type(e))
|
self._fail_container(context, container, six.text_type(e))
|
||||||
|
|
||||||
@ -288,12 +283,11 @@ class Manager(object):
|
|||||||
return container
|
return container
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.error(_LE(
|
LOG.error("Error occurred while calling Docker pause API: %s",
|
||||||
"Error occurred while calling Docker pause API: %s"),
|
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.exception(_LE("Unexpected exception: %s,"),
|
LOG.exception("Unexpected exception: %s,",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
|
|
||||||
def container_pause(self, context, container):
|
def container_pause(self, context, container):
|
||||||
@ -307,12 +301,12 @@ class Manager(object):
|
|||||||
return container
|
return container
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.error(_LE(
|
LOG.error(
|
||||||
"Error occurred while calling Docker unpause API: %s"),
|
"Error occurred while calling Docker unpause API: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.exception(_LE("Unexpected exception: %s"),
|
LOG.exception("Unexpected exception: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
|
|
||||||
def container_unpause(self, context, container):
|
def container_unpause(self, context, container):
|
||||||
@ -328,11 +322,11 @@ class Manager(object):
|
|||||||
timestamps=timestamps, tail=tail,
|
timestamps=timestamps, tail=tail,
|
||||||
since=since)
|
since=since)
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
LOG.error(_LE("Error occurred while calling Docker logs API: %s"),
|
LOG.error("Error occurred while calling Docker logs API: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@translate_exception
|
@translate_exception
|
||||||
@ -342,11 +336,11 @@ class Manager(object):
|
|||||||
try:
|
try:
|
||||||
return self.driver.execute(container, command)
|
return self.driver.execute(container, command)
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
LOG.error(_LE("Error occurred while calling Docker exec API: %s"),
|
LOG.error("Error occurred while calling Docker exec API: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def _do_container_kill(self, context, container, signal, reraise=False):
|
def _do_container_kill(self, context, container, signal, reraise=False):
|
||||||
@ -357,8 +351,7 @@ class Manager(object):
|
|||||||
return container
|
return container
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.error(_LE(
|
LOG.error("Error occurred while calling Docker kill API: %s",
|
||||||
"Error occurred while calling Docker kill API: %s"),
|
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
|
|
||||||
def container_kill(self, context, container, signal):
|
def container_kill(self, context, container, signal):
|
||||||
@ -375,7 +368,7 @@ class Manager(object):
|
|||||||
try:
|
try:
|
||||||
self.driver.update(container)
|
self.driver.update(container)
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
LOG.error(_LE("Error occurred while calling docker API: %s"),
|
LOG.error("Error occurred while calling docker API: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -388,7 +381,7 @@ class Manager(object):
|
|||||||
try:
|
try:
|
||||||
url = self.driver.get_websocket_url(container)
|
url = self.driver.get_websocket_url(container)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(_LE("Error occurred while calling "
|
LOG.error(("Error occurred while calling "
|
||||||
"get websocket url function: %s"),
|
"get websocket url function: %s"),
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
@ -400,7 +393,7 @@ class Manager(object):
|
|||||||
try:
|
try:
|
||||||
container = self.driver.resize(container, height, width)
|
container = self.driver.resize(container, height, width)
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
LOG.error(_LE("Error occurred while calling docker "
|
LOG.error(("Error occurred while calling docker "
|
||||||
"resize API: %s"),
|
"resize API: %s"),
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
@ -413,11 +406,11 @@ class Manager(object):
|
|||||||
try:
|
try:
|
||||||
return self.driver.top(container, ps_args)
|
return self.driver.top(container, ps_args)
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
LOG.error(_LE("Error occurred while calling Docker top API: %s"),
|
LOG.error("Error occurred while calling Docker top API: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@translate_exception
|
@translate_exception
|
||||||
@ -426,12 +419,12 @@ class Manager(object):
|
|||||||
try:
|
try:
|
||||||
return self.driver.get_archive(container, path)
|
return self.driver.get_archive(container, path)
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
LOG.error(_LE(
|
LOG.error(
|
||||||
"Error occurred while calling Docker get_archive API: %s"),
|
"Error occurred while calling Docker get_archive API: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@translate_exception
|
@translate_exception
|
||||||
@ -440,12 +433,12 @@ class Manager(object):
|
|||||||
try:
|
try:
|
||||||
return self.driver.put_archive(container, path, data)
|
return self.driver.put_archive(container, path, data)
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
LOG.error(_LE(
|
LOG.error(
|
||||||
"Error occurred while calling Docker put_archive API: %s"),
|
"Error occurred while calling Docker put_archive API: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception: %s"), six.text_type(e))
|
LOG.exception("Unexpected exception: %s", six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def image_pull(self, context, image):
|
def image_pull(self, context, image):
|
||||||
@ -467,11 +460,11 @@ class Manager(object):
|
|||||||
LOG.error(six.text_type(e))
|
LOG.error(six.text_type(e))
|
||||||
return
|
return
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
LOG.error(_LE("Error occurred while calling Docker image API: %s"),
|
LOG.error("Error occurred while calling Docker image API: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception: %s"),
|
LOG.exception("Unexpected exception: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -482,8 +475,8 @@ class Manager(object):
|
|||||||
return image_driver.search_image(context, image,
|
return image_driver.search_image(context, image,
|
||||||
image_driver_name, exact_match)
|
image_driver_name, exact_match)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception while searching "
|
LOG.exception("Unexpected exception while searching image: %s",
|
||||||
"image: %s"), six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def _get_container_addresses(self, context, container):
|
def _get_container_addresses(self, context, container):
|
||||||
@ -491,10 +484,10 @@ class Manager(object):
|
|||||||
try:
|
try:
|
||||||
return self.driver.get_addresses(context, container)
|
return self.driver.get_addresses(context, container)
|
||||||
except exception.DockerError as e:
|
except exception.DockerError as e:
|
||||||
LOG.error(_LE("Error occurred while calling Docker API: %s"),
|
LOG.error("Error occurred while calling Docker API: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception: %s"),
|
LOG.exception("Unexpected exception: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
@ -20,9 +20,6 @@ from oslo_utils import timeutils
|
|||||||
|
|
||||||
from zun.common import exception
|
from zun.common import exception
|
||||||
from zun.common.i18n import _
|
from zun.common.i18n import _
|
||||||
from zun.common.i18n import _LE
|
|
||||||
from zun.common.i18n import _LI
|
|
||||||
from zun.common.i18n import _LW
|
|
||||||
from zun.common import nova
|
from zun.common import nova
|
||||||
from zun.common import utils
|
from zun.common import utils
|
||||||
from zun.common.utils import check_container_id
|
from zun.common.utils import check_container_id
|
||||||
@ -141,7 +138,7 @@ class DockerDriver(driver.ContainerDriver):
|
|||||||
st = datetime.datetime.strptime((status_time[:19]),
|
st = datetime.datetime.strptime((status_time[:19]),
|
||||||
'%Y-%m-%dT%H:%M:%S')
|
'%Y-%m-%dT%H:%M:%S')
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
LOG.exception(_LE("Error on parse {} : {}").format(status_time, e))
|
LOG.exception("Error on parse {} : {}".format(status_time, e))
|
||||||
return
|
return
|
||||||
|
|
||||||
if st == datetime.datetime(1, 1, 1):
|
if st == datetime.datetime(1, 1, 1):
|
||||||
@ -414,7 +411,7 @@ class DockerDriver(driver.ContainerDriver):
|
|||||||
if container.meta:
|
if container.meta:
|
||||||
return container.meta.get('sandbox_id', None)
|
return container.meta.get('sandbox_id', None)
|
||||||
else:
|
else:
|
||||||
LOG.warning(_LW("Unexpected missing of sandbox_id"))
|
LOG.warning("Unexpected missing of sandbox_id")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def set_sandbox_id(self, container, sandbox_id):
|
def set_sandbox_id(self, container, sandbox_id):
|
||||||
@ -475,8 +472,8 @@ class NovaDockerDriver(DockerDriver):
|
|||||||
def _check_active():
|
def _check_active():
|
||||||
return novaclient.check_active(server)
|
return novaclient.check_active(server)
|
||||||
|
|
||||||
success_msg = _LI("Created server %s successfully.") % server.id
|
success_msg = "Created server %s successfully." % server.id
|
||||||
timeout_msg = _LE("Failed to create server %s. Timeout waiting for "
|
timeout_msg = ("Failed to create server %s. Timeout waiting for "
|
||||||
"server to become active.") % server.id
|
"server to become active.") % server.id
|
||||||
utils.poll_until(_check_active,
|
utils.poll_until(_check_active,
|
||||||
sleep_time=CONF.default_sleep_time,
|
sleep_time=CONF.default_sleep_time,
|
||||||
@ -488,7 +485,7 @@ class NovaDockerDriver(DockerDriver):
|
|||||||
novaclient = nova.NovaClient(elevated)
|
novaclient = nova.NovaClient(elevated)
|
||||||
server_name = self._find_server_by_container_id(sandbox_id)
|
server_name = self._find_server_by_container_id(sandbox_id)
|
||||||
if not server_name:
|
if not server_name:
|
||||||
LOG.warning(_LW("Cannot find server name for sandbox %s") %
|
LOG.warning("Cannot find server name for sandbox %s" %
|
||||||
sandbox_id)
|
sandbox_id)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -500,7 +497,7 @@ class NovaDockerDriver(DockerDriver):
|
|||||||
novaclient = nova.NovaClient(elevated)
|
novaclient = nova.NovaClient(elevated)
|
||||||
server_name = self._find_server_by_container_id(sandbox_id)
|
server_name = self._find_server_by_container_id(sandbox_id)
|
||||||
if not server_name:
|
if not server_name:
|
||||||
LOG.warning(_LW("Cannot find server name for sandbox %s") %
|
LOG.warning("Cannot find server name for sandbox %s" %
|
||||||
sandbox_id)
|
sandbox_id)
|
||||||
return
|
return
|
||||||
novaclient.stop_server(server_name)
|
novaclient.stop_server(server_name)
|
||||||
@ -510,8 +507,8 @@ class NovaDockerDriver(DockerDriver):
|
|||||||
def _check_delete_complete():
|
def _check_delete_complete():
|
||||||
return novaclient.check_delete_server_complete(server_id)
|
return novaclient.check_delete_server_complete(server_id)
|
||||||
|
|
||||||
success_msg = _LI("Delete server %s successfully.") % server_id
|
success_msg = "Delete server %s successfully." % server_id
|
||||||
timeout_msg = _LE("Failed to create server %s. Timeout waiting for "
|
timeout_msg = ("Failed to create server %s. Timeout waiting for "
|
||||||
"server to be deleted.") % server_id
|
"server to be deleted.") % server_id
|
||||||
utils.poll_until(_check_delete_complete,
|
utils.poll_until(_check_delete_complete,
|
||||||
sleep_time=CONF.default_sleep_time,
|
sleep_time=CONF.default_sleep_time,
|
||||||
|
@ -17,8 +17,6 @@ from oslo_log import log as logging
|
|||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
|
|
||||||
from zun.common.i18n import _
|
from zun.common.i18n import _
|
||||||
from zun.common.i18n import _LE
|
|
||||||
from zun.common.i18n import _LI
|
|
||||||
import zun.conf
|
import zun.conf
|
||||||
from zun.container.os_capability.linux import os_capability_linux
|
from zun.container.os_capability.linux import os_capability_linux
|
||||||
from zun import objects
|
from zun import objects
|
||||||
@ -39,11 +37,11 @@ def load_container_driver(container_driver=None):
|
|||||||
if not container_driver:
|
if not container_driver:
|
||||||
container_driver = CONF.container_driver
|
container_driver = CONF.container_driver
|
||||||
if not container_driver:
|
if not container_driver:
|
||||||
LOG.error(_LE("Container driver option required, "
|
LOG.error(("Container driver option required, "
|
||||||
"but not specified"))
|
"but not specified"))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
LOG.info(_LI("Loading container driver '%s'"), container_driver)
|
LOG.info("Loading container driver '%s'", container_driver)
|
||||||
try:
|
try:
|
||||||
if not container_driver.startswith('zun.'):
|
if not container_driver.startswith('zun.'):
|
||||||
container_driver = 'zun.container.%s' % container_driver
|
container_driver = 'zun.container.%s' % container_driver
|
||||||
@ -54,7 +52,7 @@ def load_container_driver(container_driver=None):
|
|||||||
|
|
||||||
return driver
|
return driver
|
||||||
except ImportError:
|
except ImportError:
|
||||||
LOG.exception(_LE("Unable to load the container driver"))
|
LOG.exception("Unable to load the container driver")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ import six
|
|||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from zun.common import exception
|
from zun.common import exception
|
||||||
from zun.common.i18n import _LE
|
|
||||||
from zun.container.os_capability import host_capability
|
from zun.container.os_capability import host_capability
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +34,7 @@ class LinuxHost(host_capability.Host):
|
|||||||
try:
|
try:
|
||||||
output = processutils.execute('lscpu', '-p=socket,cpu,online')
|
output = processutils.execute('lscpu', '-p=socket,cpu,online')
|
||||||
except processutils.ProcessExecutionError as e:
|
except processutils.ProcessExecutionError as e:
|
||||||
LOG.exception(_LE("There was a problem while executing lscpu "
|
LOG.exception(("There was a problem while executing lscpu "
|
||||||
"-p=socket,cpu,online : %s"), six.text_type(e))
|
"-p=socket,cpu,online : %s"), six.text_type(e))
|
||||||
# There is a possibility that an older version of lscpu is used
|
# There is a possibility that an older version of lscpu is used
|
||||||
# So let's try without the online column
|
# So let's try without the online column
|
||||||
@ -43,7 +42,7 @@ class LinuxHost(host_capability.Host):
|
|||||||
output = processutils.execute('lscpu', '-p=socket,cpu')
|
output = processutils.execute('lscpu', '-p=socket,cpu')
|
||||||
old_lscpu = True
|
old_lscpu = True
|
||||||
except processutils.ProcessExecutionError as e:
|
except processutils.ProcessExecutionError as e:
|
||||||
LOG.exception(_LE("There was a problem while executing lscpu "
|
LOG.exception(("There was a problem while executing lscpu "
|
||||||
"-p=socket,cpu : %s"), six.text_type(e))
|
"-p=socket,cpu : %s"), six.text_type(e))
|
||||||
raise exception.CommandError(cmd="lscpu")
|
raise exception.CommandError(cmd="lscpu")
|
||||||
if old_lscpu:
|
if old_lscpu:
|
||||||
|
@ -26,7 +26,6 @@ import six
|
|||||||
|
|
||||||
from zun.common import exception
|
from zun.common import exception
|
||||||
from zun.common.i18n import _
|
from zun.common.i18n import _
|
||||||
from zun.common.i18n import _LE
|
|
||||||
from zun.common import singleton
|
from zun.common import singleton
|
||||||
import zun.conf
|
import zun.conf
|
||||||
from zun.db.etcd import models
|
from zun.db.etcd import models
|
||||||
@ -83,7 +82,7 @@ def translate_etcd_result(etcd_result, model_type):
|
|||||||
_('The model_type value: %s is invalid.'), model_type)
|
_('The model_type value: %s is invalid.'), model_type)
|
||||||
return ret
|
return ret
|
||||||
except (ValueError, TypeError) as e:
|
except (ValueError, TypeError) as e:
|
||||||
LOG.error(_LE("Error occurred while translating etcd result: %s"),
|
LOG.error("Error occurred while translating etcd result: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -102,7 +101,7 @@ class EtcdAPI(object):
|
|||||||
if d.key in ('/containers',):
|
if d.key in ('/containers',):
|
||||||
self.client.delete(d.key, recursive=True)
|
self.client.delete(d.key, recursive=True)
|
||||||
except etcd.EtcdKeyNotFound as e:
|
except etcd.EtcdKeyNotFound as e:
|
||||||
LOG.error(_LE('Error occurred while cleaning zun data: %s'),
|
LOG.error('Error occurred while cleaning zun data: %s',
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -152,7 +151,7 @@ class EtcdAPI(object):
|
|||||||
return []
|
return []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(
|
LOG.error(
|
||||||
_LE("Error occurred while reading from etcd server: %s"),
|
"Error occurred while reading from etcd server: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -183,7 +182,7 @@ class EtcdAPI(object):
|
|||||||
except etcd.EtcdKeyNotFound:
|
except etcd.EtcdKeyNotFound:
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(_LE('Error occurred while retrieving container: %s'),
|
LOG.error('Error occurred while retrieving container: %s',
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
if len(containers) > 0:
|
if len(containers) > 0:
|
||||||
@ -221,7 +220,7 @@ class EtcdAPI(object):
|
|||||||
except etcd.EtcdKeyNotFound:
|
except etcd.EtcdKeyNotFound:
|
||||||
raise exception.ContainerNotFound(container=container_uuid)
|
raise exception.ContainerNotFound(container=container_uuid)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(_LE('Error occurred while retrieving container: %s'),
|
LOG.error('Error occurred while retrieving container: %s',
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -233,7 +232,7 @@ class EtcdAPI(object):
|
|||||||
except etcd.EtcdKeyNotFound:
|
except etcd.EtcdKeyNotFound:
|
||||||
raise exception.ContainerNotFound(container=container_name)
|
raise exception.ContainerNotFound(container=container_name)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(_LE('Error occurred while retrieving container: %s'),
|
LOG.error('Error occurred while retrieving container: %s',
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -273,7 +272,7 @@ class EtcdAPI(object):
|
|||||||
except etcd.EtcdKeyNotFound:
|
except etcd.EtcdKeyNotFound:
|
||||||
raise exception.ContainerNotFound(container=container_uuid)
|
raise exception.ContainerNotFound(container=container_uuid)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(_LE('Error occurred while updating container: %s'),
|
LOG.error('Error occurred while updating container: %s',
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -292,12 +291,12 @@ class EtcdAPI(object):
|
|||||||
res = getattr(self.client.read('/zun_services'), 'children', None)
|
res = getattr(self.client.read('/zun_services'), 'children', None)
|
||||||
except etcd.EtcdKeyNotFound:
|
except etcd.EtcdKeyNotFound:
|
||||||
LOG.error(
|
LOG.error(
|
||||||
_LE("Path '/zun_services' does not exist, seems etcd server "
|
("Path '/zun_services' does not exist, seems etcd server "
|
||||||
"was not been initialized appropriately for Zun."))
|
"was not been initialized appropriately for Zun."))
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(
|
LOG.error(
|
||||||
_LE("Error occurred while reading from etcd server: %s"),
|
"Error occurred while reading from etcd server: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -322,7 +321,7 @@ class EtcdAPI(object):
|
|||||||
except etcd.EtcdKeyNotFound:
|
except etcd.EtcdKeyNotFound:
|
||||||
raise exception.ZunServiceNotFound(host=host, binary=binary)
|
raise exception.ZunServiceNotFound(host=host, binary=binary)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(_LE('Error occurred while retrieving zun service: %s'),
|
LOG.error('Error occurred while retrieving zun service: %s',
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
@ -335,7 +334,7 @@ class EtcdAPI(object):
|
|||||||
except etcd.EtcdKeyNotFound:
|
except etcd.EtcdKeyNotFound:
|
||||||
raise exception.ZunServiceNotFound(host=host, binary=binary)
|
raise exception.ZunServiceNotFound(host=host, binary=binary)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(_LE('Error occurred while destroying zun service: %s'),
|
LOG.error('Error occurred while destroying zun service: %s',
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -351,7 +350,7 @@ class EtcdAPI(object):
|
|||||||
except etcd.EtcdKeyNotFound:
|
except etcd.EtcdKeyNotFound:
|
||||||
raise exception.ZunServiceNotFound(host=host, binary=binary)
|
raise exception.ZunServiceNotFound(host=host, binary=binary)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(_LE('Error occurred while updating service: %s'),
|
LOG.error('Error occurred while updating service: %s',
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -385,7 +384,7 @@ class EtcdAPI(object):
|
|||||||
except etcd.EtcdKeyNotFound:
|
except etcd.EtcdKeyNotFound:
|
||||||
raise exception.ImageNotFound(image=image_uuid)
|
raise exception.ImageNotFound(image=image_uuid)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(_LE('Error occurred while updating image: %s'),
|
LOG.error('Error occurred while updating image: %s',
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -401,7 +400,7 @@ class EtcdAPI(object):
|
|||||||
return []
|
return []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(
|
LOG.error(
|
||||||
_LE("Error occurred while reading from etcd server: %s"),
|
"Error occurred while reading from etcd server: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -428,7 +427,7 @@ class EtcdAPI(object):
|
|||||||
except etcd.EtcdKeyNotFound:
|
except etcd.EtcdKeyNotFound:
|
||||||
raise exception.ImageNotFound(image=image_uuid)
|
raise exception.ImageNotFound(image=image_uuid)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(_LE('Error occurred while retrieving image: %s'),
|
LOG.error('Error occurred while retrieving image: %s',
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -448,7 +447,7 @@ class EtcdAPI(object):
|
|||||||
return []
|
return []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(
|
LOG.error(
|
||||||
_LE('Error occurred while reading from etcd server: %s'),
|
'Error occurred while reading from etcd server: %s',
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -486,7 +485,7 @@ class EtcdAPI(object):
|
|||||||
raise exception.ResourceClassNotFound(resource_class=uuid)
|
raise exception.ResourceClassNotFound(resource_class=uuid)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(
|
LOG.error(
|
||||||
_LE('Error occurred while retriving resource class: %s'),
|
'Error occurred while retriving resource class: %s',
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
return resource_class
|
return resource_class
|
||||||
@ -499,7 +498,7 @@ class EtcdAPI(object):
|
|||||||
raise exception.ResourceClassNotFound(resource_class=name)
|
raise exception.ResourceClassNotFound(resource_class=name)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(
|
LOG.error(
|
||||||
_LE('Error occurred while retriving resource class: %s'),
|
'Error occurred while retriving resource class: %s',
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -531,7 +530,7 @@ class EtcdAPI(object):
|
|||||||
raise exception.ResourceClassNotFound(resource_class=uuid)
|
raise exception.ResourceClassNotFound(resource_class=uuid)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(
|
LOG.error(
|
||||||
_LE('Error occurred while updating resource class: %s'),
|
'Error occurred while updating resource class: %s',
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
raise
|
raise
|
||||||
return translate_etcd_result(target, 'resource_class')
|
return translate_etcd_result(target, 'resource_class')
|
||||||
|
@ -20,8 +20,6 @@ import stevedore
|
|||||||
|
|
||||||
from zun.common import exception
|
from zun.common import exception
|
||||||
from zun.common.i18n import _
|
from zun.common.i18n import _
|
||||||
from zun.common.i18n import _LE
|
|
||||||
from zun.common.i18n import _LI
|
|
||||||
from zun.common.utils import parse_image_name
|
from zun.common.utils import parse_image_name
|
||||||
import zun.conf
|
import zun.conf
|
||||||
|
|
||||||
@ -39,11 +37,11 @@ def load_image_driver(image_driver=None):
|
|||||||
:returns: a ContainerImageDriver instance
|
:returns: a ContainerImageDriver instance
|
||||||
"""
|
"""
|
||||||
if not image_driver:
|
if not image_driver:
|
||||||
LOG.error(_LE("Container image driver option required, "
|
LOG.error(("Container image driver option required, "
|
||||||
"but not specified"))
|
"but not specified"))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
LOG.info(_LI("Loading container image driver '%s'"), image_driver)
|
LOG.info("Loading container image driver '%s'", image_driver)
|
||||||
try:
|
try:
|
||||||
driver = stevedore.driver.DriverManager(
|
driver = stevedore.driver.DriverManager(
|
||||||
"zun.image.driver",
|
"zun.image.driver",
|
||||||
@ -56,7 +54,7 @@ def load_image_driver(image_driver=None):
|
|||||||
|
|
||||||
return driver
|
return driver
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_LE("Unable to load the container image driver"))
|
LOG.exception("Unable to load the container image driver")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
@ -77,7 +75,7 @@ def pull_image(context, repo, tag, image_pull_policy, image_driver):
|
|||||||
except exception.ImageNotFound:
|
except exception.ImageNotFound:
|
||||||
image = None
|
image = None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE('Unknown exception occurred while loading '
|
LOG.exception(('Unknown exception occurred while loading '
|
||||||
'image: %s'), six.text_type(e))
|
'image: %s'), six.text_type(e))
|
||||||
raise exception.ZunException(six.text_type(e))
|
raise exception.ZunException(six.text_type(e))
|
||||||
if not image:
|
if not image:
|
||||||
@ -99,7 +97,7 @@ def search_image(context, image_name, image_driver, exact_match):
|
|||||||
exact_match=exact_match)
|
exact_match=exact_match)
|
||||||
images.extend(imgs)
|
images.extend(imgs)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE('Unknown exception occurred while searching '
|
LOG.exception(('Unknown exception occurred while searching '
|
||||||
'for image: %s'), six.text_type(e))
|
'for image: %s'), six.text_type(e))
|
||||||
raise exception.ZunException(six.text_type(e))
|
raise exception.ZunException(six.text_type(e))
|
||||||
return images
|
return images
|
||||||
|
@ -17,7 +17,6 @@ from oslo_utils import uuidutils
|
|||||||
|
|
||||||
from zun.common import clients
|
from zun.common import clients
|
||||||
from zun.common import exception
|
from zun.common import exception
|
||||||
from zun.common.i18n import _LE
|
|
||||||
|
|
||||||
|
|
||||||
def create_glanceclient(context):
|
def create_glanceclient(context):
|
||||||
@ -35,7 +34,7 @@ def find_image(context, image_ident):
|
|||||||
if len(matches) == 0:
|
if len(matches) == 0:
|
||||||
raise exception.ImageNotFound(image=image_ident)
|
raise exception.ImageNotFound(image=image_ident)
|
||||||
if len(matches) > 1:
|
if len(matches) > 1:
|
||||||
msg = _LE("Multiple images exist with same name "
|
msg = ("Multiple images exist with same name "
|
||||||
"%(image_ident)s. Please use the image id "
|
"%(image_ident)s. Please use the image id "
|
||||||
"instead.") % {'image_ident': image_ident}
|
"instead.") % {'image_ident': image_ident}
|
||||||
raise exception.Conflict(msg)
|
raise exception.Conflict(msg)
|
||||||
|
@ -16,7 +16,6 @@ Filter support
|
|||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from zun.common.i18n import _LI
|
|
||||||
from zun.scheduler import loadables
|
from zun.scheduler import loadables
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -87,7 +86,7 @@ class BaseFilterHandler(loadables.BaseLoader):
|
|||||||
for obj in list_objs]
|
for obj in list_objs]
|
||||||
full_filter_results.append((cls_name, remaining))
|
full_filter_results.append((cls_name, remaining))
|
||||||
else:
|
else:
|
||||||
LOG.info(_LI("Filter %s returned 0 hosts"), cls_name)
|
LOG.info("Filter %s returned 0 hosts", cls_name)
|
||||||
full_filter_results.append((cls_name, None))
|
full_filter_results.append((cls_name, None))
|
||||||
break
|
break
|
||||||
LOG.debug("Filter %(cls_name)s returned "
|
LOG.debug("Filter %(cls_name)s returned "
|
||||||
@ -102,7 +101,7 @@ class BaseFilterHandler(loadables.BaseLoader):
|
|||||||
"'%(cnt_uuid)s'. Filter results: %(str_results)s"
|
"'%(cnt_uuid)s'. Filter results: %(str_results)s"
|
||||||
) % msg_dict
|
) % msg_dict
|
||||||
msg_dict["str_results"] = str(part_filter_results)
|
msg_dict["str_results"] = str(part_filter_results)
|
||||||
part_msg = _LI("Filtering removed all hosts for the request with "
|
part_msg = ("Filtering removed all hosts for the request with "
|
||||||
"container ID "
|
"container ID "
|
||||||
"'%(cnt_uuid)s'. Filter results: %(str_results)s"
|
"'%(cnt_uuid)s'. Filter results: %(str_results)s"
|
||||||
) % msg_dict
|
) % msg_dict
|
||||||
|
@ -18,7 +18,6 @@ from oslo_log import log
|
|||||||
from oslo_service import periodic_task
|
from oslo_service import periodic_task
|
||||||
|
|
||||||
from zun.common import context
|
from zun.common import context
|
||||||
from zun.common.i18n import _LE
|
|
||||||
from zun.container import driver
|
from zun.container import driver
|
||||||
from zun import objects
|
from zun import objects
|
||||||
from zun.objects import fields
|
from zun.objects import fields
|
||||||
@ -90,7 +89,7 @@ class ContainerStatusSyncPeriodicJob(periodic_task.PeriodicTasks):
|
|||||||
LOG.info(msg % (updated_container.uuid, old_status,
|
LOG.info(msg % (updated_container.uuid, old_status,
|
||||||
updated_container.status))
|
updated_container.status))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception: %s"),
|
LOG.exception("Unexpected exception: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
|
|
||||||
for container_id in deleted_containers:
|
for container_id in deleted_containers:
|
||||||
@ -108,7 +107,7 @@ class ContainerStatusSyncPeriodicJob(periodic_task.PeriodicTasks):
|
|||||||
LOG.info(msg % (updated_container.uuid, old_status,
|
LOG.info(msg % (updated_container.uuid, old_status,
|
||||||
updated_container.status))
|
updated_container.status))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_LE("Unexpected exception: %s"),
|
LOG.exception("Unexpected exception: %s",
|
||||||
six.text_type(e))
|
six.text_type(e))
|
||||||
|
|
||||||
LOG.debug('Update container status end')
|
LOG.debug('Update container status end')
|
||||||
|
Loading…
Reference in New Issue
Block a user