'Failover a cg with all it\'s volumes.
if secondery_id is default, cg needs to be failed back.'

def failover_replication(self, context, group, volumes, secondary_backend_id):

    volumes_updated = []
    goal_status = ''
    pool_master = None
    group_updated = {'replication_status': group.replication_status}
    LOG.info('failover_replication:    of    cg    %(cg)s    from    %(active)s    to    %(id)s', {'cg': group.get('name'), 'active': self.active_backend_id, 'id': secondary_backend_id})
    if (secondary_backend_id == strings.PRIMARY_BACKEND_ID):
        if self._using_default_backend():
            LOG.info('CG    has    been    failed    back.    No    need    to    fail    back    again.')
            return (group_updated, volumes_updated)
        pool_master = self._get_target_params(self.active_backend_id)['san_clustername']
        pool_slave = self.storage_info[storage.FLAG_KEYS['storage_pool']]
        goal_status = 'available'
    else:
        if self._using_default_backend():
            LOG.info('cg    already    failed    over.')
            return (group_updated, volumes_updated)
        secondary_backend_id = self.get_secondary_backend_id(secondary_backend_id)
        pool_master = self.storage_info[storage.FLAG_KEYS['storage_pool']]
        pool_slave = self._get_target_params(secondary_backend_id)['san_clustername']
        goal_status = fields.ReplicationStatus.FAILED_OVER
    self.ibm_storage_remote_cli = self._init_xcli(secondary_backend_id)
    self.check_for_splitbrain(volumes, pool_master, pool_slave)
    (group_specs, msg) = self.get_group_specs_by_group_resource(context, group)
    if (group_specs is None):
        LOG.error(msg)
        raise self.meta['exception'].VolumeBackendAPIException(data=msg)
    failback = (secondary_backend_id == strings.PRIMARY_BACKEND_ID)
    (result, details) = repl.GroupReplication.failover(group, failback)
    if result:
        status = goal_status
        group_updated['replication_status'] = status
    else:
        status = 'error'
    updates = {'status': status}
    if (status == 'error'):
        group_updated['replication_extended_status'] = details
    for volume in volumes:
        volumes_updated.append({'volume_id': volume.id, 'updates': updates})
    self._replace_xcli_to_remote_xcli()
    return (group_updated, volumes_updated)
