bosh-director/lib/bosh/director/deployment_plan/vip_network.rb
##
# Reserves a network resource.
#
# This is either an already used reservation being verified or a new one
# waiting to be fulfilled.
# @param [NetworkReservation] reservation
# @return [Boolean] true if the reservation was fulfilled
Reserves a network resource.
This is either an already used reservation being verified or a new one
waiting to be fulfilled.
Reserves a network resource . This is either an already used reservation being verified or a new one waiting to be fulfilled .
def reserve(reservation)
        reservation.reserved = false
        if reservation.ip.nil?
          raise NetworkReservationIpMissing,
                "Must have IP for static reservations"
        elsif reservation.dynamic?
          reservation.error = NetworkReservation::WRONG_TYPE
        elsif @reserved_ips.include?(reservation.ip)
          reservation.error = NetworkReservation::USED
        else
          reservation.reserved = true
          reservation.type = NetworkReservation::STATIC
          @reserved_ips.add(reservation.ip)
        end
        reservation.reserved?
      end
def reserve ( reservation ) reservation . reserved = false if reservation . ip . nil? raise NetworkReservationIpMissing , "Must have IP for static reservations" elsif reservation . dynamic? reservation . error = NetworkReservation :: WRONG_TYPE elsif @reserved_ips . include? ( reservation . ip ) reservation . error = NetworkReservation :: USED else reservation . reserved = true reservation . type = NetworkReservation :: STATIC @reserved_ips . add ( reservation . ip ) end reservation . reserved? end
Reserves a network resource.
Reserves a network resource .
true if the reservation was fulfilled
true if the reservation was fulfilled
Boolean
reservation
None