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
This commit is contained in:
Dmitry Tantsur 2016-08-29 16:11:32 +02:00
parent b5d2769041
commit f96b696a6e
6 changed files with 46 additions and 36 deletions

View File

@ -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;

View File

@ -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;

View File

@ -0,0 +1,3 @@
---
deprecations:
- The "enabled_drivers" option was moved to "ironic::conductor" manifest.

View File

@ -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',

View File

@ -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 => '<SERVICE DEFAULT>')
@ -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

View File

@ -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('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>')
@ -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