container: Remove a bunch of logging translations
Change-Id: I849d08af90c59cf96ad205f651d8a179f354f0ac Partial-Bug: #1674543
This commit is contained in:
parent
8bda234e40
commit
7cfacbb258
|
@ -18,7 +18,6 @@ import os
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
import math
|
import math
|
||||||
from swift import gettext_ as _
|
|
||||||
|
|
||||||
from eventlet import Timeout
|
from eventlet import Timeout
|
||||||
|
|
||||||
|
@ -238,10 +237,10 @@ class ContainerController(BaseStorageServer):
|
||||||
if len(account_hosts) != len(account_devices):
|
if len(account_hosts) != len(account_devices):
|
||||||
# This shouldn't happen unless there's a bug in the proxy,
|
# This shouldn't happen unless there's a bug in the proxy,
|
||||||
# but if there is, we want to know about it.
|
# but if there is, we want to know about it.
|
||||||
self.logger.error(_(
|
self.logger.error(
|
||||||
'ERROR Account update failed: different '
|
'ERROR Account update failed: different '
|
||||||
'numbers of hosts and devices in request: '
|
'numbers of hosts and devices in request: '
|
||||||
'"%(hosts)s" vs "%(devices)s"') % {
|
'"%(hosts)s" vs "%(devices)s"', {
|
||||||
'hosts': req.headers.get('X-Account-Host', ''),
|
'hosts': req.headers.get('X-Account-Host', ''),
|
||||||
'devices': req.headers.get('X-Account-Device', '')})
|
'devices': req.headers.get('X-Account-Device', '')})
|
||||||
return HTTPBadRequest(req=req)
|
return HTTPBadRequest(req=req)
|
||||||
|
@ -284,18 +283,18 @@ class ContainerController(BaseStorageServer):
|
||||||
if account_response.status == HTTP_NOT_FOUND:
|
if account_response.status == HTTP_NOT_FOUND:
|
||||||
account_404s += 1
|
account_404s += 1
|
||||||
elif not is_success(account_response.status):
|
elif not is_success(account_response.status):
|
||||||
self.logger.error(_(
|
self.logger.error(
|
||||||
'ERROR Account update failed '
|
'ERROR Account update failed '
|
||||||
'with %(ip)s:%(port)s/%(device)s (will retry '
|
'with %(ip)s:%(port)s/%(device)s (will retry '
|
||||||
'later): Response %(status)s %(reason)s'),
|
'later): Response %(status)s %(reason)s',
|
||||||
{'ip': account_ip, 'port': account_port,
|
{'ip': account_ip, 'port': account_port,
|
||||||
'device': account_device,
|
'device': account_device,
|
||||||
'status': account_response.status,
|
'status': account_response.status,
|
||||||
'reason': account_response.reason})
|
'reason': account_response.reason})
|
||||||
except (Exception, Timeout):
|
except (Exception, Timeout):
|
||||||
self.logger.exception(_(
|
self.logger.exception(
|
||||||
'ERROR account update failed with '
|
'ERROR account update failed with '
|
||||||
'%(ip)s:%(port)s/%(device)s (will retry later)'),
|
'%(ip)s:%(port)s/%(device)s (will retry later)',
|
||||||
{'ip': account_ip, 'port': account_port,
|
{'ip': account_ip, 'port': account_port,
|
||||||
'device': account_device})
|
'device': account_device})
|
||||||
if updates and account_404s == len(updates):
|
if updates and account_404s == len(updates):
|
||||||
|
@ -900,8 +899,8 @@ class ContainerController(BaseStorageServer):
|
||||||
except HTTPException as error_response:
|
except HTTPException as error_response:
|
||||||
res = error_response
|
res = error_response
|
||||||
except (Exception, Timeout):
|
except (Exception, Timeout):
|
||||||
self.logger.exception(_(
|
self.logger.exception(
|
||||||
'ERROR __call__ error with %(method)s %(path)s '),
|
'ERROR __call__ error with %(method)s %(path)s ',
|
||||||
{'method': req.method, 'path': req.path})
|
{'method': req.method, 'path': req.path})
|
||||||
res = HTTPInternalServerError(body=traceback.format_exc())
|
res = HTTPInternalServerError(body=traceback.format_exc())
|
||||||
if self.log_requests:
|
if self.log_requests:
|
||||||
|
|
|
@ -17,7 +17,6 @@ import collections
|
||||||
import errno
|
import errno
|
||||||
import os
|
import os
|
||||||
import uuid
|
import uuid
|
||||||
from swift import gettext_ as _
|
|
||||||
from time import ctime, time
|
from time import ctime, time
|
||||||
from random import choice, random
|
from random import choice, random
|
||||||
from struct import unpack_from
|
from struct import unpack_from
|
||||||
|
@ -233,9 +232,9 @@ class ContainerSync(Daemon):
|
||||||
internal_client_conf_path = conf.get('internal_client_conf_path')
|
internal_client_conf_path = conf.get('internal_client_conf_path')
|
||||||
if not internal_client_conf_path:
|
if not internal_client_conf_path:
|
||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
_('Configuration option internal_client_conf_path not '
|
'Configuration option internal_client_conf_path not '
|
||||||
'defined. Using default configuration, See '
|
'defined. Using default configuration, See '
|
||||||
'internal-client.conf-sample for options'))
|
'internal-client.conf-sample for options')
|
||||||
internal_client_conf = ConfigString(ic_conf_body)
|
internal_client_conf = ConfigString(ic_conf_body)
|
||||||
else:
|
else:
|
||||||
internal_client_conf = internal_client_conf_path
|
internal_client_conf = internal_client_conf_path
|
||||||
|
@ -248,8 +247,8 @@ class ContainerSync(Daemon):
|
||||||
not str(err).endswith(' not found'):
|
not str(err).endswith(' not found'):
|
||||||
raise
|
raise
|
||||||
raise SystemExit(
|
raise SystemExit(
|
||||||
_('Unable to load internal client from config: '
|
'Unable to load internal client from config: '
|
||||||
'%(conf)r (%(error)s)')
|
'%(conf)r (%(error)s)'
|
||||||
% {'conf': internal_client_conf_path, 'error': err})
|
% {'conf': internal_client_conf_path, 'error': err})
|
||||||
|
|
||||||
def run_forever(self, *args, **kwargs):
|
def run_forever(self, *args, **kwargs):
|
||||||
|
@ -272,7 +271,7 @@ class ContainerSync(Daemon):
|
||||||
"""
|
"""
|
||||||
Runs a single container sync scan.
|
Runs a single container sync scan.
|
||||||
"""
|
"""
|
||||||
self.logger.info(_('Begin container sync "once" mode'))
|
self.logger.info('Begin container sync "once" mode')
|
||||||
begin = time()
|
begin = time()
|
||||||
for path in self.sync_store.synced_containers_generator():
|
for path in self.sync_store.synced_containers_generator():
|
||||||
self.container_sync(path)
|
self.container_sync(path)
|
||||||
|
@ -281,7 +280,7 @@ class ContainerSync(Daemon):
|
||||||
self.report()
|
self.report()
|
||||||
elapsed = time() - begin
|
elapsed = time() - begin
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
_('Container sync "once" mode completed: %.02fs'), elapsed)
|
'Container sync "once" mode completed: %.02fs', elapsed)
|
||||||
|
|
||||||
def report(self):
|
def report(self):
|
||||||
"""
|
"""
|
||||||
|
@ -289,8 +288,8 @@ class ContainerSync(Daemon):
|
||||||
next report.
|
next report.
|
||||||
"""
|
"""
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
_('Since %(time)s: %(sync)s synced [%(delete)s deletes, %(put)s '
|
'Since %(time)s: %(sync)s synced [%(delete)s deletes, %(put)s '
|
||||||
'puts], %(skip)s skipped, %(fail)s failed'),
|
'puts], %(skip)s skipped, %(fail)s failed',
|
||||||
{'time': ctime(self.reported),
|
{'time': ctime(self.reported),
|
||||||
'sync': self.container_syncs,
|
'sync': self.container_syncs,
|
||||||
'delete': self.container_deletes,
|
'delete': self.container_deletes,
|
||||||
|
@ -306,16 +305,16 @@ class ContainerSync(Daemon):
|
||||||
|
|
||||||
def container_report(self, start, end, sync_point1, sync_point2, info,
|
def container_report(self, start, end, sync_point1, sync_point2, info,
|
||||||
max_row):
|
max_row):
|
||||||
self.logger.info(_('Container sync report: %(container)s, '
|
self.logger.info('Container sync report: %(container)s, '
|
||||||
'time window start: %(start)s, '
|
'time window start: %(start)s, '
|
||||||
'time window end: %(end)s, '
|
'time window end: %(end)s, '
|
||||||
'puts: %(puts)s, '
|
'puts: %(puts)s, '
|
||||||
'posts: %(posts)s, '
|
'posts: %(posts)s, '
|
||||||
'deletes: %(deletes)s, '
|
'deletes: %(deletes)s, '
|
||||||
'bytes: %(bytes)s, '
|
'bytes: %(bytes)s, '
|
||||||
'sync_point1: %(point1)s, '
|
'sync_point1: %(point1)s, '
|
||||||
'sync_point2: %(point2)s, '
|
'sync_point2: %(point2)s, '
|
||||||
'total_rows: %(total)s'),
|
'total_rows: %(total)s',
|
||||||
{'container': '%s/%s' % (info['account'],
|
{'container': '%s/%s' % (info['account'],
|
||||||
info['container']),
|
info['container']),
|
||||||
'start': start,
|
'start': start,
|
||||||
|
@ -386,7 +385,7 @@ class ContainerSync(Daemon):
|
||||||
sync_to, self.allowed_sync_hosts, self.realms_conf)
|
sync_to, self.allowed_sync_hosts, self.realms_conf)
|
||||||
if err:
|
if err:
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
_('ERROR %(db_file)s: %(validate_sync_to_err)s'),
|
'ERROR %(db_file)s: %(validate_sync_to_err)s',
|
||||||
{'db_file': str(broker),
|
{'db_file': str(broker),
|
||||||
'validate_sync_to_err': err})
|
'validate_sync_to_err': err})
|
||||||
self.container_failures += 1
|
self.container_failures += 1
|
||||||
|
@ -455,7 +454,7 @@ class ContainerSync(Daemon):
|
||||||
except (Exception, Timeout):
|
except (Exception, Timeout):
|
||||||
self.container_failures += 1
|
self.container_failures += 1
|
||||||
self.logger.increment('failures')
|
self.logger.increment('failures')
|
||||||
self.logger.exception(_('ERROR Syncing %s'),
|
self.logger.exception('ERROR Syncing %s',
|
||||||
broker if broker else path)
|
broker if broker else path)
|
||||||
|
|
||||||
def _update_sync_to_headers(self, name, sync_to, user_key,
|
def _update_sync_to_headers(self, name, sync_to, user_key,
|
||||||
|
@ -647,27 +646,27 @@ class ContainerSync(Daemon):
|
||||||
except ClientException as err:
|
except ClientException as err:
|
||||||
if err.http_status == HTTP_UNAUTHORIZED:
|
if err.http_status == HTTP_UNAUTHORIZED:
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
_('Unauth %(sync_from)r => %(sync_to)r'),
|
'Unauth %(sync_from)r => %(sync_to)r',
|
||||||
{'sync_from': '%s/%s' %
|
{'sync_from': '%s/%s' %
|
||||||
(quote(info['account']), quote(info['container'])),
|
(quote(info['account']), quote(info['container'])),
|
||||||
'sync_to': sync_to})
|
'sync_to': sync_to})
|
||||||
elif err.http_status == HTTP_NOT_FOUND:
|
elif err.http_status == HTTP_NOT_FOUND:
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
_('Not found %(sync_from)r => %(sync_to)r \
|
'Not found %(sync_from)r => %(sync_to)r \
|
||||||
- object %(obj_name)r'),
|
- object %(obj_name)r',
|
||||||
{'sync_from': '%s/%s' %
|
{'sync_from': '%s/%s' %
|
||||||
(quote(info['account']), quote(info['container'])),
|
(quote(info['account']), quote(info['container'])),
|
||||||
'sync_to': sync_to, 'obj_name': row['name']})
|
'sync_to': sync_to, 'obj_name': row['name']})
|
||||||
else:
|
else:
|
||||||
self.logger.exception(
|
self.logger.exception(
|
||||||
_('ERROR Syncing %(db_file)s %(row)s'),
|
'ERROR Syncing %(db_file)s %(row)s',
|
||||||
{'db_file': str(broker), 'row': row})
|
{'db_file': str(broker), 'row': row})
|
||||||
self.container_failures += 1
|
self.container_failures += 1
|
||||||
self.logger.increment('failures')
|
self.logger.increment('failures')
|
||||||
return False
|
return False
|
||||||
except (Exception, Timeout):
|
except (Exception, Timeout):
|
||||||
self.logger.exception(
|
self.logger.exception(
|
||||||
_('ERROR Syncing %(db_file)s %(row)s'),
|
'ERROR Syncing %(db_file)s %(row)s',
|
||||||
{'db_file': str(broker), 'row': row})
|
{'db_file': str(broker), 'row': row})
|
||||||
self.container_failures += 1
|
self.container_failures += 1
|
||||||
self.logger.increment('failures')
|
self.logger.increment('failures')
|
||||||
|
|
|
@ -19,7 +19,6 @@ import os
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from swift import gettext_ as _
|
|
||||||
from random import random, shuffle
|
from random import random, shuffle
|
||||||
from tempfile import mkstemp
|
from tempfile import mkstemp
|
||||||
|
|
||||||
|
@ -90,8 +89,8 @@ class ContainerUpdater(Daemon):
|
||||||
try:
|
try:
|
||||||
return os.listdir(path)
|
return os.listdir(path)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
self.logger.error(_('ERROR: Failed to get paths to drive '
|
self.logger.error('ERROR: Failed to get paths to drive '
|
||||||
'partitions: %s') % e)
|
'partitions: %s', e)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_paths(self):
|
def get_paths(self):
|
||||||
|
@ -124,7 +123,7 @@ class ContainerUpdater(Daemon):
|
||||||
self.account_suppressions[account] = until
|
self.account_suppressions[account] = until
|
||||||
except Exception:
|
except Exception:
|
||||||
self.logger.exception(
|
self.logger.exception(
|
||||||
_('ERROR with loading suppressions from %s: ') % filename)
|
'ERROR with loading suppressions from %s: ', filename)
|
||||||
finally:
|
finally:
|
||||||
os.unlink(filename)
|
os.unlink(filename)
|
||||||
|
|
||||||
|
@ -134,7 +133,7 @@ class ContainerUpdater(Daemon):
|
||||||
"""
|
"""
|
||||||
time.sleep(random() * self.interval)
|
time.sleep(random() * self.interval)
|
||||||
while True:
|
while True:
|
||||||
self.logger.info(_('Begin container update sweep'))
|
self.logger.info('Begin container update sweep')
|
||||||
begin = time.time()
|
begin = time.time()
|
||||||
now = time.time()
|
now = time.time()
|
||||||
expired_suppressions = \
|
expired_suppressions = \
|
||||||
|
@ -168,9 +167,9 @@ class ContainerUpdater(Daemon):
|
||||||
self.container_sweep(path)
|
self.container_sweep(path)
|
||||||
elapsed = time.time() - forkbegin
|
elapsed = time.time() - forkbegin
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
_('Container update sweep of %(path)s completed: '
|
'Container update sweep of %(path)s completed: '
|
||||||
'%(elapsed).02fs, %(success)s successes, %(fail)s '
|
'%(elapsed).02fs, %(success)s successes, %(fail)s '
|
||||||
'failures, %(no_change)s with no changes'),
|
'failures, %(no_change)s with no changes',
|
||||||
{'path': path, 'elapsed': elapsed,
|
{'path': path, 'elapsed': elapsed,
|
||||||
'success': self.successes, 'fail': self.failures,
|
'success': self.successes, 'fail': self.failures,
|
||||||
'no_change': self.no_changes})
|
'no_change': self.no_changes})
|
||||||
|
@ -182,7 +181,7 @@ class ContainerUpdater(Daemon):
|
||||||
finally:
|
finally:
|
||||||
del pid2filename[pid]
|
del pid2filename[pid]
|
||||||
elapsed = time.time() - begin
|
elapsed = time.time() - begin
|
||||||
self.logger.info(_('Container update sweep completed: %.02fs'),
|
self.logger.info('Container update sweep completed: %.02fs',
|
||||||
elapsed)
|
elapsed)
|
||||||
dump_recon_cache({'container_updater_sweep': elapsed},
|
dump_recon_cache({'container_updater_sweep': elapsed},
|
||||||
self.rcache, self.logger)
|
self.rcache, self.logger)
|
||||||
|
@ -194,7 +193,7 @@ class ContainerUpdater(Daemon):
|
||||||
Run the updater once.
|
Run the updater once.
|
||||||
"""
|
"""
|
||||||
eventlet_monkey_patch()
|
eventlet_monkey_patch()
|
||||||
self.logger.info(_('Begin container update single threaded sweep'))
|
self.logger.info('Begin container update single threaded sweep')
|
||||||
begin = time.time()
|
begin = time.time()
|
||||||
self.no_changes = 0
|
self.no_changes = 0
|
||||||
self.successes = 0
|
self.successes = 0
|
||||||
|
@ -202,10 +201,10 @@ class ContainerUpdater(Daemon):
|
||||||
for path in self.get_paths():
|
for path in self.get_paths():
|
||||||
self.container_sweep(path)
|
self.container_sweep(path)
|
||||||
elapsed = time.time() - begin
|
elapsed = time.time() - begin
|
||||||
self.logger.info(_(
|
self.logger.info(
|
||||||
'Container update single threaded sweep completed: '
|
'Container update single threaded sweep completed: '
|
||||||
'%(elapsed).02fs, %(success)s successes, %(fail)s failures, '
|
'%(elapsed).02fs, %(success)s successes, %(fail)s failures, '
|
||||||
'%(no_change)s with no changes'),
|
'%(no_change)s with no changes',
|
||||||
{'elapsed': elapsed, 'success': self.successes,
|
{'elapsed': elapsed, 'success': self.successes,
|
||||||
'fail': self.failures, 'no_change': self.no_changes})
|
'fail': self.failures, 'no_change': self.no_changes})
|
||||||
dump_recon_cache({'container_updater_sweep': elapsed},
|
dump_recon_cache({'container_updater_sweep': elapsed},
|
||||||
|
@ -282,7 +281,7 @@ class ContainerUpdater(Daemon):
|
||||||
self.logger.increment('successes')
|
self.logger.increment('successes')
|
||||||
self.successes += 1
|
self.successes += 1
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
_('Update report sent for %(container)s %(dbfile)s'),
|
'Update report sent for %(container)s %(dbfile)s',
|
||||||
{'container': container, 'dbfile': dbfile})
|
{'container': container, 'dbfile': dbfile})
|
||||||
broker.reported(info['put_timestamp'],
|
broker.reported(info['put_timestamp'],
|
||||||
info['delete_timestamp'], info['object_count'],
|
info['delete_timestamp'], info['object_count'],
|
||||||
|
@ -291,7 +290,7 @@ class ContainerUpdater(Daemon):
|
||||||
self.logger.increment('failures')
|
self.logger.increment('failures')
|
||||||
self.failures += 1
|
self.failures += 1
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
_('Update report stub for %(container)s %(dbfile)s'),
|
'Update report stub for %(container)s %(dbfile)s',
|
||||||
{'container': container, 'dbfile': dbfile})
|
{'container': container, 'dbfile': dbfile})
|
||||||
broker.quarantine('no account replicas exist')
|
broker.quarantine('no account replicas exist')
|
||||||
# All that's left at this point is a few sacks of Gnocchi,
|
# All that's left at this point is a few sacks of Gnocchi,
|
||||||
|
@ -300,7 +299,7 @@ class ContainerUpdater(Daemon):
|
||||||
self.logger.increment('failures')
|
self.logger.increment('failures')
|
||||||
self.failures += 1
|
self.failures += 1
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
_('Update report failed for %(container)s %(dbfile)s'),
|
'Update report failed for %(container)s %(dbfile)s',
|
||||||
{'container': container, 'dbfile': dbfile})
|
{'container': container, 'dbfile': dbfile})
|
||||||
self.account_suppressions[info['account']] = until = \
|
self.account_suppressions[info['account']] = until = \
|
||||||
time.time() + self.account_suppression_time
|
time.time() + self.account_suppression_time
|
||||||
|
@ -342,9 +341,9 @@ class ContainerUpdater(Daemon):
|
||||||
node['ip'], node['port'], node['device'], part,
|
node['ip'], node['port'], node['device'], part,
|
||||||
'PUT', container, headers=headers)
|
'PUT', container, headers=headers)
|
||||||
except (Exception, Timeout):
|
except (Exception, Timeout):
|
||||||
self.logger.exception(_(
|
self.logger.exception(
|
||||||
'ERROR account update failed with '
|
'ERROR account update failed with '
|
||||||
'%(ip)s:%(port)s/%(device)s (will retry later): '), node)
|
'%(ip)s:%(port)s/%(device)s (will retry later): ', node)
|
||||||
return HTTP_INTERNAL_SERVER_ERROR
|
return HTTP_INTERNAL_SERVER_ERROR
|
||||||
with Timeout(self.node_timeout):
|
with Timeout(self.node_timeout):
|
||||||
try:
|
try:
|
||||||
|
@ -354,7 +353,7 @@ class ContainerUpdater(Daemon):
|
||||||
except (Exception, Timeout):
|
except (Exception, Timeout):
|
||||||
if self.logger.getEffectiveLevel() <= logging.DEBUG:
|
if self.logger.getEffectiveLevel() <= logging.DEBUG:
|
||||||
self.logger.exception(
|
self.logger.exception(
|
||||||
_('Exception with %(ip)s:%(port)s/%(device)s'), node)
|
'Exception with %(ip)s:%(port)s/%(device)s', node)
|
||||||
return HTTP_INTERNAL_SERVER_ERROR
|
return HTTP_INTERNAL_SERVER_ERROR
|
||||||
finally:
|
finally:
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
Loading…
Reference in New Issue