'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.'

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 = self._get_3par_vol_name(volume['id'])
        temp_name = self._get_3par_vol_name(volume['id'], temp_vol=True)
        current_name = self._get_3par_vol_name(new_volume['id'])
        try:
            volumeMods = {'newName': original_name}
            volumeTempMods = {'newName': temp_name}
            volumeCurrentMods = {'newName': current_name}
            self.client.modifyVolume(original_name, volumeTempMods)
            self.client.modifyVolume(current_name, volumeMods)
            self.client.modifyVolume(temp_name, volumeCurrentMods)
            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']
    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}
