def filter_available_vmTypes()

in hostfactory/host_provider/src/allocation_strategy.py [0:0]


    def filter_available_vmTypes(self, vm_types):
        '''Filter out vmTypes that have no available capacity'''

        buckets_with_capacity = [b for b in self.node_mgr.get_buckets()
                                 if ((int(b.last_capacity_failure or 0)) < self.capacity_limit_timeout and b.resources.get("weight")) and b.available_count]
        vm_sizes = [b.vm_size for b in buckets_with_capacity]
        filtered_vmTypes = {}
        for vm_size in vm_types:
            if vm_size in vm_sizes:
                filtered_vmTypes[vm_size] = vm_types[vm_size]
        return filtered_vmTypes