Class: Bosh::Director::DeploymentPlan::NetworkReservationRepository
- Defined in:
- lib/bosh/director/deployment_plan/network_reservation_repository.rb
Instance Method Summary collapse
- #fetch_network_reservations(existing_instance_model, existing_instance_state) ⇒ Object
-
#initialize(deployment_plan, logger) ⇒ NetworkReservationRepository
constructor
A new instance of NetworkReservationRepository.
- #migrate_existing_instance_network_reservations(existing_instance_model, existing_instance_state) ⇒ Object
Constructor Details
#initialize(deployment_plan, logger) ⇒ NetworkReservationRepository
Returns a new instance of NetworkReservationRepository.
3 4 5 6 |
# File 'lib/bosh/director/deployment_plan/network_reservation_repository.rb', line 3 def initialize(deployment_plan, logger) @deployment_plan = deployment_plan @logger = logger end |
Instance Method Details
#fetch_network_reservations(existing_instance_model, existing_instance_state) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/bosh/director/deployment_plan/network_reservation_repository.rb', line 8 def fetch_network_reservations(existing_instance_model, existing_instance_state) if existing_instance_model.ip_addresses.any? InstanceNetworkReservations.create_from_db(existing_instance_model, @deployment_plan, @logger) elsif existing_instance_state # This is for backwards compatibility when we did not store # network reservations in DB and constructed them from instance state InstanceNetworkReservations.create_from_state(existing_instance_model, existing_instance_state, @deployment_plan, @logger) else InstanceNetworkReservations.new(@logger) end end |
#migrate_existing_instance_network_reservations(existing_instance_model, existing_instance_state) ⇒ Object
20 21 22 23 24 |
# File 'lib/bosh/director/deployment_plan/network_reservation_repository.rb', line 20 def migrate_existing_instance_network_reservations(existing_instance_model, existing_instance_state) if !existing_instance_state.nil? && existing_instance_model.ip_addresses.empty? InstanceNetworkReservations.create_from_state(existing_instance_model, existing_instance_state, @deployment_plan, @logger) end end |