From f96b696a6e09b21aecf592cda1b3439713a5f6d1 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Mon, 29 Aug 2016 16:11:32 +0200 Subject: [PATCH] Move enabled_drivers to ironic::conductor manifest The drivers belong to the conductor. Even worse, different conductors can have a different set of enabled drivers, so creating this option for API makes no sense at all. Installing ipmitool also moved there, as it's required on conductor. Change-Id: I897706dca19b46a67bd33fa95e79184dea42de0b --- manifests/conductor.pp | 21 +++++++++++++++ manifests/init.pp | 26 +++++-------------- .../enabled-drivers-9a1e109bda75cf04.yaml | 3 +++ spec/acceptance/ironic_wsgi_apache_spec.rb | 5 ++-- spec/classes/ironic_conductor_spec.rb | 13 ++++++++++ spec/classes/ironic_init_spec.rb | 14 ---------- 6 files changed, 46 insertions(+), 36 deletions(-) create mode 100644 releasenotes/notes/enabled-drivers-9a1e109bda75cf04.yaml diff --git a/manifests/conductor.pp b/manifests/conductor.pp index b47faa91..49e5ca5c 100644 --- a/manifests/conductor.pp +++ b/manifests/conductor.pp @@ -27,6 +27,10 @@ # (optional) Define if the service must be enabled or not. # Defaults to true. # +# [*enabled_drivers*] +# (optional) Array of drivers to load during service initialization. +# Defaults to ['pxe_ipmitool']. +# # [*max_time_interval*] # (optional) Maximum time, in seconds, since the last check-in of a conductor. # Should be an interger value @@ -77,6 +81,7 @@ class ironic::conductor ( $package_ensure = 'present', $enabled = true, + $enabled_drivers = ['pxe_ipmitool'], $max_time_interval = '120', $force_power_state_during_sync = true, $automated_clean = $::os_service_default, @@ -92,6 +97,21 @@ class ironic::conductor ( Ironic_config<||> ~> Service['ironic-conductor'] + $enabled_drivers_real = pick($::ironic::enabled_drivers, $enabled_drivers) + + validate_array($enabled_drivers_real) + + # On Ubuntu, ipmitool dependency is missing and ironic-conductor fails to start. + # https://bugs.launchpad.net/cloud-archive/+bug/1572800 + if member($enabled_drivers_real, 'pxe_ipmitool') and $::osfamily == 'Debian' { + ensure_packages('ipmitool', + { + ensure => $package_ensure, + tag => ['openstack', 'ironic-package'], + } + ) + } + if $cleaning_disk_erase { validate_re($cleaning_disk_erase, ['^full$', '^metadata$', '^none$']) } @@ -117,6 +137,7 @@ class ironic::conductor ( # Configure ironic.conf ironic_config { + 'DEFAULT/enabled_drivers': value => join($enabled_drivers_real, ','); 'conductor/max_time_interval': value => $max_time_interval; 'conductor/force_power_state_during_sync': value => $force_power_state_during_sync; 'conductor/automated_clean': value => $automated_clean; diff --git a/manifests/init.pp b/manifests/init.pp index 67b0e56f..c180fef3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -43,11 +43,6 @@ # (optional) Default protocol to use when connecting to glance # Defaults to 'keystone'. 'https' is the only other valid option for SSL # -# [*enabled_drivers*] -# (optional) Array of drivers to load during service -# initialization. -# Defaults to ['pxe_ipmitool']. -# # [*rpc_response_timeout*] # (optional) Seconds to wait for a response from a call. (integer value) # Defaults to $::os_service_default. @@ -292,6 +287,11 @@ # [*verbose*] # (optional) Deprecated, Verbose logging # Defaults to undef +# +# [*enabled_drivers*] +# (optional) Array of drivers to load during service +# initialization. Deprecated and moved to conductor. +# Defaults to undef class ironic ( @@ -304,7 +304,6 @@ class ironic ( $log_facility = undef, $log_dir = undef, $auth_strategy = 'keystone', - $enabled_drivers = ['pxe_ipmitool'], $control_exchange = $::os_service_default, $rpc_response_timeout = $::os_service_default, $default_transport_url = $::os_service_default, @@ -358,6 +357,7 @@ class ironic ( # DEPRECATED PARAMETERS $rabbit_user = undef, $verbose = undef, + $enabled_drivers = undef, ) { include ::ironic::logging @@ -389,19 +389,6 @@ class ironic ( } Package['ironic-lib'] ~> Service<| tag == 'ironic-service' |> - validate_array($enabled_drivers) - - # On Ubuntu, ipmitool dependency is missing and ironic-conductor fails to start. - # https://bugs.launchpad.net/cloud-archive/+bug/1572800 - if member($enabled_drivers, 'pxe_ipmitool') and $::osfamily == 'Debian' { - ensure_packages('ipmitool', - { - ensure => $package_ensure, - tag => ['openstack', 'ironic-package'], - } - ) - } - resources { 'ironic_config': purge => $purge_config, } @@ -418,7 +405,6 @@ class ironic ( ironic_config { 'DEFAULT/auth_strategy': value => $auth_strategy; - 'DEFAULT/enabled_drivers': value => join($enabled_drivers, ','); 'DEFAULT/my_ip': value => $my_ip; 'glance/glance_num_retries': value => $glance_num_retries; 'glance/glance_api_insecure': value => $glance_api_insecure; diff --git a/releasenotes/notes/enabled-drivers-9a1e109bda75cf04.yaml b/releasenotes/notes/enabled-drivers-9a1e109bda75cf04.yaml new file mode 100644 index 00000000..af4936e9 --- /dev/null +++ b/releasenotes/notes/enabled-drivers-9a1e109bda75cf04.yaml @@ -0,0 +1,3 @@ +--- +deprecations: + - The "enabled_drivers" option was moved to "ironic::conductor" manifest. diff --git a/spec/acceptance/ironic_wsgi_apache_spec.rb b/spec/acceptance/ironic_wsgi_apache_spec.rb index 1163b5f1..3701027e 100644 --- a/spec/acceptance/ironic_wsgi_apache_spec.rb +++ b/spec/acceptance/ironic_wsgi_apache_spec.rb @@ -37,7 +37,6 @@ describe 'basic ironic' do rabbit_host => '127.0.0.1', database_connection => 'mysql+pymysql://ironic:a_big_secret@127.0.0.1/ironic?charset=utf8', debug => true, - enabled_drivers => ['pxe_ssh'], } class { '::ironic::db::mysql': password => 'a_big_secret', @@ -49,7 +48,9 @@ describe 'basic ironic' do password => 'a_big_secret', } class { '::ironic::client': } - class { '::ironic::conductor': } + class { '::ironic::conductor': + enabled_drivers => ['pxe_ssh'], + } class { '::ironic::api': admin_password => 'a_big_secret', service_name => 'httpd', diff --git a/spec/classes/ironic_conductor_spec.rb b/spec/classes/ironic_conductor_spec.rb index 0b5ddc66..dc8261d0 100644 --- a/spec/classes/ironic_conductor_spec.rb +++ b/spec/classes/ironic_conductor_spec.rb @@ -25,6 +25,7 @@ describe 'ironic::conductor' do let :default_params do { :package_ensure => 'present', :enabled => true, + :enabled_drivers => ['pxe_ipmitool'], :max_time_interval => '120', :force_power_state_during_sync => true } end @@ -59,6 +60,7 @@ describe 'ironic::conductor' do end it 'configures ironic.conf' do + is_expected.to contain_ironic_config('DEFAULT/enabled_drivers').with_value('pxe_ipmitool') is_expected.to contain_ironic_config('conductor/max_time_interval').with_value(p[:max_time_interval]) is_expected.to contain_ironic_config('conductor/force_power_state_during_sync').with_value(p[:force_power_state_during_sync]) is_expected.to contain_ironic_config('conductor/automated_clean').with(:value => '') @@ -72,6 +74,7 @@ describe 'ironic::conductor' do context 'when overriding parameters' do before :each do params.merge!( + :enabled_drivers => ['pxe_ssh', 'agent_ssh'], :max_time_interval => '50', :force_power_state_during_sync => false, :automated_clean => false, @@ -83,6 +86,7 @@ describe 'ironic::conductor' do ) end it 'should replace default parameter with new value' do + is_expected.to contain_ironic_config('DEFAULT/enabled_drivers').with_value('pxe_ssh,agent_ssh') is_expected.to contain_ironic_config('conductor/max_time_interval').with_value(p[:max_time_interval]) is_expected.to contain_ironic_config('conductor/force_power_state_during_sync').with_value(p[:force_power_state_during_sync]) is_expected.to contain_ironic_config('conductor/automated_clean').with_value(p[:automated_clean]) @@ -108,6 +112,15 @@ describe 'ironic::conductor' do end it_configures 'ironic conductor' + + # https://bugs.launchpad.net/cloud-archive/+bug/1572800 + it 'installs ipmitool package' do + is_expected.to contain_package('ipmitool').with( + :ensure => 'present', + :name => 'ipmitool', + :tag => ['openstack', 'ironic-package'], + ) + end end context 'on RedHat platforms' do diff --git a/spec/classes/ironic_init_spec.rb b/spec/classes/ironic_init_spec.rb index 633ce373..db1ff52d 100644 --- a/spec/classes/ironic_init_spec.rb +++ b/spec/classes/ironic_init_spec.rb @@ -25,7 +25,6 @@ describe 'ironic' do let :params do { :package_ensure => 'present', :debug => false, - :enabled_drivers => ['pxe_ipmitool'], :database_connection => 'sqlite:////var/lib/ironic/ironic.sqlite', :database_max_retries => 10, :database_idle_timeout => 3600, @@ -98,10 +97,6 @@ describe 'ironic' do }) end - it 'configures enabled_drivers' do - is_expected.to contain_ironic_config('DEFAULT/enabled_drivers').with_value( params[:enabled_drivers] ) - end - it 'configures credentials for rabbit' do is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_userid').with_value('') is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_password').with_value('') @@ -298,15 +293,6 @@ describe 'ironic' do end it_configures 'ironic' - - # https://bugs.launchpad.net/cloud-archive/+bug/1572800 - it 'installs ipmitool package' do - is_expected.to contain_package('ipmitool').with( - :ensure => 'present', - :name => 'ipmitool', - :tag => ['openstack', 'ironic-package'], - ) - end end context 'on RedHat platforms' do