From a515f81febe18ee125522b02eaf4acc7cf13ed41 Mon Sep 17 00:00:00 2001 From: wenchma Date: Thu, 23 Apr 2015 10:38:50 +0800 Subject: [PATCH] Add tftp configuration for ironic Expose the tftp configuration to support tftp, disable by default. Change-Id: I9175e420a3def4cf10e95701c235bbae999b6505 Closes-bug: #1446972 --- attributes/default.rb | 9 +++++++++ spec/ironic-common_spec.rb | 16 ++++++++++++++++ templates/default/ironic.conf.erb | 8 +++++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 04bc788..330a853 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -69,6 +69,15 @@ default['openstack']['bare-metal']['service_role'] = 'service' default['openstack']['bare-metal']['user'] = 'ironic' default['openstack']['bare-metal']['group'] = 'ironic' +# Setup the tftp variables +default['openstack']['bare-metal']['tftp']['enabled'] = false +# IP address of Ironic compute node's tftp server +default['openstack']['bare-metal']['tftp']['server'] = '127.0.0.1' +# Ironic compute node's tftp root path +default['openstack']['bare-metal']['tftp']['root_path'] = '/var/lib/tftpboot' +# Directory where master tftp images are stored on disk +default['openstack']['bare-metal']['tftp']['master_path'] = "#{node['openstack']['bare-metal']['tftp']['root_path']}/master_images" + # rootwrap.conf default['openstack']['bare-metal']['rootwrap']['filters_path'] = '/etc/ironic/rootwrap.d,/usr/share/ironic/rootwrap' default['openstack']['bare-metal']['rootwrap']['exec_dirs'] = '/sbin,/usr/sbin,/bin,/usr/bin' diff --git a/spec/ironic-common_spec.rb b/spec/ironic-common_spec.rb index 678b930..91a7a62 100644 --- a/spec/ironic-common_spec.rb +++ b/spec/ironic-common_spec.rb @@ -97,6 +97,22 @@ describe 'openstack-bare-metal::ironic-common' do end end + context 'tftp' do + before do + node.set['openstack']['bare-metal']['tftp']['enabled'] = true + end + + it 'sets tftp attributes' do + [ + /^tftp_server=127.0.0.1$/, + %r(^tftp_root=/var/lib/tftpboot$), + %r(^tftp_master_path=/var/lib/tftpboot/master_images$) + ].each do |line| + expect(chef_run).to render_config_file(file.name).with_section_content('pxe', line) + end + end + end + context 'rabbit mq backend' do before do node.set['openstack']['mq']['bare-metal']['service_type'] = 'rabbitmq' diff --git a/templates/default/ironic.conf.erb b/templates/default/ironic.conf.erb index 3e4dfa4..021ad67 100644 --- a/templates/default/ironic.conf.erb +++ b/templates/default/ironic.conf.erb @@ -1229,16 +1229,18 @@ signing_dir=<%= node['openstack']['bare-metal']['api']['auth']['cache_dir'] %> # (string value) #uefi_pxe_config_template=$pybasedir/drivers/modules/elilo_efi_pxe_config.template +<% if node['openstack']['bare-metal']['tftp']['enabled'] %> # IP address of Ironic compute node's tftp server. (string # value) -#tftp_server=$my_ip +tftp_server=<%= node['openstack']['bare-metal']['tftp']['server'] %> # Ironic compute node's tftp root path. (string value) -#tftp_root=/tftpboot +tftp_root=<%= node['openstack']['bare-metal']['tftp']['root_path'] %> # Directory where master tftp images are stored on disk. # (string value) -#tftp_master_path=/tftpboot/master_images +tftp_master_path=<%= node['openstack']['bare-metal']['tftp']['master_path'] %> +<% end %> # Bootfile DHCP parameter. (string value) #pxe_bootfile_name=pxelinux.0