Revision 0ef59e67
Added by Trey Dockendorf about 10 years ago
app/models/concerns/orchestration/dhcp.rb | ||
---|---|---|
end
|
||
|
||
def dhcp?
|
||
name.present? && ip_available? && mac_available? && !subnet.nil? && subnet.dhcp? && managed?
|
||
hostname.present? && ip_available? && mac_available? && !subnet.nil? && subnet.dhcp? && managed?
|
||
end
|
||
|
||
def dhcp_record
|
||
... | ... | |
def dhcp_attrs
|
||
return unless dhcp?
|
||
dhcp_attr = { :name => name, :filename => operatingsystem.boot_filename(self),
|
||
:ip => ip, :mac => mac, :hostname => name, :proxy => subnet.dhcp_proxy,
|
||
:ip => ip, :mac => mac, :hostname => hostname, :proxy => subnet.dhcp_proxy,
|
||
:network => subnet.network, :nextServer => boot_server }
|
||
|
||
if jumpstart?
|
||
... | ... | |
# do we need to update our dhcp reservations
|
||
def dhcp_update_required?
|
||
# IP Address / name changed
|
||
return true if ((old.ip != ip) or (old.name != name) or (old.mac != mac) or (old.subnet != subnet))
|
||
return true if ((old.ip != ip) or (old.hostname != hostname) or (old.mac != mac) or (old.subnet != subnet))
|
||
# Handle jumpstart
|
||
#TODO, abstract this way once interfaces are fully used
|
||
if self.kind_of?(Host::Base) and jumpstart?
|
||
... | ... | |
|
||
def dhcp_conflict_detected?
|
||
# we can't do any dhcp based validations when our MAC address is defined afterwards (e.g. in vm creation)
|
||
return false if mac.blank? or name.blank?
|
||
return false if mac.blank? or hostname.blank?
|
||
return false unless dhcp?
|
||
|
||
if dhcp_record and dhcp_record.conflicting? and (not overwrite?)
|
Also available in: Unified diff
fixes #4599 - DNS and DHCP records for BMC and managed interfaces not using FQDN
(cherry picked from commit 21e07e92ca2d0341a09de48fadfa95625f6d9f55)