Project

General

Profile

« Previous | Next » 

Revision f825cdf6

Added by Dominic Cleal about 9 years ago

fixes #10020 - add next-server/filename attrs to provision NIC DHCP record

A host's DHCP record used to be constructed with PXE attributes in
Orchestration::DHCP, but moved to Nic::Managed during 43c4bd7. Nic::Managed
didn't add PXE attributes, so this commit adds these when provision? is set.

Nic::Bootable could add PXE attributes but was unused, so it is now deprecated.
PXE bootable interfaces should be of type Nic::Managed with provision: true.

(cherry picked from commit e60f079920e6b370cfb3b2b047896fcbd4794a3c)

Conflicts:
app/models/nic/bootable.rb

View differences:

app/models/concerns/orchestration/dhcp.rb
def dhcp_record
return unless dhcp? or @dhcp_record
@dhcp_record ||= jumpstart? ? Net::DHCP::SparcRecord.new(dhcp_attrs) : Net::DHCP::Record.new(dhcp_attrs)
@dhcp_record ||= (provision? && jumpstart?) ? Net::DHCP::SparcRecord.new(dhcp_attrs) : Net::DHCP::Record.new(dhcp_attrs)
end
protected
......
# returns a hash of dhcp record settings
def dhcp_attrs
return unless dhcp?
dhcp_attr = { :name => name, :filename => operatingsystem.boot_filename(self),
:ip => ip, :mac => mac, :hostname => hostname, :proxy => subnet.dhcp_proxy,
:network => subnet.network, :nextServer => boot_server }
if jumpstart?
jumpstart_arguments = os.jumpstart_params self, model.vendor_class
dhcp_attr.merge! jumpstart_arguments unless jumpstart_arguments.empty?
raise ::Foreman::Exception.new(N_("DHCP not supported for this NIC")) unless dhcp?
dhcp_attr = {
:name => name,
:hostname => hostname,
:ip => ip,
:mac => mac,
:proxy => subnet.dhcp_proxy,
:network => subnet.network,
}
if provision?
dhcp_attr.merge!({:filename => operatingsystem.boot_filename(self), :nextServer => boot_server})
if jumpstart?
jumpstart_arguments = os.jumpstart_params self, model.vendor_class
dhcp_attr.merge! jumpstart_arguments unless jumpstart_arguments.empty?
end
end
dhcp_attr
end

Also available in: Unified diff