def _find_destination(self):
    attempted_hosts = [self.source]
    image = utils.get_image_from_system_metadata(self.instance.system_metadata)
    request_spec = scheduler_utils.build_request_spec(self.context, image, [self.instance])
    host = None
    while (host is None):
        self._check_not_over_max_retries(attempted_hosts)
        filter_properties = {'ignore_hosts': attempted_hosts}
        scheduler_utils.setup_instance_group(self.context, request_spec, filter_properties)
        host = self.scheduler_client.select_destinations(self.context, request_spec, filter_properties)[0]['host']
        try:
            self._check_compatible_with_source_hypervisor(host)
            self._call_livem_checks_on_host(host)
        except exception.Invalid as e:
            LOG.debug('Skipping host: %(host)s because: %(e)s', {'host': host, 'e': e})
            attempted_hosts.append(host)
            host = None
    return host
def _find_destination(self):
    attempted_hosts = [self.source]
    image = utils.get_image_from_system_metadata(self.instance.system_metadata)
    request_spec = scheduler_utils.build_request_spec(self.context, image, [self.instance])
    host = None
    while (host is None):
        self._check_not_over_max_retries(attempted_hosts)
        filter_properties = {'ignore_hosts': attempted_hosts}
        scheduler_utils.setup_instance_group(self.context, request_spec, filter_properties)
        host = self.scheduler_client.select_destinations(self.context, request_spec, filter_properties)[0]['host']
        try:
            self._check_compatible_with_source_hypervisor(host)
            self._call_livem_checks_on_host(host)
        except exception.Invalid as e:
            LOG.debug('Skipping host: %(host)s because: %(e)s', {'host': host, 'e': e})
            attempted_hosts.append(host)
            host = None
    return host