Skip to content

Commit

Permalink
Improve compute swap_volume logging
Browse files Browse the repository at this point in the history
Even though this is a reasonably complicated bit of code that also can
get called by cinder when doing volume retyping, there is close to zero
logging at the moment.

Change-Id: Ie32ba7e8e262528494c5dfec4d7b49950f72ecb0
  • Loading branch information
djipko committed Jun 4, 2015
1 parent 2a44b67 commit b34ace2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions nova/compute/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4555,6 +4555,11 @@ def _swap_volume(self, context, instance, bdm, connector, old_volume_id,
connector,
instance,
bdm)
LOG.debug("swap_volume: Calling driver volume swap with "
"connection infos: new: %(new_cinfo)s; "
"old: %(old_cinfo)s",
{'new_cinfo': new_cinfo, 'old_cinfo': old_cinfo},
contex=context, instance=instance)
old_vol_size = self.volume_api.get(context, old_volume_id)['size']
new_vol_size = self.volume_api.get(context, new_volume_id)['size']
if new_vol_size > old_vol_size:
Expand Down Expand Up @@ -4583,6 +4588,9 @@ def _swap_volume(self, context, instance, bdm, connector, old_volume_id,
finally:
conn_volume = new_volume_id if failed else old_volume_id
if new_cinfo:
LOG.debug("swap_volume: calling Cinder terminate_connection "
"for %(volume)s", {'volume': conn_volume},
context=context, instance=instance)
self.volume_api.terminate_connection(context,
conn_volume,
connector)
Expand All @@ -4593,6 +4601,9 @@ def _swap_volume(self, context, instance, bdm, connector, old_volume_id,
old_volume_id,
new_volume_id,
error=failed)
LOG.debug("swap_volume: Cinder migrate_volume_completion "
"returned: %(comp_ret)s", {'comp_ret': comp_ret},
context=context, instance=instance)

return (comp_ret, new_cinfo)

Expand All @@ -4606,6 +4617,9 @@ def swap_volume(self, context, old_volume_id, new_volume_id, instance):
bdm = objects.BlockDeviceMapping.get_by_volume_id(
context, old_volume_id, instance_uuid=instance.uuid)
connector = self.driver.get_volume_connector(instance)
LOG.info(_LI('Swapping volume %(old_volume)s for %(new_volume)s'),
{'old_volume': old_volume_id, 'new_volume': new_volume_id},
context=context, instance=instance)
comp_ret, new_cinfo = self._swap_volume(context, instance,
bdm,
connector,
Expand All @@ -4624,6 +4638,10 @@ def swap_volume(self, context, old_volume_id, new_volume_id, instance):
'volume_id': save_volume_id,
'volume_size': None,
'no_device': None}
LOG.debug("swap_volume: Updating volume %(volume_id)s BDM record with "
"%(updates)s", {'volume_id': bdm.volume_id,
'updates': values},
context=context, instance=instance)
bdm.update(values)
bdm.save()

Expand Down

0 comments on commit b34ace2

Please sign in to comment.