Fix Ironic modules so services properly run in Juno

Initially, the module was not creating an ironic.conf file and now
it does.  The configurations that are being put into the ironic.conf
file come straight out of the documentation.

The package 'python-pbr' is required and was not being installed
elsewhere so it is installed by the init module.

The ironic-conductor service requires the execution of 'ironic-dbsync'
before it can be active.

In the params module, the 'RedHat' packages and services were named
incorrectly or were otherwise missing.

Change-Id: I73cecc590038fa7d9518453c448bfc243ddedff1
This commit is contained in:
Ryan Hallisey 2014-11-12 15:09:31 -05:00 committed by Javier Pena
parent 80f6900a92
commit 9ad746a5d3
6 changed files with 64 additions and 32 deletions

View File

@ -31,7 +31,7 @@ $glance_api_servers = 'glance:9292'
$deploy_kernel = 'glance://deploy_kernel_uuid' $deploy_kernel = 'glance://deploy_kernel_uuid'
$deploy_ramdisk = 'glance://deploy_ramdisk_uuid' $deploy_ramdisk = 'glance://deploy_ramdisk_uuid'
node db { node 'db' {
class { 'mysql::server': class { 'mysql::server':
config_hash => { config_hash => {

View File

@ -68,6 +68,10 @@
# (optional) The name of the user to create in keystone for use by the ironic services # (optional) The name of the user to create in keystone for use by the ironic services
# Defaults to 'ironic' # Defaults to 'ironic'
# #
# [*neutron_url*]
# (optional) The Neutron URL to be used for requests from ironic
# Defaults to false
#
# [*admin_password*] # [*admin_password*]
# (required) The password to set for the ironic admin user in keystone # (required) The password to set for the ironic admin user in keystone
# #
@ -86,6 +90,7 @@ class ironic::api (
$auth_version = false, $auth_version = false,
$admin_tenant_name = 'services', $admin_tenant_name = 'services',
$admin_user = 'ironic', $admin_user = 'ironic',
$neutron_url = false,
$admin_password, $admin_password,
) { ) {
@ -124,6 +129,12 @@ class ironic::api (
hasstatus => true, hasstatus => true,
} }
if $neutron_url {
ironic_config { 'neutron/url': value => $neutron_url; }
} else {
ironic_config { 'neutron/url': value => "${auth_protocol}://${auth_host}:9696/"; }
}
if $auth_uri { if $auth_uri {
ironic_config { 'keystone_authtoken/auth_uri': value => $auth_uri; } ironic_config { 'keystone_authtoken/auth_uri': value => $auth_uri; }
} else { } else {
@ -156,5 +167,4 @@ class ironic::api (
} }
} }
} }

View File

@ -156,25 +156,32 @@ class ironic (
include ironic::params include ironic::params
Package['ironic'] -> Ironic_config<||> Package['ironic-common'] -> Ironic_config<||>
File { file { '/etc/ironic':
require => Package['ironic'], ensure => directory,
require => Package['ironic-common'],
owner => 'root',
group => 'ironic',
mode => '0750',
}
file { '/etc/ironic/ironic.conf':
require => Package['ironic-common'],
owner => 'root', owner => 'root',
group => 'ironic', group => 'ironic',
mode => '0640', mode => '0640',
} }
file { '/etc/ironic': package { 'python-pbr':
ensure => directory, ensure => $package_ensure,
mode => '0750', name => $::ironic::params::pbr_package,
} }
file { '/etc/ironic/ironic.conf': } package { 'ironic-common':
package { 'ironic':
ensure => $package_ensure, ensure => $package_ensure,
name => $::ironic::params::package_name, name => $::ironic::params::common_package_name,
require => Package['python-pbr'],
} }
validate_re($database_connection, '(sqlite|mysql|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') validate_re($database_connection, '(sqlite|mysql|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
@ -182,7 +189,6 @@ class ironic (
case $database_connection { case $database_connection {
/mysql:\/\/\S+:\S+@\S+\/\S+/: { /mysql:\/\/\S+:\S+@\S+\/\S+/: {
$database_backend_package = false $database_backend_package = false
require 'mysql::python'
} }
/postgresql:\/\/\S+:\S+@\S+\/\S+/: { /postgresql:\/\/\S+:\S+@\S+\/\S+/: {
$database_backend_package = 'python-psycopg2' $database_backend_package = 'python-psycopg2'
@ -226,6 +232,16 @@ class ironic (
'glance/glance_api_insecure': value => $glance_api_insecure; 'glance/glance_api_insecure': value => $glance_api_insecure;
} }
Ironic_config['database/connection'] ~> Exec['ironic-dbsync']
exec { 'ironic-dbsync':
command => $::ironic::params::dbsync_command,
path => '/usr/bin',
user => 'ironic',
refreshonly => true,
logoutput => on_failure,
}
if $rpc_backend == 'ironic.openstack.common.rpc.impl_kombu' { if $rpc_backend == 'ironic.openstack.common.rpc.impl_kombu' {
if ! $rabbit_password { if ! $rabbit_password {
fail('When rpc_backend is rabbitmq, you must set rabbit password') fail('When rpc_backend is rabbitmq, you must set rabbit password')

View File

@ -20,22 +20,27 @@
class ironic::params { class ironic::params {
$dbsync_command =
'ironic-dbsync --config-file /etc/ironic/ironic.conf'
case $::osfamily { case $::osfamily {
'RedHat': { 'RedHat': {
$package_name = 'openstack-ironic' $common_package_name = 'openstack-ironic-common'
$api_package = false $api_package = 'openstack-ironic-api'
$conductor_package = false $api_service = 'openstack-ironic-api'
$api_service = 'ironic-api' $conductor_package = 'openstack-ironic-conductor'
$conductor_service = 'ironic-conductor' $conductor_service = 'openstack-ironic-conductor'
$client_package = 'python-ironicclient' $client_package = 'python-ironicclient'
$pbr_package = 'python-pbr'
} }
'Debian': { 'Debian': {
$package_name = 'ironic-common' $common_package_name = 'ironic-common'
$api_service = 'ironic-api' $api_service = 'ironic-api'
$conductor_service = 'ironic-conductor'
$api_package = 'ironic-api' $api_package = 'ironic-api'
$conductor_service = 'ironic-conductor'
$conductor_package = 'ironic-conductor' $conductor_package = 'ironic-conductor'
$client_package = 'python-ironicclient' $client_package = 'python-ironicclient'
$pbr_package = 'python-pbr'
} }
default: { default: {
fail("Unsupported osfamily ${::osfamily}") fail("Unsupported osfamily ${::osfamily}")

View File

@ -102,7 +102,8 @@ describe 'ironic' do
:owner => 'root', :owner => 'root',
:group => 'ironic', :group => 'ironic',
:mode => '0750', :mode => '0750',
:require => 'Package[ironic]' :require => 'Package[python-pbr]',
:require => 'Package[ironic-common]'
) )
end end
@ -111,12 +112,12 @@ describe 'ironic' do
:owner => 'root', :owner => 'root',
:group => 'ironic', :group => 'ironic',
:mode => '0640', :mode => '0640',
:require => 'Package[ironic]' :require => 'Package[ironic-common]'
) )
end end
it 'installs ironic package' do it 'installs ironic package' do
should contain_package('ironic').with( should contain_package('ironic-common').with(
:ensure => 'present', :ensure => 'present',
:name => platform_params[:common_package_name] :name => platform_params[:common_package_name]
) )
@ -233,7 +234,7 @@ describe 'ironic' do
end end
let :platform_params do let :platform_params do
{ :common_package_name => 'openstack-ironic' } { :common_package_name => 'openstack-ironic-common' }
end end
it_configures 'ironic' it_configures 'ironic'