'Failover to replication target.'

def failover_host(self, context, volumes, secondary_id=None, groups=None):

    volume_updates = []
    remote = None
    if secondary_id:
        for rc in self.cluster_pairs:
            if (rc['mvip'] == secondary_id):
                remote = rc
                break
        if (not remote):
            LOG.error('SolidFire    driver    received    failover_host    but    was    unable    to    find    specified    replication    pair    with    id:    %s.', secondary_id)
            raise exception.InvalidReplicationTarget
    else:
        remote = self.cluster_pairs[0]
    if ((not remote) or (not self.replication_enabled)):
        LOG.error('SolidFire    driver    received    failover_host    request,    however    replication    is    NOT    enabled,    or    there    are    no    available    targets    to    fail-over    to.')
        raise exception.UnableToFailOver(reason=_('Failover    requested    on    non    replicated    backend.'))
    remote_vols = self._map_sf_volumes(volumes, endpoint=remote['endpoint'])
    primary_vols = self._map_sf_volumes(volumes)
    for v in volumes:
        remote_vlist = [sfv for sfv in remote_vols if (sfv['cinder_id'] == v['id'])]
        if (len(remote_vlist) > 0):
            remote_vol = remote_vlist[0]
            self._failover_volume(remote_vol, remote)
            primary_vol = [sfv for sfv in primary_vols if (sfv['cinder_id'] == v['id'])][0]
            if (len(primary_vol['volumePairs']) > 0):
                self._issue_api_request('RemoveVolumePair', {'volumeID': primary_vol['volumeID']}, version='7.0')
            iqn = remote_vol['iqn']
            volume_updates.append({'volume_id': v['id'], 'updates': {'provider_location': ('%s    %s    %s' % (remote['endpoint']['svip'], iqn, 0)), 'replication_status': 'failed-over'}})
        else:
            volume_updates.append({'volume_id': v['id'], 'updates': {'status': 'error'}})
    self.active_cluster_info = remote
    self.failed_over = True
    return (remote['mvip'], volume_updates, [])
