Class: Bosh::Director::DeploymentPlan::PlacementPlanner::BruteForceIpAllocation::AllocatedIps

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/deployment_plan/placement_planner/bruteforce_ip_allocation.rb

Instance Method Summary collapse

Constructor Details

#initializeAllocatedIps

Returns a new instance of AllocatedIps.



85
86
87
# File 'lib/bosh/director/deployment_plan/placement_planner/bruteforce_ip_allocation.rb', line 85

def initialize
  @allocated_ips = Hash.new {|h,k| h[k] = 0 }
end

Instance Method Details

#allocate(az_name) ⇒ Object



89
90
91
# File 'lib/bosh/director/deployment_plan/placement_planner/bruteforce_ip_allocation.rb', line 89

def allocate(az_name)
  @allocated_ips[az_name] += 1
end

#sort_by_least_allocated_ips(az_names) ⇒ Object



93
94
95
96
97
# File 'lib/bosh/director/deployment_plan/placement_planner/bruteforce_ip_allocation.rb', line 93

def sort_by_least_allocated_ips(az_names)
  az_names.sort_by do |az_name|
    @allocated_ips[az_name]
  end
end