update cinder for folsome
These are my initial changes to Joe's initial cinder module.
This commit is contained in:
parent
f59c361f9e
commit
14a96dc17f
22
lib/puppet/provider/cinder_api_paste_ini/ini_setting.rb
Normal file
22
lib/puppet/provider/cinder_api_paste_ini/ini_setting.rb
Normal file
@ -0,0 +1,22 @@
|
||||
Puppet::Type.type(:cinder_api_paste_ini).provide(
|
||||
:ini_setting,
|
||||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
|
||||
) do
|
||||
|
||||
def section
|
||||
resource[:name].split('/', 2).first
|
||||
end
|
||||
|
||||
def setting
|
||||
resource[:name].split('/', 2).last
|
||||
end
|
||||
|
||||
def separator
|
||||
'='
|
||||
end
|
||||
|
||||
def file_path
|
||||
'/etc/cinder/api-paste.ini'
|
||||
end
|
||||
|
||||
end
|
22
lib/puppet/provider/cinder_config/ini_setting.rb
Normal file
22
lib/puppet/provider/cinder_config/ini_setting.rb
Normal file
@ -0,0 +1,22 @@
|
||||
Puppet::Type.type(:cinder_config).provide(
|
||||
:ini_setting,
|
||||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
|
||||
) do
|
||||
|
||||
def section
|
||||
resource[:name].split('/', 2).first
|
||||
end
|
||||
|
||||
def setting
|
||||
resource[:name].split('/', 2).last
|
||||
end
|
||||
|
||||
def separator
|
||||
'='
|
||||
end
|
||||
|
||||
def file_path
|
||||
'/etc/cinder/cinder.conf'
|
||||
end
|
||||
|
||||
end
|
18
lib/puppet/type/cinder_api_paste_ini.rb
Normal file
18
lib/puppet/type/cinder_api_paste_ini.rb
Normal file
@ -0,0 +1,18 @@
|
||||
Puppet::Type.newtype(:cinder_api_paste_ini) do
|
||||
|
||||
ensurable
|
||||
|
||||
newparam(:name, :namevar => true) do
|
||||
desc 'Section/setting name to manage from /etc/cinder/api-paste.ini'
|
||||
newvalues(/\S+\/\S+/)
|
||||
end
|
||||
|
||||
newproperty(:value) do
|
||||
desc 'The value of the setting to be defined.'
|
||||
munge do |v|
|
||||
v.to_s.strip
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
18
lib/puppet/type/cinder_config.rb
Normal file
18
lib/puppet/type/cinder_config.rb
Normal file
@ -0,0 +1,18 @@
|
||||
Puppet::Type.newtype(:cinder_config) do
|
||||
|
||||
ensurable
|
||||
|
||||
newparam(:name, :namevar => true) do
|
||||
desc 'Section/setting name to manage from /etc/cinder/cinder.conf'
|
||||
newvalues(/\S+\/\S+/)
|
||||
end
|
||||
|
||||
newproperty(:value) do
|
||||
desc 'The value of the setting to be defined.'
|
||||
munge do |v|
|
||||
v.to_s.strip
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
@ -1,15 +1,27 @@
|
||||
#
|
||||
class cinder::api (
|
||||
$package_ensure = 'latest',
|
||||
$enabled = true
|
||||
$keystone_password,
|
||||
$keystone_enabled = true,
|
||||
$keystone_tenant = 'services',
|
||||
$keystone_user = 'cinder',
|
||||
$keystone_auth_host = 'localhost',
|
||||
$keystone_auth_port = '35357',
|
||||
$keystone_auth_protocol = 'http',
|
||||
$package_ensure = 'latest',
|
||||
$enabled = true
|
||||
) {
|
||||
|
||||
include cinder::params
|
||||
|
||||
Cinder_config<||> ~> Service['cinder-api']
|
||||
Cinder_config<||> ~> Exec['cinder-manage db_sync']
|
||||
Cinder_api_paste_ini<||> ~> Service['cinder-api']
|
||||
Package['cinder-api'] -> Cinder_config<||>
|
||||
Package['cinder-api'] -> Cinder_api_paste_ini<||>
|
||||
|
||||
package { 'cinder-api':
|
||||
name => $::cinder::params::api_package,
|
||||
ensure => $package_ensure,
|
||||
require => Class['cinder'],
|
||||
}
|
||||
|
||||
if $enabled {
|
||||
@ -25,5 +37,29 @@ class cinder::api (
|
||||
require => Package[$::cinder::params::api_package],
|
||||
}
|
||||
|
||||
Ini_setting<| tag == $::cinder::params::cinder_conf_tag |> ~> Service['cinder-api']
|
||||
if $keystone_enabled {
|
||||
cinder_config {
|
||||
'DEFAULT/auth_strategy': value => 'keystone' ;
|
||||
}
|
||||
cinder_api_paste_ini {
|
||||
'filter:authtoken/service_protocol': value => $keystone_auth_protocol;
|
||||
'filter:authtoken/service_host': value => $keystone_auth_host;
|
||||
'filter:authtoken/service_port': value => '5000';
|
||||
'filter:authtoken/auth_protocol': value => $keystone_auth_protocol;
|
||||
'filter:authtoken/auth_host': value => $keystone_auth_host;
|
||||
'filter:authtoken/auth_port': value => $keystone_auth_port;
|
||||
'filter:authtoken/admin_tenant_name': value => $keystone_tenant;
|
||||
'filter:authtoken/admin_user': value => $keystone_user;
|
||||
'filter:authtoken/admin_password': value => $keystone_password;
|
||||
}
|
||||
}
|
||||
|
||||
exec { 'cinder-manage db_sync':
|
||||
command => $::cinder::params::db_sync_command,
|
||||
path => '/usr/bin',
|
||||
user => 'cinder',
|
||||
refreshonly => true,
|
||||
logoutput => 'on_failure',
|
||||
}
|
||||
|
||||
}
|
||||
|
56
manifests/base.pp
Normal file
56
manifests/base.pp
Normal file
@ -0,0 +1,56 @@
|
||||
#
|
||||
# parameters that may need to be added
|
||||
# $state_path = /opt/stack/data/cinder
|
||||
# $osapi_volume_extension = cinder.api.openstack.volume.contrib.standard_extensions
|
||||
# $root_helper = sudo /usr/local/bin/cinder-rootwrap /etc/cinder/rootwrap.conf
|
||||
class cinder::base (
|
||||
$rabbit_password,
|
||||
$sql_connection,
|
||||
$rabbit_host = '127.0.0.1',
|
||||
$rabbit_port = 5672,
|
||||
$rabbit_virtual_host = '/',
|
||||
$rabbit_userid = 'nova',
|
||||
$package_ensure = 'present',
|
||||
$verbose = 'True'
|
||||
) {
|
||||
|
||||
include cinder::params
|
||||
|
||||
Package['cinder'] -> Cinder_config<||>
|
||||
Package['cinder'] -> Cinder_api_paste_ini<||>
|
||||
|
||||
package { 'cinder':
|
||||
name => $::cinder::params::package_name,
|
||||
ensure => $package_ensure,
|
||||
}
|
||||
|
||||
File {
|
||||
ensure => present,
|
||||
owner => 'cinder',
|
||||
group => 'cinder',
|
||||
mode => '0644',
|
||||
require => Package[$::cinder::params::package_name],
|
||||
}
|
||||
|
||||
file { $::cinder::params::cinder_conf: }
|
||||
file { $::cinder::params::cinder_paste_api_ini: }
|
||||
|
||||
# Temporary fixes
|
||||
file { ['/var/log/cinder', '/var/lib/cinder']:
|
||||
ensure => directory,
|
||||
owner => 'cinder',
|
||||
group => 'cinder',
|
||||
}
|
||||
|
||||
cinder_config {
|
||||
'DEFAULT/rabbit_password': value => $rabbit_password;
|
||||
'DEFAULT/rabbit_host': value => $rabbit_host;
|
||||
'DEFAULT/rabbit_port': value => $rabbit_port;
|
||||
'DEFAULT/rabbit_virtual_host': value => $rabbit_virtual_host;
|
||||
'DEFAULT/rabbit_userid': value => $rabbit_userid;
|
||||
'DEFAULT/sql_connection': value => $sql_connection;
|
||||
'DEFAULT/verbose': value => $verbose;
|
||||
'DEFAULT/api_paste_config': value => '/etc/cinder/api-paste.ini';
|
||||
}
|
||||
|
||||
}
|
@ -12,7 +12,7 @@ class cinder::db::mysql (
|
||||
include cinder::params
|
||||
|
||||
Class['mysql::server'] -> Class['cinder::db::mysql']
|
||||
Class['cinder::db::mysql'] -> Class['cinder::db::sync']
|
||||
Class['cinder::db::mysql'] -> Exec<| title == 'cinder-manage db_sync' |>
|
||||
Database[$dbname] ~> Exec<| title == 'cinder-manage db_sync' |>
|
||||
|
||||
mysql::db { $dbname:
|
||||
|
@ -1,59 +0,0 @@
|
||||
#
|
||||
class cinder (
|
||||
$keystone_password,
|
||||
$cinder_settings = false,
|
||||
$keystone_enabled = true,
|
||||
$keystone_tenant = 'services',
|
||||
$keystone_user = 'cinder',
|
||||
$keystone_auth_host = 'localhost',
|
||||
$keystone_auth_port = '35357',
|
||||
$keystone_auth_protocol = 'http',
|
||||
$package_ensure = 'latest',
|
||||
) {
|
||||
|
||||
include cinder::params
|
||||
|
||||
package { 'cinder':
|
||||
name => $::cinder::params::package_name,
|
||||
ensure => $package_ensure,
|
||||
}
|
||||
|
||||
File {
|
||||
ensure => present,
|
||||
owner => 'cinder',
|
||||
group => 'cinder',
|
||||
mode => '0644',
|
||||
require => Package[$::cinder::params::package_name],
|
||||
}
|
||||
|
||||
file { $::cinder::params::cinder_conf: }
|
||||
file { $::cinder::params::cinder_paste_api_ini: }
|
||||
|
||||
# Temporary fixes
|
||||
file { ['/var/log/cinder', '/var/lib/cinder']:
|
||||
ensure => directory,
|
||||
owner => 'cinder',
|
||||
group => 'adm',
|
||||
}
|
||||
|
||||
if $cinder_settings {
|
||||
multini($::cinder::params::cinder_conf, $cinder_settings)
|
||||
}
|
||||
|
||||
if $keystone_enabled {
|
||||
multini($::cinder::params::cinder_conf, { 'DEFAULT' => { 'auth_strategy' => 'keystone' } })
|
||||
$keystone_settings = {
|
||||
'filter:authtoken' => {
|
||||
'auth_host' => $keystone_auth_host,
|
||||
'auth_port' => $keystone_auth_port,
|
||||
'auth_protocol' => $keystone_auth_protocol,
|
||||
'admin_user' => $keystone_user,
|
||||
'admin_password' => $keystone_password,
|
||||
'admin_tenant_name' => $keystone_tenant
|
||||
}
|
||||
}
|
||||
|
||||
multini($::cinder::params::cinder_paste_api_ini, $keystone_settings)
|
||||
}
|
||||
|
||||
}
|
@ -13,9 +13,7 @@ class cinder::keystone::auth (
|
||||
$region = 'RegionOne'
|
||||
) {
|
||||
|
||||
Class['keystone::db::sync'] -> Class['cinder::keystone::auth']
|
||||
|
||||
Keystone_user_role["${auth_name}@services"] ~> Service <| name == 'cinder-api' |>
|
||||
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'cinder-api' |>
|
||||
|
||||
keystone_user { $auth_name:
|
||||
ensure => present,
|
||||
@ -23,7 +21,7 @@ class cinder::keystone::auth (
|
||||
email => $email,
|
||||
tenant => $tenant,
|
||||
}
|
||||
keystone_user_role { "${auth_name}@services":
|
||||
keystone_user_role { "${auth_name}@${tenant}":
|
||||
ensure => present,
|
||||
roles => 'admin',
|
||||
}
|
||||
|
@ -2,9 +2,7 @@
|
||||
class cinder::params {
|
||||
|
||||
$cinder_conf = '/etc/cinder/cinder.conf'
|
||||
$cinder_conf_tag = regsubst($cinder_conf, '/', '_', 'G')
|
||||
$cinder_paste_api_ini = '/etc/cinder/api-paste.ini'
|
||||
$cinder_paste_api_ini_tag = regsubst($cinder_paste_api_ini, '/', '_', 'G')
|
||||
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
|
@ -6,10 +6,14 @@ class cinder::scheduler (
|
||||
|
||||
include cinder::params
|
||||
|
||||
Package['cinder-scheduler'] -> Cinder_config<||>
|
||||
Package['cinder-scheduler'] -> Cinder_api_paste_ini<||>
|
||||
Cinder_config<||> ~> Service['cinder-scheduler']
|
||||
Cinder_api_paste_ini<||> ~> Service['cinder-scheduler']
|
||||
|
||||
package { 'cinder-scheduler':
|
||||
name => $::cinder::params::scheduler_package,
|
||||
ensure => $package_ensure,
|
||||
require => Class['cinder'],
|
||||
}
|
||||
|
||||
if $enabled {
|
||||
@ -25,6 +29,4 @@ class cinder::scheduler (
|
||||
require => Package[$::cinder::params::scheduler_package],
|
||||
subscribe => File[$::cinder::params::cinder_conf],
|
||||
}
|
||||
|
||||
Ini_setting<| tag == $::cinder::params::cinder_conf_tag |> ~> Service['cinder-scheduler']
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#
|
||||
# $volume_name_template = volume-%s
|
||||
class cinder::volume (
|
||||
$package_ensure = 'latest',
|
||||
$enabled = true
|
||||
@ -6,10 +6,15 @@ class cinder::volume (
|
||||
|
||||
include cinder::params
|
||||
|
||||
Package['cinder-volume'] -> Cinder_config<||>
|
||||
Package['cinder-volume'] -> Cinder_api_paste_ini<||>
|
||||
Package['cinder'] -> Package['cinder-volume']
|
||||
Cinder_config<||> ~> Service['cinder-volume']
|
||||
Cinder_api_paste_ini<||> ~> Service['cinder-volume']
|
||||
|
||||
package { 'cinder-volume':
|
||||
name => $::cinder::params::volume_package,
|
||||
ensure => $package_ensure,
|
||||
require => Class['cinder'],
|
||||
}
|
||||
|
||||
if $enabled {
|
||||
@ -26,6 +31,4 @@ class cinder::volume (
|
||||
subscribe => File[$::cinder::params::cinder_conf],
|
||||
}
|
||||
|
||||
Ini_setting<| tag == $::cinder::params::cinder_conf_tag |> ~> Service['cinder-volume']
|
||||
|
||||
}
|
||||
|
@ -1,14 +1,15 @@
|
||||
#
|
||||
class cinder::volume::iscsi (
|
||||
$iscsi_settings = false,
|
||||
$iscsi_helper = 'tgtadm'
|
||||
$volume_group = 'stack-volumes',
|
||||
$iscsi_helper = 'tgtadm'
|
||||
) {
|
||||
|
||||
include cinder::params
|
||||
|
||||
if $iscsi_settings {
|
||||
multini($::cinder::params::cinder_conf, $iscsi_settings)
|
||||
}
|
||||
cinder_config {
|
||||
'DEFAULT/iscsi_helper': value => $iscsi_helper;
|
||||
'DEFAULT/volume_group': value => $volume_group;
|
||||
}
|
||||
|
||||
case $iscsi_helper {
|
||||
'tgtadm': {
|
||||
@ -23,12 +24,11 @@ class cinder::volume::iscsi (
|
||||
require => Class['cinder::volume'],
|
||||
}
|
||||
|
||||
multini($::cinder::params::cinder_conf, { 'DEFAULT' => { 'iscsi_helper' => 'tgtadm' } } )
|
||||
}
|
||||
|
||||
default: {
|
||||
fail("Unsupported iscsi helper: ${iscsi_helper}.")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user