in docker/services/resize/resize_service.py [0:0]
def find_suitable_shapes(cpu_min, cpu_max, memory_min, memory_max,
net_output_min,
disk_iops_min,
prioritized_shapes):
suitable_shapes = []
for shapes in prioritized_shapes:
for shape in shapes:
shape_cpu = getattr(shape, 'cpu', -1)
shape_memory = getattr(shape, 'memory', -1)
cpu_suits = True
memory_suits = True
net_output_suits = True
iops_suits = True
if cpu_min and cpu_max:
cpu_suits = cpu_min <= shape_cpu <= cpu_max
if memory_min and memory_max:
memory_suits = memory_min <= shape_memory <= memory_max
if net_output_min:
shape_net_output = shape.network_throughput
net_output_suits = shape_net_output \
and net_output_min <= shape_net_output
if disk_iops_min:
shape_iops = shape.iops
iops_suits = shape_iops and disk_iops_min <= shape_iops
if cpu_suits and memory_suits and iops_suits \
and net_output_suits:
suitable_shapes.append(shape)
return [shape.get_dto() for shape in suitable_shapes]