Remove context object in oslo.log method
Removed context object while logging as Cinder uses oslo.context's RequestContext which means the context object is in scope when doing logging. Change-Id: I7cc434ad10967596f8354775399e0c6c92ab5570 Closes-Bug:#1500896
This commit is contained in:
parent
7a8804aa20
commit
1a495922ed
@ -58,7 +58,7 @@ class BackupsController(wsgi.Controller):
|
||||
LOG.debug('Delete called for member %s.', id)
|
||||
context = req.environ['cinder.context']
|
||||
|
||||
LOG.info(_LI('Delete backup with id: %s'), id, context=context)
|
||||
LOG.info(_LI('Delete backup with id: %s'), id)
|
||||
|
||||
try:
|
||||
backup = self.backup_api.get(context, id)
|
||||
|
@ -57,7 +57,7 @@ class CgsnapshotsController(wsgi.Controller):
|
||||
LOG.debug('delete called for member %s', id)
|
||||
context = req.environ['cinder.context']
|
||||
|
||||
LOG.info(_LI('Delete cgsnapshot with id: %s'), id, context=context)
|
||||
LOG.info(_LI('Delete cgsnapshot with id: %s'), id)
|
||||
|
||||
try:
|
||||
cgsnapshot = self.cgsnapshot_api.get_cgsnapshot(
|
||||
|
@ -71,8 +71,7 @@ class ConsistencyGroupsController(wsgi.Controller):
|
||||
msg = _("Invalid value '%s' for force.") % force
|
||||
raise exc.HTTPBadRequest(explanation=msg)
|
||||
|
||||
LOG.info(_LI('Delete consistency group with id: %s'), id,
|
||||
context=context)
|
||||
LOG.info(_LI('Delete consistency group with id: %s'), id)
|
||||
|
||||
try:
|
||||
group = self.consistencygroup_api.get(context, id)
|
||||
@ -129,8 +128,7 @@ class ConsistencyGroupsController(wsgi.Controller):
|
||||
availability_zone = consistencygroup.get('availability_zone', None)
|
||||
|
||||
LOG.info(_LI("Creating consistency group %(name)s."),
|
||||
{'name': name},
|
||||
context=context)
|
||||
{'name': name})
|
||||
|
||||
try:
|
||||
new_consistencygroup = self.consistencygroup_api.create(
|
||||
@ -178,13 +176,11 @@ class ConsistencyGroupsController(wsgi.Controller):
|
||||
if cgsnapshot_id:
|
||||
LOG.info(_LI("Creating consistency group %(name)s from "
|
||||
"cgsnapshot %(snap)s."),
|
||||
{'name': name, 'snap': cgsnapshot_id},
|
||||
context=context)
|
||||
{'name': name, 'snap': cgsnapshot_id})
|
||||
elif source_cgid:
|
||||
LOG.info(_LI("Creating consistency group %(name)s from "
|
||||
"source consistency group %(source_cgid)s."),
|
||||
{'name': name, 'source_cgid': source_cgid},
|
||||
context=context)
|
||||
{'name': name, 'source_cgid': source_cgid})
|
||||
|
||||
try:
|
||||
new_consistencygroup = self.consistencygroup_api.create_from_src(
|
||||
@ -217,8 +213,7 @@ class ConsistencyGroupsController(wsgi.Controller):
|
||||
'name': name,
|
||||
'description': description,
|
||||
'add_volumes': add_volumes,
|
||||
'remove_volumes': remove_volumes},
|
||||
context=context)
|
||||
'remove_volumes': remove_volumes})
|
||||
|
||||
# Handle relevant exceptions at wsgi level
|
||||
group = self.consistencygroup_api.get(context, id)
|
||||
|
@ -48,7 +48,7 @@ class SnapshotUnmanageController(wsgi.Controller):
|
||||
context = req.environ['cinder.context']
|
||||
authorize(context)
|
||||
|
||||
LOG.info(_LI("Unmanage snapshot with id: %s"), id, context=context)
|
||||
LOG.info(_LI("Unmanage snapshot with id: %s"), id)
|
||||
|
||||
try:
|
||||
snapshot = self.volume_api.get_snapshot(context, id)
|
||||
|
@ -95,8 +95,7 @@ class VolumeTransferController(wsgi.Controller):
|
||||
name = name.strip()
|
||||
|
||||
LOG.info(_LI("Creating transfer of volume %s"),
|
||||
volume_id,
|
||||
context=context)
|
||||
volume_id)
|
||||
|
||||
try:
|
||||
new_transfer = self.transfer_api.create(context, volume_id, name)
|
||||
@ -124,8 +123,7 @@ class VolumeTransferController(wsgi.Controller):
|
||||
msg = _("Incorrect request body format")
|
||||
raise exc.HTTPBadRequest(explanation=msg)
|
||||
|
||||
LOG.info(_LI("Accepting transfer %s"), transfer_id,
|
||||
context=context)
|
||||
LOG.info(_LI("Accepting transfer %s"), transfer_id)
|
||||
|
||||
try:
|
||||
accepted_transfer = self.transfer_api.accept(context, transfer_id,
|
||||
@ -145,7 +143,7 @@ class VolumeTransferController(wsgi.Controller):
|
||||
"""Delete a transfer."""
|
||||
context = req.environ['cinder.context']
|
||||
|
||||
LOG.info(_LI("Delete transfer with id: %s"), id, context=context)
|
||||
LOG.info(_LI("Delete transfer with id: %s"), id)
|
||||
|
||||
# Not found exception will be handled at the wsgi level
|
||||
self.transfer_api.delete(context, transfer_id=id)
|
||||
|
@ -49,7 +49,7 @@ class VolumeUnmanageController(wsgi.Controller):
|
||||
context = req.environ['cinder.context']
|
||||
authorize(context)
|
||||
|
||||
LOG.info(_LI("Unmanage volume with id: %s"), id, context=context)
|
||||
LOG.info(_LI("Unmanage volume with id: %s"), id)
|
||||
|
||||
# Not found exception will be handled at the wsgi level
|
||||
vol = self.volume_api.get(context, id)
|
||||
|
@ -82,7 +82,7 @@ class SnapshotsController(wsgi.Controller):
|
||||
"""Delete a snapshot."""
|
||||
context = req.environ['cinder.context']
|
||||
|
||||
LOG.info(_LI("Delete snapshot with id: %s"), id, context=context)
|
||||
LOG.info(_LI("Delete snapshot with id: %s"), id)
|
||||
|
||||
# Not found exception will be handled at the wsgi level
|
||||
snapshot = self.volume_api.get_snapshot(context, id)
|
||||
@ -140,7 +140,7 @@ class SnapshotsController(wsgi.Controller):
|
||||
|
||||
force = snapshot.get('force', False)
|
||||
msg = _LI("Create snapshot from volume %s")
|
||||
LOG.info(msg, volume_id, context=context)
|
||||
LOG.info(msg, volume_id)
|
||||
|
||||
if not utils.is_valid_boolstr(force):
|
||||
msg = _("Invalid value '%s' for force. ") % force
|
||||
|
@ -114,7 +114,7 @@ def _translate_volume_summary_view(context, vol, image_id=None):
|
||||
if image_id:
|
||||
d['image_id'] = image_id
|
||||
|
||||
LOG.info(_LI("vol=%s"), vol, context=context)
|
||||
LOG.info(_LI("vol=%s"), vol)
|
||||
|
||||
if vol.metadata:
|
||||
d['metadata'] = vol.metadata
|
||||
@ -148,7 +148,7 @@ class VolumeController(wsgi.Controller):
|
||||
"""Delete a volume."""
|
||||
context = req.environ['cinder.context']
|
||||
|
||||
LOG.info(_LI("Delete volume with id: %s"), id, context=context)
|
||||
LOG.info(_LI("Delete volume with id: %s"), id)
|
||||
|
||||
# Not found exception will be handled at the wsgi level
|
||||
volume = self.volume_api.get(context, id)
|
||||
@ -258,7 +258,7 @@ class VolumeController(wsgi.Controller):
|
||||
elif size is None and kwargs['source_volume'] is not None:
|
||||
size = kwargs['source_volume']['size']
|
||||
|
||||
LOG.info(_LI("Create volume of %s GB"), size, context=context)
|
||||
LOG.info(_LI("Create volume of %s GB"), size)
|
||||
multiattach = volume.get('multiattach', False)
|
||||
kwargs['multiattach'] = multiattach
|
||||
|
||||
|
@ -58,7 +58,7 @@ class SnapshotsController(wsgi.Controller):
|
||||
"""Delete a snapshot."""
|
||||
context = req.environ['cinder.context']
|
||||
|
||||
LOG.info(_LI("Delete snapshot with id: %s"), id, context=context)
|
||||
LOG.info(_LI("Delete snapshot with id: %s"), id)
|
||||
|
||||
# Not found exception will be handled at the wsgi level
|
||||
snapshot = self.volume_api.get_snapshot(context, id)
|
||||
@ -128,7 +128,7 @@ class SnapshotsController(wsgi.Controller):
|
||||
volume = self.volume_api.get(context, volume_id)
|
||||
force = snapshot.get('force', False)
|
||||
msg = _LI("Create snapshot from volume %s")
|
||||
LOG.info(msg, volume_id, context=context)
|
||||
LOG.info(msg, volume_id)
|
||||
self.validate_name_and_description(snapshot)
|
||||
|
||||
# NOTE(thingee): v2 API allows name instead of display_name
|
||||
|
@ -68,7 +68,7 @@ class VolumeController(wsgi.Controller):
|
||||
|
||||
cascade = utils.get_bool_param('cascade', req.params)
|
||||
|
||||
LOG.info(_LI("Delete volume with id: %s"), id, context=context)
|
||||
LOG.info(_LI("Delete volume with id: %s"), id)
|
||||
|
||||
# Not found exception will be handled at the wsgi level
|
||||
volume = self.volume_api.get(context, id)
|
||||
@ -253,7 +253,7 @@ class VolumeController(wsgi.Controller):
|
||||
elif size is None and kwargs['source_replica'] is not None:
|
||||
size = kwargs['source_replica']['size']
|
||||
|
||||
LOG.info(_LI("Create volume of %s GB"), size, context=context)
|
||||
LOG.info(_LI("Create volume of %s GB"), size)
|
||||
|
||||
if self.ext_mgr.is_loaded('os-image-create'):
|
||||
image_ref = volume.get('imageRef')
|
||||
|
@ -395,8 +395,7 @@ class API(base.Base):
|
||||
|
||||
LOG.info(_LI("Creating volume of %(size)s GB for restore of "
|
||||
"backup %(backup_id)s."),
|
||||
{'size': size, 'backup_id': backup_id},
|
||||
context=context)
|
||||
{'size': size, 'backup_id': backup_id})
|
||||
volume = self.volume_api.create(context, size, name, description)
|
||||
volume_id = volume['id']
|
||||
|
||||
@ -422,8 +421,7 @@ class API(base.Base):
|
||||
|
||||
LOG.info(_LI("Overwriting volume %(volume_id)s with restore of "
|
||||
"backup %(backup_id)s"),
|
||||
{'volume_id': volume_id, 'backup_id': backup_id},
|
||||
context=context)
|
||||
{'volume_id': volume_id, 'backup_id': backup_id})
|
||||
|
||||
# Setting the status here rather than setting at start and unrolling
|
||||
# for each error condition, it should be a very small window
|
||||
|
Loading…
Reference in New Issue
Block a user