'Failover volumes back to primary backend.
The main steps:
1. Switch the role of replication pairs.
2. Copy the second LUN data back to primary LUN.
3. Split replication pairs.
4. Switch the role of replication pairs.
5. Enable replications.'

def failback(self, volumes):

    volumes_update = []
    for v in volumes:
        v_update = {}
        v_update['volume_id'] = v.id
        drv_data = get_replication_driver_data(v)
        pair_id = drv_data.get('pair_id')
        if (not pair_id):
            LOG.warning('No    pair    id    in    volume    %s.', v.id)
            v_update['updates'] = {'replication_status': 'error'}
            volumes_update.append(v_update)
            continue
        rmt_lun_id = drv_data.get('rmt_lun_id')
        if (not rmt_lun_id):
            LOG.warning('No    remote    lun    id    in    volume    %s.', v.id)
            v_update['updates'] = {'replication_status': 'error'}
            volumes_update.append(v_update)
            continue
        self.local_driver.enable(pair_id)
        self.local_driver.wait_replica_ready(pair_id)
        self.rmt_driver.failover(pair_id)
        self.rmt_driver.enable(pair_id)
        local_metadata = huawei_utils.get_lun_metadata(v)
        new_drv_data = to_string({'pair_id': pair_id, 'rmt_lun_id': local_metadata.get('huawei_lun_id'), 'rmt_lun_wwn': local_metadata.get('huawei_lun_wwn')})
        location = huawei_utils.to_string(huawei_lun_id=rmt_lun_id, huawei_lun_wwn=drv_data.get('rmt_lun_wwn'))
        v_update['updates'] = {'provider_location': location, 'replication_status': 'available', 'replication_driver_data': new_drv_data}
        volumes_update.append(v_update)
    return volumes_update
