def test_filter_handler(self): # Double check at least a couple of known filters exist filter_handler = filters.HostFilterHandler() classes = filter_handler.get_matching_classes( ['nova.scheduler.filters.all_filters']) self.assertIn(all_hosts_filter.AllHostsFilter, classes) self.assertIn(compute_filter.ComputeFilter, classes)
def __init__(self): self.cells = None self.host_state_map = {} self.filter_handler = filters.HostFilterHandler() filter_classes = self.filter_handler.get_matching_classes( CONF.filter_scheduler.available_filters) self.filter_cls_map = {cls.__name__: cls for cls in filter_classes} self.filter_obj_map = {} self.enabled_filters = self._choose_host_filters(self._load_filters()) self.weight_handler = weights.HostWeightHandler() weigher_classes = self.weight_handler.get_matching_classes( CONF.filter_scheduler.weight_classes) self.weighers = [cls() for cls in weigher_classes] # Dict of aggregates keyed by their ID self.aggs_by_id = {} # Dict of set of aggregate IDs keyed by the name of the host belonging # to those aggregates self.host_aggregates_map = collections.defaultdict(set) self._init_aggregates() self.track_instance_changes = ( CONF.filter_scheduler.track_instance_changes) # Dict of instances and status, keyed by host self._instance_info = {} if self.track_instance_changes: self._init_instance_info()
def __init__(self): self.host_state_map = {} self.filter_handler = filters.HostFilterHandler() self.filter_classes = self.filter_handler.get_matching_classes( CONF.scheduler_available_filters) self.weight_handler = weights.HostWeightHandler() self.weight_classes = self.weight_handler.get_matching_classes( CONF.scheduler_weight_classes)
def setUp(self): super(HostFiltersTestCase, self).setUp() self.context = context.RequestContext('fake', 'fake') filter_handler = filters.HostFilterHandler() classes = filter_handler.get_matching_classes( ['nova.scheduler.filters.all_filters']) self.class_map = {} for cls in classes: self.class_map[cls.__name__] = cls
def __init__(self): # { (host, hypervisor_hostname) : { <service> : { cap k : v }}} self.service_states = {} self.host_state_map = {} self.filter_handler = filters.HostFilterHandler() self.filter_classes = self.filter_handler.get_matching_classes( CONF.scheduler_available_filters) self.weight_handler = weights.HostWeightHandler() self.weight_classes = self.weight_handler.get_matching_classes( CONF.scheduler_weight_classes)
def __init__(self): self.host_state_map = {} self.filter_handler = filters.HostFilterHandler() filter_classes = self.filter_handler.get_matching_classes( CONF.scheduler_available_filters) self.filter_cls_map = {cls.__name__: cls for cls in filter_classes} self.filter_obj_map = {} self.weight_handler = weights.HostWeightHandler() weigher_classes = self.weight_handler.get_matching_classes( CONF.scheduler_weight_classes) self.weighers = [cls() for cls in weigher_classes]
def __init__(self, *args, **kwargs): super(BaseBalancer, self).__init__(*args, **kwargs) self.host_manager = importutils.import_object( CONF.scheduler_host_manager) self.filter_handler = filters.HostFilterHandler() self.compute_api = compute_api.API()