'Failover to secondary.
:param context: security context
:param secondary_id: Specifies rep target to fail over to
:param volumes: List of volumes serviced by this backend.
:returns: destssn, volume_updates data structure
Example volume_updates data structure:
.. code-block:: json
[{\'volume_id\': <cinder-uuid>,
\'updates\': {\'provider_id\': 8,
\'replication_status\': \'failed-over\',
\'replication_extended_status\': \'whatever\',...}},]'

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

    LOG.debug('failover-host')
    LOG.debug(self.failed_over)
    LOG.debug(self.active_backend_id)
    LOG.debug(self.replication_enabled)
    if self.failed_over:
        if (secondary_id == 'default'):
            LOG.debug('failing    back')
            return ('default', self.failback_volumes(volumes), [])
        raise exception.InvalidReplicationTarget(reason=_('Already    failed    over'))
    LOG.info('Failing    backend    to    %s', secondary_id)
    if self.replication_enabled:
        with self._client.open_connection() as api:
            destssn = self._parse_secondary(api, secondary_id)
            if destssn:
                volume_updates = []
                for volume in volumes:
                    model_update = {}
                    if volume.get('replication_driver_data'):
                        rspecs = self._get_replication_specs(self._get_volume_extra_specs(volume))
                        if rspecs['live']:
                            model_update = self._failover_live_volume(api, volume['id'], volume.get('provider_id'))
                        else:
                            model_update = self._failover_replication(api, volume['id'], volume.get('provider_id'), destssn)
                    else:
                        scvolume = api.find_volume(volume['id'], volume.get('provider_id'))
                        api.remove_mappings(scvolume)
                        model_update = {'status': 'error'}
                    volume_updates.append({'volume_id': volume['id'], 'updates': model_update})
                self._update_backend(destssn)
                LOG.debug('after    update    backend')
                LOG.debug(self.failed_over)
                LOG.debug(self.active_backend_id)
                LOG.debug(self.replication_enabled)
                return (destssn, volume_updates, [])
            else:
                raise exception.InvalidReplicationTarget(reason=(_('replication_failover    failed.    %s    not    found.') % secondary_id))
    raise exception.VolumeBackendAPIException(message=_('replication_failover    failed.    Backend    not    configured    for    failover'))
