Class: Bosh::Director::DeploymentPlan::CloudPlanner
- Defined in:
- lib/bosh/director/deployment_plan/planner.rb
Instance Attribute Summary collapse
-
#compilation ⇒ Object
Returns the value of attribute compilation.
Class Method Summary collapse
Instance Method Summary collapse
- #add_resource_pool(resource_pool) ⇒ Object
- #availability_zone(name) ⇒ Object
- #availability_zones ⇒ Object
- #deleted_network(name) ⇒ Object
- #disk_type(name) ⇒ Object
- #disk_types ⇒ Object
-
#initialize(options) ⇒ CloudPlanner
constructor
A new instance of CloudPlanner.
- #ip_provider ⇒ Object
- #model ⇒ Object
- #network(name) ⇒ Object
- #networks ⇒ Object
- #resource_pool(name) ⇒ Object
- #resource_pools ⇒ Object
- #using_global_networking? ⇒ Boolean
- #vm_extension(name) ⇒ Object
- #vm_extensions ⇒ Object
- #vm_type(name) ⇒ Object
- #vm_types ⇒ Object
Constructor Details
#initialize(options) ⇒ CloudPlanner
Returns a new instance of CloudPlanner.
299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 299 def initialize() @networks = self.class.index_by_name(.fetch(:networks)) @global_network_resolver = .fetch(:global_network_resolver) @resource_pools = self.class.index_by_name(.fetch(:resource_pools)) @vm_types = self.class.index_by_name(.fetch(:vm_types, {})) @vm_extensions = self.class.index_by_name(.fetch(:vm_extensions, {})) @disk_types = self.class.index_by_name(.fetch(:disk_types)) @availability_zones = .fetch(:availability_zones_list) @compilation = .fetch(:compilation) @ip_provider_factory = .fetch(:ip_provider_factory) @logger = .fetch(:logger) end |
Instance Attribute Details
#compilation ⇒ Object
Returns the value of attribute compilation.
297 298 299 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 297 def compilation @compilation end |
Class Method Details
.index_by_name(collection) ⇒ Object
389 390 391 392 393 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 389 def self.index_by_name(collection) collection.inject({}) do |index, item| index.merge(item.name => item) end end |
Instance Method Details
#add_resource_pool(resource_pool) ⇒ Object
365 366 367 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 365 def add_resource_pool(resource_pool) @resource_pools[resource_pool.name] = resource_pool end |
#availability_zone(name) ⇒ Object
329 330 331 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 329 def availability_zone(name) @availability_zones[name] end |
#availability_zones ⇒ Object
333 334 335 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 333 def availability_zones @availability_zones.values end |
#deleted_network(name) ⇒ Object
320 321 322 323 324 325 326 327 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 320 def deleted_network(name) ManualNetwork.parse( {'subnets' => [], 'name' => name}, [], @global_network_resolver, @logger ) end |
#disk_type(name) ⇒ Object
385 386 387 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 385 def disk_type(name) @disk_types[name] end |
#disk_types ⇒ Object
377 378 379 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 377 def disk_types @disk_types.values end |
#ip_provider ⇒ Object
312 313 314 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 312 def ip_provider @ip_provider ||= @ip_provider_factory.new_ip_provider(@networks) end |
#model ⇒ Object
316 317 318 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 316 def model nil end |
#network(name) ⇒ Object
373 374 375 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 373 def network(name) @networks[name] end |
#networks ⇒ Object
369 370 371 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 369 def networks @networks.values end |
#resource_pool(name) ⇒ Object
341 342 343 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 341 def resource_pool(name) @resource_pools[name] end |
#resource_pools ⇒ Object
337 338 339 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 337 def resource_pools @resource_pools.values end |
#using_global_networking? ⇒ Boolean
381 382 383 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 381 def using_global_networking? false end |
#vm_extension(name) ⇒ Object
357 358 359 360 361 362 363 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 357 def vm_extension(name) unless @vm_extensions.has_key?(name) raise "The vm_extension '#{name}' has not been configured in cloud-config." end @vm_extensions[name] end |
#vm_extensions ⇒ Object
353 354 355 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 353 def vm_extensions @vm_extensions.values end |
#vm_type(name) ⇒ Object
349 350 351 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 349 def vm_type(name) @vm_types[name] end |
#vm_types ⇒ Object
345 346 347 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 345 def vm_types @vm_types.values end |