def _local_restart_failed(self, state, fail):
        '''
        Getting here means that all the host agents in the shard are gone.
        Depending on the restart strategy we finish here, migrate out of the
        shard or take over (monitoring agent).
        '''
        self.info('Restarting of %r in the same shard failed.',
                  state.descriptor.type_name)
        if self._cmp_strategy(RestartStrategy.local):
            self.info('Giving up, just sending buried notifications.')
            f = self._send_buried_notifications()
            f.add_callback(fiber.drop_param, state.medium.terminate, None)
            return f
        elif self._cmp_strategy(RestartStrategy.wherever):
            self.info('Trying to find an allocation anywhere in the cluster.')
            # first we need to clear the host partner, it is necessary, because
            # agent will bind to different exchange after the restart, so
            # he will never receive the notification
            # about burring his previous host
            f = self._clear_host_partner()
            f.add_callback(fiber.inject_param, 2,
                           state.agent.initiate_protocol,
                           start_agent.GloballyStartAgent)
            f.add_callback(fiber.call_param, 'notify_finish')
            # GloballyStartAgent task is updating descriptor, to get things
            # we need to redownload it here
            f.add_callback(fiber.bridge_param, self._fetch_descriptor)
            f.add_callbacks(self._send_restarted_notifications,
                            self._global_restart_failed)
            return f
        elif self._cmp_strategy(RestartStrategy.monitor):
            self.info('Taking over the role of the died monitor.')
            f = self._send_buried_notifications()
            f.add_callback(fiber.drop_param, self._checkup_partners)
            f.add_callback(fiber.drop_param, self._adopt_notifications)
            f.add_callback(fiber.drop_param, state.medium.terminate, None)
            return f
        else:
            state.medium.fail(RestartFailed('Unknown restart strategy: %r' %
                                            (self.factory.restart_strategy, )))
Getting here means that all the host agents in the shard are gone.
        Depending on the restart strategy we finish here, migrate out of the
        shard or take over (monitoring agent).