'Rename the new (temp) volume to it\'s original name.
This method tries to rename the new volume to it\'s original
name after the migration has completed.'

@cinder_utils.trace
def update_migrated_volume(self, context, volume, new_volume, original_volume_status):

    LOG.debug('Update    volume    name    for    %(id)s.', {'id': new_volume['id']})
    name_id = None
    provider_location = None
    if (original_volume_status == 'available'):
        original_name = (CONF.volume_name_template % volume['id'])
        current_name = (CONF.volume_name_template % new_volume['id'])
        client = self._login()
        try:
            volume_info = client.getVolumeByName(current_name)
            volumeMods = {'name': original_name}
            client.modifyVolume(volume_info['id'], volumeMods)
            LOG.info('Volume    name    changed    from    %(tmp)s    to    %(orig)s.', {'tmp': current_name, 'orig': original_name})
        except Exception as e:
            LOG.error('Changing    the    volume    name    from    %(tmp)s    to    %(orig)s    failed    because    %(reason)s.', {'tmp': current_name, 'orig': original_name, 'reason': e})
            name_id = (new_volume['_name_id'] or new_volume['id'])
            provider_location = new_volume['provider_location']
        finally:
            self._logout(client)
    else:
        name_id = (new_volume['_name_id'] or new_volume['id'])
        provider_location = new_volume['provider_location']
    return {'_name_id': name_id, 'provider_location': provider_location}
