Class: Bosh::Director::DesiredNetworkReservation
Instance Attribute Summary
#instance_model, #ip, #network, #type
Class Method Summary
collapse
Instance Method Summary
collapse
#dynamic?, #mark_reserved, #reserved?, #resolve_network, #static?
Methods included from IpUtil
#each_ip, #format_ip, #ip_to_i, #ip_to_netaddr
Constructor Details
Returns a new instance of DesiredNetworkReservation.
72
73
74
75
76
|
# File 'lib/bosh/director/network_reservation.rb', line 72
def initialize(instance_model, network, ip, type)
super(instance_model, network)
@ip = ip_to_i(ip) if ip
@type = type
end
|
Class Method Details
.new_dynamic(instance_model, network) ⇒ Object
64
65
66
|
# File 'lib/bosh/director/network_reservation.rb', line 64
def self.new_dynamic(instance_model, network)
new(instance_model, network, nil, :dynamic)
end
|
.new_static(instance_model, network, ip) ⇒ Object
68
69
70
|
# File 'lib/bosh/director/network_reservation.rb', line 68
def self.new_static(instance_model, network, ip)
new(instance_model, network, ip, :static)
end
|
Instance Method Details
91
92
93
|
# File 'lib/bosh/director/network_reservation.rb', line 91
def desc
"#{type} reservation with IP '#{formatted_ip}' for instance #{@instance_model}"
end
|
#resolve_ip(ip) ⇒ Object
78
79
80
|
# File 'lib/bosh/director/network_reservation.rb', line 78
def resolve_ip(ip)
@ip = ip_to_i(ip)
end
|
#resolve_type(type) ⇒ Object
82
83
84
85
86
87
88
89
|
# File 'lib/bosh/director/network_reservation.rb', line 82
def resolve_type(type)
if @type != type
raise NetworkReservationWrongType,
"IP '#{formatted_ip}' on network '#{@network.name}' does not belong to #{@type} pool"
end
@type = type
end
|
95
96
97
|
# File 'lib/bosh/director/network_reservation.rb', line 95
def to_s
"{type=#{type}, ip=#{formatted_ip}, network=#{@network.name}, instance=#{@instance_model}}"
end
|