'Failover replication.
Purpose:
1. Split replication.
2. Set secondary access read & write.'

def failover(self, replica_id):

    info = self.op.get_replica_info(replica_id)
    if self.op.is_primary(info):
        msg = _('We    should    not    do    switch    over    on    primary    array.')
        LOG.error(msg)
        raise exception.VolumeBackendAPIException(data=msg)
    sync_status_set = (constants.REPLICA_RUNNING_STATUS_SYNC, constants.REPLICA_RUNNING_STATUS_INITIAL_SYNC)
    if self.op.is_running_status(sync_status_set, info):
        self.wait_replica_ready(replica_id)
    self.split(replica_id)
    self.op.unprotect_second(replica_id)
