def failover_host(self, context, secondary_backend_id=None):
    "Failover a backend to a secondary replication target.\n\n        Instructs a replication capable/configured backend to failover\n        to one of it's secondary replication targets. host=None is\n        an acceptable input, and leaves it to the driver to failover\n        to the only configured target, or to choose a target on it's\n        own. All of the hosts volumes will be passed on to the driver\n        in order for it to determine the replicated volumes on the host,\n        if needed.\n\n        :param context: security context\n        :param secondary_backend_id: Specifies backend_id to fail over to\n        "
    svc_host = vol_utils.extract_host(self.host, 'backend')
    service = objects.Service.get_by_args(context, svc_host, 'cinder-volume')
    volumes = objects.VolumeList.get_all_by_host(context, self.host)
    exception_encountered = False
    try:
        (active_backend_id, volume_update_list) = self.driver.failover_host(context, volumes, secondary_id=secondary_backend_id)
    except exception.UnableToFailOver:
        LOG.exception(_LE('Failed to perform replication failover'))
        service.replication_status = fields.ReplicationStatus.FAILOVER_ERROR
        service.save()
        exception_encountered = True
    except exception.InvalidReplicationTarget:
        LOG.exception(_LE('Invalid replication target specified for failover'))
        if (secondary_backend_id == 'default'):
            service.replication_status = fields.ReplicationStatus.FAILED_OVER
        else:
            service.replication_status = fields.ReplicationStatus.ENABLED
        service.save()
        exception_encountered = True
    except exception.VolumeDriverException:
        LOG.error(_LE('Driver reported error during replication failover.'))
        service.status = 'error'
        service.save()
        exception_encountered = True
    if exception_encountered:
        LOG.error(_LE('Error encountered during failover on host: %(host)s invalid target ID %(backend_id)s'), {'host': self.host, 'backend_id': secondary_backend_id})
        return
    if (secondary_backend_id == 'default'):
        service.replication_status = fields.ReplicationStatus.ENABLED
        service.active_backend_id = ''
        if service.frozen:
            service.disabled = True
            service.disabled_reason = 'frozen'
        else:
            service.disabled = False
            service.disabled_reason = ''
        service.save()
    else:
        service.replication_status = fields.ReplicationStatus.FAILED_OVER
        service.active_backend_id = active_backend_id
        service.disabled = True
        service.disabled_reason = 'failed-over'
        service.save()
    for update in volume_update_list:
        if (not update.get('volume_id')):
            raise exception.UnableToFailOver(reason=_("Update list, doesn't include volume_id"))
        vobj = objects.Volume.get_by_id(context, update['volume_id'])
        vobj.update(update.get('updates', {}))
        vobj.save()
    LOG.info(_LI('Failed over to replication target successfully.'))
Failover a backend to a secondary replication target.

Instructs a replication capable/configured backend to failover
to one of it's secondary replication targets. host=None is
an acceptable input, and leaves it to the driver to failover
to the only configured target, or to choose a target on it's
own. All of the hosts volumes will be passed on to the driver
in order for it to determine the replicated volumes on the host,
if needed.

:param context: security context
:param secondary_backend_id: Specifies backend_id to fail over to
def failover_host(self, context, secondary_backend_id=None):
    "Failover a backend to a secondary replication target.\n\n        Instructs a replication capable/configured backend to failover\n        to one of it's secondary replication targets. host=None is\n        an acceptable input, and leaves it to the driver to failover\n        to the only configured target, or to choose a target on it's\n        own. All of the hosts volumes will be passed on to the driver\n        in order for it to determine the replicated volumes on the host,\n        if needed.\n\n        :param context: security context\n        :param secondary_backend_id: Specifies backend_id to fail over to\n        "
    svc_host = vol_utils.extract_host(self.host, 'backend')
    service = objects.Service.get_by_args(context, svc_host, 'cinder-volume')
    volumes = objects.VolumeList.get_all_by_host(context, self.host)
    exception_encountered = False
    try:
        (active_backend_id, volume_update_list) = self.driver.failover_host(context, volumes, secondary_id=secondary_backend_id)
    except exception.UnableToFailOver:
        LOG.exception(_LE('Failed to perform replication failover'))
        service.replication_status = fields.ReplicationStatus.FAILOVER_ERROR
        service.save()
        exception_encountered = True
    except exception.InvalidReplicationTarget:
        LOG.exception(_LE('Invalid replication target specified for failover'))
        if (secondary_backend_id == 'default'):
            service.replication_status = fields.ReplicationStatus.FAILED_OVER
        else:
            service.replication_status = fields.ReplicationStatus.ENABLED
        service.save()
        exception_encountered = True
    except exception.VolumeDriverException:
        LOG.error(_LE('Driver reported error during replication failover.'))
        service.status = 'error'
        service.save()
        exception_encountered = True
    if exception_encountered:
        LOG.error(_LE('Error encountered during failover on host: %(host)s invalid target ID %(backend_id)s'), {'host': self.host, 'backend_id': secondary_backend_id})
        return
    if (secondary_backend_id == 'default'):
        service.replication_status = fields.ReplicationStatus.ENABLED
        service.active_backend_id = 
        if service.frozen:
            service.disabled = True
            service.disabled_reason = 'frozen'
        else:
            service.disabled = False
            service.disabled_reason = 
        service.save()
    else:
        service.replication_status = fields.ReplicationStatus.FAILED_OVER
        service.active_backend_id = active_backend_id
        service.disabled = True
        service.disabled_reason = 'failed-over'
        service.save()
    for update in volume_update_list:
        if (not update.get('volume_id')):
            raise exception.UnableToFailOver(reason=_("Update list, doesn't include volume_id"))
        vobj = objects.Volume.get_by_id(context, update['volume_id'])
        vobj.update(update.get('updates', {}))
        vobj.save()
    LOG.info(_LI('Failed over to replication target successfully.'))