Skip to content

Commit

Permalink
Standardize on ID for log messages
Browse files Browse the repository at this point in the history
We have some places where logs use name to identify
a volume and others where we use ID.  Let's standardize
on the UUID here as that's typically the unique identifier
we use in most places anyway.  Even though name is a
derviative it seems better to be consistent with this
and use the UUID by itself.

Change-Id: Iaee3d146042780e4a526834db1e0be84a705f24b
Fixes: bug 1214140
  • Loading branch information
j-griffith committed Aug 19, 2013
1 parent 5d6c11f commit b318bd3
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions cinder/volume/manager.py
Expand Up @@ -162,7 +162,7 @@ def init_host(self):
self.driver.clear_download(ctxt, volume)
self.db.volume_update(ctxt, volume['id'], {'status': 'error'})
else:
LOG.info(_("volume %s: skipping export"), volume['name'])
LOG.info(_("volume %s: skipping export"), volume['id'])

LOG.debug(_('Resuming any in progress delete operations'))
for volume in volumes:
Expand Down Expand Up @@ -212,7 +212,7 @@ def delete_volume(self, context, volume_id):
else:
project_id = context.project_id

LOG.info(_("volume %s: deleting"), volume_ref['name'])
LOG.info(_("volume %s: deleting"), volume_ref['id'])
if volume_ref['attach_status'] == "attached":
# Volume is still attached, need to detach first
raise exception.VolumeAttached(volume_id=volume_id)
Expand All @@ -223,13 +223,13 @@ def delete_volume(self, context, volume_id):
self._notify_about_volume_usage(context, volume_ref, "delete.start")
self._reset_stats()
try:
LOG.debug(_("volume %s: removing export"), volume_ref['name'])
LOG.debug(_("volume %s: removing export"), volume_ref['id'])
self.driver.remove_export(context, volume_ref)
LOG.debug(_("volume %s: deleting"), volume_ref['name'])
LOG.debug(_("volume %s: deleting"), volume_ref['id'])
self.driver.delete_volume(volume_ref)
except exception.VolumeIsBusy:
LOG.error(_("Cannot delete volume %s: volume is busy"),
volume_ref['name'])
volume_ref['id'])
self.driver.ensure_export(context, volume_ref)
self.db.volume_update(context, volume_ref['id'],
{'status': 'available'})
Expand Down Expand Up @@ -260,7 +260,7 @@ def delete_volume(self, context, volume_id):

self.db.volume_glance_metadata_delete_by_volume(context, volume_id)
self.db.volume_destroy(context, volume_id)
LOG.info(_("volume %s: deleted successfully"), volume_ref['name'])
LOG.info(_("volume %s: deleted successfully"), volume_ref['id'])
self._notify_about_volume_usage(context, volume_ref, "delete.end")

# Commit the reservations
Expand All @@ -275,13 +275,13 @@ def create_snapshot(self, context, volume_id, snapshot_id):
"""Creates and exports the snapshot."""
context = context.elevated()
snapshot_ref = self.db.snapshot_get(context, snapshot_id)
LOG.info(_("snapshot %s: creating"), snapshot_ref['name'])
LOG.info(_("snapshot %s: creating"), snapshot_ref['id'])
self._notify_about_snapshot_usage(
context, snapshot_ref, "create.start")

try:
LOG.debug(_("snapshot %(snap_name)s: creating"),
{'snap_name': snapshot_ref['name']})
LOG.debug(_("snapshot %(snap_id)s: creating"),
{'snap_id': snapshot_ref['id']})
model_update = self.driver.create_snapshot(snapshot_ref)
if model_update:
self.db.snapshot_update(context, snapshot_ref['id'],
Expand Down Expand Up @@ -309,7 +309,7 @@ def create_snapshot(self, context, volume_id, snapshot_id):
{'volume_id': volume_id,
'snapshot_id': snapshot_id})
raise exception.MetadataCopyFailure(reason=ex)
LOG.info(_("snapshot %s: created successfully"), snapshot_ref['name'])
LOG.info(_("snapshot %s: created successfully"), snapshot_ref['id'])
self._notify_about_snapshot_usage(context, snapshot_ref, "create.end")
return snapshot_id

Expand All @@ -318,16 +318,16 @@ def delete_snapshot(self, context, snapshot_id):
context = context.elevated()
snapshot_ref = self.db.snapshot_get(context, snapshot_id)
project_id = snapshot_ref['project_id']
LOG.info(_("snapshot %s: deleting"), snapshot_ref['name'])
LOG.info(_("snapshot %s: deleting"), snapshot_ref['id'])
self._notify_about_snapshot_usage(
context, snapshot_ref, "delete.start")

try:
LOG.debug(_("snapshot %s: deleting"), snapshot_ref['name'])
LOG.debug(_("snapshot %s: deleting"), snapshot_ref['id'])
self.driver.delete_snapshot(snapshot_ref)
except exception.SnapshotIsBusy:
LOG.error(_("Cannot delete snapshot %s: snapshot is busy"),
snapshot_ref['name'])
snapshot_ref['id'])
self.db.snapshot_update(context,
snapshot_ref['id'],
{'status': 'available'})
Expand Down Expand Up @@ -359,7 +359,7 @@ def delete_snapshot(self, context, snapshot_id):
LOG.exception(_("Failed to update usages deleting snapshot"))
self.db.volume_glance_metadata_delete_by_snapshot(context, snapshot_id)
self.db.snapshot_destroy(context, snapshot_id)
LOG.info(_("snapshot %s: deleted successfully"), snapshot_ref['name'])
LOG.info(_("snapshot %s: deleted successfully"), snapshot_ref['id'])
self._notify_about_snapshot_usage(context, snapshot_ref, "delete.end")

# Commit the reservations
Expand Down Expand Up @@ -604,7 +604,7 @@ def migrate_volume(self, ctxt, volume_id, host, force_host_copy=False):
if not force_host_copy:
try:
LOG.debug(_("volume %s: calling driver migrate_volume"),
volume_ref['name'])
volume_ref['id'])
moved, model_update = self.driver.migrate_volume(ctxt,
volume_ref,
host)
Expand Down Expand Up @@ -716,9 +716,9 @@ def _consumed(name):
return

try:
LOG.info(_("volume %s: extending"), volume['name'])
LOG.info(_("volume %s: extending"), volume['id'])
self.driver.extend_volume(volume, new_size)
LOG.info(_("volume %s: extended successfully"), volume['name'])
LOG.info(_("volume %s: extended successfully"), volume['id'])
except Exception:
LOG.exception(_("volume %s: Error trying to extend volume"),
volume_id)
Expand Down

0 comments on commit b318bd3

Please sign in to comment.