Cinder hooks support

This code moves all deps to an external class so that Cinder can be
installed with mechanisms besides packages (like venv or docker). This
also cleans-up the dependency tree by removing false or confusing
dependencies.

Co-Author: Craig Delatte <craig.delatte@twcable.com>

Change-Id: I55a62f6173fe463fb8fb65df6729c9f509a0fb04
This commit is contained in:
Matt Fischer 2016-07-19 14:54:58 -06:00
parent f657f9b787
commit bb1e3e67dc
90 changed files with 293 additions and 122 deletions

View File

@ -45,8 +45,8 @@ Puppet::Type.newtype(:cinder_api_paste_ini) do
defaultto('<SERVICE DEFAULT>')
end
autorequire(:package) do
'cinder'
autorequire(:anchor) do
['cinder::install::end']
end
end

View File

@ -46,8 +46,7 @@ Puppet::Type.newtype(:cinder_config) do
defaultto('<SERVICE DEFAULT>')
end
autorequire(:package) do
'cinder'
autorequire(:anchor) do
['cinder::install::end']
end
end

View File

@ -19,8 +19,7 @@ Puppet::Type.newtype(:cinder_type) do
end
end
autorequire(:service) do
'cinder-api'
autorequire(:anchor) do
['cinder::service::end']
end
end

View File

@ -236,6 +236,7 @@ class cinder::api (
$memcached_servers = undef,
) inherits cinder::params {
include ::cinder::deps
include ::cinder::params
include ::cinder::policy
@ -283,14 +284,7 @@ class cinder::api (
}
}
Cinder_config<||> ~> Service[$service_name]
Cinder_api_paste_ini<||> ~> Service[$service_name]
Class['cinder::policy'] ~> Service[$service_name]
if $::cinder::params::api_package {
Package['cinder-api'] -> Class['cinder::policy']
Package['cinder-api'] -> Service[$service_name]
Package['cinder-api'] ~> Exec<| title == 'cinder-manage db_sync' |>
package { 'cinder-api':
ensure => $package_ensure,
name => $::cinder::params::api_package,
@ -318,7 +312,6 @@ class cinder::api (
name => $::cinder::params::api_service,
enable => $enabled,
hasstatus => true,
require => Package['cinder'],
tag => 'cinder-service',
}

View File

@ -77,6 +77,7 @@ define cinder::backend::bdd (
$extra_options = {},
) {
include ::cinder::deps
include ::cinder::params
cinder_config {
@ -104,32 +105,34 @@ define cinder::backend::bdd (
'tgtadm': {
ensure_packages('tgt', {
ensure => present,
name => $::cinder::params::tgt_package_name})
name => $::cinder::params::tgt_package_name,
tag => 'cinder-support-package'})
ensure_resource('service', 'tgtd', {
ensure => running,
name => $::cinder::params::tgt_service_name,
require => Package['tgt']})
ensure => running,
name => $::cinder::params::tgt_service_name,
tag => 'cinder-support-service'})
if($::osfamily == 'RedHat') {
ensure_resource('file_line', 'cinder include', {
path => '/etc/tgt/targets.conf',
line => "include ${volumes_dir}/*",
match => '#?include /',
require => Package['tgt'],
notify => Service['tgtd']})
require => Anchor['cinder::install:end'],
notify => Anchor['cinder::service::begin']})
}
}
'lioadm': {
ensure_packages('targetcli', {
ensure => present,
name => $::cinder::params::lio_package_name})
name => $::cinder::params::lio_package_name,
tag => 'cinder-support-package'})
ensure_resource('service', 'target', {
ensure => running,
enable => true,
require => Package['targetcli']})
ensure => running,
enable => true,
tag => 'cinder-support-service'})
}
default: {

View File

@ -71,6 +71,8 @@ define cinder::backend::dellsc_iscsi (
$extra_options = {},
) {
include ::cinder::deps
if $dell_sc_server_folder == 'srv' {
warning('The OpenStack default value of dell_sc_server_folder differs from the puppet module default of "srv" and will be changed to the upstream OpenStack default in N-release.')
}

View File

@ -91,6 +91,7 @@ define cinder::backend::emc_vnx (
$manage_volume_type = false,
) {
include ::cinder::deps
include ::cinder::params
cinder_config {

View File

@ -102,6 +102,8 @@ define cinder::backend::eqlx (
$eqlx_cli_timeout = undef,
) {
include ::cinder::deps
if $eqlx_chap_login {
warning('eqlx_chap_login is deprecated and will be removed after Newton cycle. Please use chap_username instead.')
$chap_username_real = $eqlx_chap_login

View File

@ -65,12 +65,14 @@ define cinder::backend::glusterfs (
$extra_options = {},
) {
include ::cinder::deps
$content = join($glusterfs_shares, "\n")
file { $glusterfs_shares_config:
content => "${content}\n",
require => Package['cinder'],
notify => Service['cinder-volume']
require => Anchor['cinder::install::end'],
notify => Anchor['cinder::service::begin'],
}
cinder_config {

View File

@ -100,6 +100,8 @@ define cinder::backend::gpfs (
$extra_options = {},
) {
include ::cinder::deps
if ! ($gpfs_images_share_mode in ['copy', 'copy_on_write', $::os_service_default]) {
fail('gpfs_images_share_mode only support `copy` or `copy_on_write`')
}

View File

@ -83,6 +83,8 @@ define cinder::backend::hp3par_iscsi(
$extra_options = {},
) {
include ::cinder::deps
if ($hp3par_snapshot_expiration <= $hp3par_snapshot_retention) {
fail ('hp3par_snapshot_expiration must be greater than hp3par_snapshot_retention')
}

View File

@ -84,6 +84,8 @@ define cinder::backend::hpe3par_iscsi(
$extra_options = {},
) {
include ::cinder::deps
if ($hpe3par_snapshot_expiration <= $hpe3par_snapshot_retention) {
fail ('hp3par_snapshot_expiration must be greater than hp3par_snapshot_retention')
}

View File

@ -54,6 +54,7 @@ define cinder::backend::iscsi (
$extra_options = {},
) {
include ::cinder::deps
include ::cinder::params
cinder_config {
@ -80,6 +81,7 @@ define cinder::backend::iscsi (
package { 'tgt':
ensure => present,
name => $::cinder::params::tgt_package_name,
tag => 'cinder-support-package',
}
if($::osfamily == 'RedHat') {
@ -87,29 +89,30 @@ define cinder::backend::iscsi (
path => '/etc/tgt/targets.conf',
line => "include ${volumes_dir}/*",
match => '#?include /',
require => Package['tgt'],
notify => Service['tgtd'],
require => Anchor['cinder::install:end'],
notify => Anchor['cinder::service::begin'],
}
}
service { 'tgtd':
ensure => running,
name => $::cinder::params::tgt_service_name,
enable => true,
require => Class['cinder::volume'],
ensure => running,
name => $::cinder::params::tgt_service_name,
enable => true,
tag => 'cinder-support-service',
}
}
'lioadm': {
service { 'target':
ensure => running,
enable => true,
require => Package['targetcli'],
ensure => running,
enable => true,
tag => 'cinder-support-service',
}
package { 'targetcli':
ensure => present,
name => $::cinder::params::lio_package_name,
tag => 'cinder-support-package',
}
}

View File

@ -223,6 +223,8 @@ define cinder::backend::netapp (
$netapp_eseries_host_type = undef,
) {
include ::cinder::deps
if $netapp_eseries_host_type {
warning('The "netapp_eseries_host_type" parameter is deprecated. Use "netapp_host_type" instead.')
$netapp_host_type_real = $netapp_eseries_host_type
@ -234,8 +236,8 @@ define cinder::backend::netapp (
validate_array($nfs_shares)
file {$nfs_shares_config:
content => join($nfs_shares, "\n"),
require => Package['cinder'],
notify => Service['cinder-volume']
require => Anchor['cinder::install:end'],
notify => Anchor['cinder::service::begin'],
}
}

View File

@ -58,6 +58,8 @@ define cinder::backend::nexenta (
$extra_options = {},
) {
include ::cinder::deps
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/nexenta_user": value => $nexenta_user;

View File

@ -76,10 +76,12 @@ define cinder::backend::nfs (
$extra_options = {},
) {
include ::cinder::deps
file {$nfs_shares_config:
content => join($nfs_servers, "\n"),
require => Package['cinder'],
notify => Service['cinder-volume']
require => Anchor['cinder::install::end'],
notify => Anchor['cinder::service::begin'],
}
cinder_config {

View File

@ -51,6 +51,8 @@ define cinder::backend::pure(
$extra_options = {},
) {
include ::cinder::deps
$volume_driver = $pure_storage_protocol ? {
'FC' => 'cinder.volume.drivers.pure.PureFCDriver',
'iSCSI' => 'cinder.volume.drivers.pure.PureISCSIDriver'

View File

@ -56,6 +56,8 @@ define cinder::backend::quobyte (
$manage_volume_type = false,
) {
include ::cinder::deps
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value =>

View File

@ -95,6 +95,7 @@ define cinder::backend::rbd (
$volume_tmp_dir = false,
) {
include ::cinder::deps
include ::cinder::params
cinder_config {
@ -156,7 +157,7 @@ define cinder::backend::rbd (
file_line { "set initscript env ${name}":
line => $override_line,
path => $::cinder::params::ceph_init_override,
notify => Service['cinder-volume'],
notify => Anchor['cinder::service::begin'],
}
}

View File

@ -80,6 +80,8 @@ define cinder::backend::san (
$extra_options = {},
) {
include ::cinder::deps
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value => $volume_driver;

View File

@ -102,6 +102,8 @@ define cinder::backend::solidfire(
$extra_options = {},
) {
include ::cinder::deps
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value => $volume_driver;

View File

@ -76,6 +76,8 @@ define cinder::backend::vmdk (
$extra_options = {},
) {
include ::cinder::deps
if $volume_folder == 'cinder-volumes' {
warning('The OpenStack default value of volume_folder differs from the puppet module default of "cinder-volumes" and will be changed to the upstream OpenStack default in N-release.')
}
@ -107,7 +109,8 @@ define cinder::backend::vmdk (
}
package { 'python-suds':
ensure => present
ensure => present,
tag => 'cinder-support-package',
}
create_resources('cinder_config', $extra_options)

View File

@ -14,6 +14,8 @@ class cinder::backends (
$enabled_backends = undef,
) {
include ::cinder::deps
# Maybe this could be extented to dynamicly find the enabled names
cinder_config {
'DEFAULT/enabled_backends': value => join($enabled_backends, ',');

View File

@ -63,17 +63,13 @@ class cinder::backup (
$backup_name_template = $::os_service_default,
) {
include ::cinder::deps
include ::cinder::params
validate_bool($manage_service)
validate_bool($enabled)
Cinder_config<||> ~> Service['cinder-backup']
Exec<| title == 'cinder-manage db_sync' |> ~> Service['cinder-backup']
if $::cinder::params::backup_package {
Package['cinder-backup'] -> Service['cinder-backup']
Package['cinder-backup'] ~> Exec<| title == 'cinder-manage db_sync' |>
package { 'cinder-backup':
ensure => $package_ensure,
name => $::cinder::params::backup_package,
@ -94,7 +90,6 @@ class cinder::backup (
name => $::cinder::params::backup_service,
enable => $enabled,
hasstatus => true,
require => Package['cinder'],
tag => 'cinder-service',
}

View File

@ -67,6 +67,8 @@ class cinder::backup::ceph (
$backup_ceph_stripe_count = '0'
) {
include ::cinder::deps
cinder_config {
'DEFAULT/backup_driver': value => $backup_driver;
'DEFAULT/backup_ceph_conf': value => $backup_ceph_conf;

View File

@ -44,6 +44,8 @@ class cinder::backup::glusterfs (
$glusterfs_backup_share = $::os_service_default,
) {
include ::cinder::deps
cinder_config {
'DEFAULT/backup_driver': value => $backup_driver;
'DEFAULT/glusterfs_backup_mount_point': value => $glusterfs_backup_mount_point;

View File

@ -103,6 +103,8 @@ class cinder::backup::google (
$backup_gcs_enable_progress_timer = $::os_service_default,
) {
include ::cinder::deps
cinder_config {
'DEFAULT/backup_driver': value => $backup_driver;
'DEFAULT/backup_gcs_bucket': value => $backup_gcs_bucket;

View File

@ -80,6 +80,7 @@ class cinder::backup::nfs (
$backup_compression_algorithm = $::os_service_default,
) {
include ::cinder::deps
validate_string($backup_share)
cinder_config {

View File

@ -63,6 +63,8 @@ class cinder::backup::posix (
$backup_container = $::os_service_default,
) {
include ::cinder::deps
cinder_config {
'DEFAULT/backup_driver': value => $backup_driver;
'DEFAULT/backup_file_size': value => $backup_file_size;

View File

@ -88,6 +88,8 @@ class cinder::backup::swift (
$backup_compression_algorithm = $::os_service_default,
) {
include ::cinder::deps
if ($backup_swift_container == 'volumes_backup') {
warning('The OpenStack default value of backup_swift_container differs from the puppet module default of "volumes_backup" and will be changed to the upstream OpenStack default in N-release.')
}

View File

@ -48,6 +48,8 @@ class cinder::backup::tsm (
$backup_tsm_compression = $::os_service_default,
) {
include ::cinder::deps
cinder_config {
'DEFAULT/backup_driver': value => $backup_driver;
'DEFAULT/backup_tsm_volume_prefix': value => $backup_tsm_volume_prefix;

View File

@ -24,6 +24,8 @@ class cinder::ceilometer (
$notification_driver = 'messagingv2',
) {
include ::cinder::deps
oslo::messaging::notifications { 'cinder_config':
transport_url => $notification_transport_url,
driver => $notification_driver,

View File

@ -12,11 +12,12 @@ class cinder::client(
$package_ensure = 'present'
) {
include ::cinder::deps
include ::cinder::params
package { 'python-cinderclient':
ensure => $package_ensure,
name => $::cinder::params::client_package,
tag => 'openstack',
tag => ['openstack', 'cinder-support-package'],
}
}

View File

@ -32,6 +32,9 @@ class cinder::config (
$cinder_config = {},
$api_paste_ini_config = {},
) {
include ::cinder::deps
validate_hash($cinder_config)
validate_hash($api_paste_ini_config)

View File

@ -62,6 +62,8 @@ class cinder::cron::db_purge (
$destination = '/var/log/cinder/cinder-rowsflush.log'
) {
include ::cinder::deps
cron { 'cinder-manage db purge':
command => "cinder-manage db purge ${age} >>${destination} 2>&1",
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
@ -71,6 +73,6 @@ class cinder::cron::db_purge (
monthday => $monthday,
month => $month,
weekday => $weekday,
require => Package['cinder'],
require => Anchor['cinder::install::end'],
}
}

View File

@ -49,6 +49,8 @@ class cinder::db (
$database_max_overflow = $::os_service_default,
) {
include ::cinder::deps
# NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
# to use cinder::<myparam> if cinder::db::<myparam> isn't specified.
$database_connection_real = pick($::cinder::database_connection,$database_connection)

View File

@ -38,6 +38,8 @@ class cinder::db::mysql (
$collate = 'utf8_general_ci',
) {
include ::cinder::deps
validate_string($password)
::openstacklib::db::mysql { 'cinder':
@ -50,5 +52,7 @@ class cinder::db::mysql (
allowed_hosts => $allowed_hosts,
}
::Openstacklib::Db::Mysql['cinder'] ~> Exec<| title == 'cinder-manage db_sync' |>
Anchor['cinder::db::begin']
~> Class['cinder::db::mysql']
~> Anchor['cinder::db::end']
}

View File

@ -32,6 +32,8 @@ class cinder::db::postgresql(
$privileges = 'ALL',
) {
include ::cinder::deps
::openstacklib::db::postgresql { 'cinder':
password_hash => postgresql_password($user, $password),
dbname => $dbname,
@ -40,6 +42,7 @@ class cinder::db::postgresql(
privileges => $privileges,
}
::Openstacklib::Db::Postgresql['cinder'] ~> Exec<| title == 'cinder-manage db_sync' |>
Anchor['cinder::db::begin']
~> Class['cinder::db::postgresql']
~> Anchor['cinder::db::end']
}

View File

@ -13,20 +13,20 @@ class cinder::db::sync(
$extra_params = undef,
) {
include ::cinder::deps
include ::cinder::params
Package <| tag == 'cinder-package' |> ~> Exec['cinder-manage db_sync']
Exec['cinder-manage db_sync'] ~> Service <| tag == 'cinder-service' |>
Cinder_config <||> ~> Exec['cinder-manage db_sync']
Cinder_config <| title == 'database/connection' |> ~> Exec['cinder-manage db_sync']
exec { 'cinder-manage db_sync':
command => "cinder-manage ${extra_params} db sync",
path => '/usr/bin',
user => 'cinder',
refreshonly => true,
logoutput => 'on_failure',
subscribe => [
Anchor['cinder::install::end'],
Anchor['cinder::config::end'],
Anchor['cinder::dbsync::begin']
],
notify => Anchor['cinder::dbsync::end'],
}
}

73
manifests/deps.pp Normal file
View File

@ -0,0 +1,73 @@
# == Class: cinder::deps
#
# cinder anchors and dependency management
#
class cinder::deps {
# Setup anchors for install, config and service phases of the module. These
# anchors allow external modules to hook the begin and end of any of these
# phases. Package or service management can also be replaced by ensuring the
# package is absent or turning off service management and having the
# replacement depend on the appropriate anchors. When applicable, end tags
# should be notified so that subscribers can determine if installation,
# config or service state changed and act on that if needed.
anchor { 'cinder::install::begin': }
-> Package<| tag == 'cinder-package'|>
~> anchor { 'cinder::install::end': }
-> anchor { 'cinder::config::begin': }
-> Cinder_config<||>
~> anchor { 'cinder::config::end': }
-> anchor { 'cinder::db::begin': }
-> anchor { 'cinder::db::end': }
~> anchor { 'cinder::dbsync::begin': }
-> anchor { 'cinder::dbsync::end': }
~> anchor { 'cinder::service::begin': }
~> Service<| tag == 'cinder-service' |>
~> anchor { 'cinder::service::end': }
# paste-api.ini config should occur in the config block also.
Anchor['cinder::config::begin']
-> Cinder_api_paste_ini<||>
~> Anchor['cinder::config::end']
# policy config should occur in the config block also.
Anchor['cinder::config::begin']
-> Openstacklib::Policy::Base<||>
~> Anchor['cinder::config::end']
# Support packages need to be installed in the install phase, but we don't
# put them in the chain above because we don't want any false dependencies
# between packages with the cinder-package tag and the cinder-support-package
# tag. Note: the package resources here will have a 'before' relationshop on
# the cinder::install::end anchor. The line between cinder-support-package and
# cinder-package should be whether or not cinder services would need to be
# restarted if the package state was changed.
Anchor['cinder::install::begin']
-> Package<| tag == 'cinder-support-package'|>
-> Anchor['cinder::install::end']
# Support services need to be started in the service phase, but we don't
# put them in the chain above because we don't want any false dependencies
# between them and cinder services. Note: the service resources here will
# have a 'before' relationshop on the cinder::service::end anchor.
# The line between cinder-support-service and cinder-service should be
# whether or not cinder services would need to be restarted if the service
# state was changed.
Anchor['cinder::service::begin']
-> Service<| tag == 'cinder-support-service'|>
-> Anchor['cinder::service::end']
# We need openstackclient before marking service end so that cinder
# will have clients available to create resources. This tag handles the
# openstackclient but indirectly since the client is not available in
# all catalogs that don't need the client class (like many spec tests)
Package<| tag == 'openstack'|>
~> Anchor['cinder::service::end']
# The following resources need to be provisioned after the service is up.
Anchor['cinder::service::end']
-> Cinder_type<||>
# Installation or config changes will always restart services.
Anchor['cinder::install::end'] ~> Anchor['cinder::service::begin']
Anchor['cinder::config::end'] ~> Anchor['cinder::service::begin']
}

View File

@ -63,6 +63,8 @@ class cinder::glance (
$glance_request_timeout = $::os_service_default,
) {
include ::cinder::deps
cinder_config {
'DEFAULT/glance_api_servers': value => join(any2array($glance_api_servers), ',');
'DEFAULT/glance_api_version': value => $glance_api_version;

View File

@ -377,6 +377,7 @@ class cinder (
$key_file = undef,
) inherits cinder::params {
include ::cinder::deps
include ::cinder::db
include ::cinder::logging
@ -392,15 +393,10 @@ class cinder (
warning('enable_v2_api is deprecated, has no effect and will be removed in a future release')
}
# this anchor is used to simplify the graph between cinder components by
# allowing a resource to serve as a point where the configuration of cinder begins
anchor { 'cinder-start': }
package { 'cinder':
ensure => $package_ensure,
name => $::cinder::params::package_name,
tag => ['openstack', 'cinder-package'],
require => Anchor['cinder-start'],
ensure => $package_ensure,
name => $::cinder::params::package_name,
tag => ['openstack', 'cinder-package'],
}
resources { 'cinder_config':

View File

@ -194,14 +194,16 @@ class cinder::keystone::auth (
$region = 'RegionOne',
) {
include ::cinder::deps
if $configure_endpoint {
Keystone_endpoint["${region}/${service_name}::${service_type}"] -> Cinder_type<||>
Keystone_endpoint["${region}/${service_name}::${service_type}"] -> Anchor['cinder::service::end']
}
if $configure_endpoint_v2 {
Keystone_endpoint["${region}/${service_name_v2}::${service_type_v2}"] -> Cinder_type<||>
Keystone_endpoint["${region}/${service_name_v2}::${service_type_v2}"] -> Anchor['cinder::service::end']
}
if $configure_endpoint_v3 {
Keystone_endpoint["${region}/${service_name_v3}::${service_type_v3}"] -> Cinder_type<||>
Keystone_endpoint["${region}/${service_name_v3}::${service_type_v3}"] -> Anchor['cinder::service::end']
}
keystone::resource::service_identity { 'cinder':
@ -256,7 +258,7 @@ class cinder::keystone::auth (
}
if $configure_user_role {
Keystone_user_role["${auth_name}@${tenant}"] -> Cinder_type<||>
Keystone_user_role["${auth_name}@${tenant}"] -> Anchor['cinder::service::end']
}
}

View File

@ -112,6 +112,8 @@ class cinder::logging(
$verbose = undef,
) {
include ::cinder::deps
if $verbose {
warning('verbose is deprecated, has no effect and will be removed after Newton cycle.')
}

View File

@ -22,6 +22,8 @@ class cinder::policy (
$policy_path = '/etc/cinder/policy.json',
) {
include ::cinder::deps
validate_hash($policies)
Openstacklib::Policy::Base {
@ -30,4 +32,5 @@ class cinder::policy (
create_resources('openstacklib::policy::base', $policies)
oslo::policy { 'cinder_config': policy_file => $policy_path }
}

View File

@ -28,6 +28,8 @@ class cinder::quota (
$quota_driver = $::os_service_default,
) {
include ::cinder::deps
cinder_config {
'DEFAULT/quota_volumes': value => $quota_volumes;
'DEFAULT/quota_snapshots': value => $quota_snapshots;

View File

@ -58,6 +58,8 @@ define cinder::quota_set (
$volume_type = $name,
) {
include ::cinder::deps
if $os_region_name {
$cinder_env = [
"OS_TENANT_NAME=${os_tenant_name}",
@ -80,7 +82,7 @@ define cinder::quota_set (
command => "cinder quota-class-update ${class_name} --volumes ${quota_volumes} --snapshots ${quota_snapshots} --gigabytes ${quota_gigabytes} --volume-type '${volume_type}'",
onlyif => 'cinder quota-class-show default | grep -qP -- -1',
environment => $cinder_env,
require => Package['python-cinderclient'],
require => Anchor['cinder-support-package'],
path => ['/usr/bin', '/bin'],
}
}

View File

@ -28,6 +28,8 @@ class cinder::rabbitmq(
$virtual_host = '/',
) {
include ::cinder::deps
warning('cinder::rabbitmq class is deprecated and will be removed in next release. Make other plans to configure rabbitmq resources.')
if $userid == 'guest' {
@ -45,7 +47,7 @@ class cinder::rabbitmq(
write_permission => '.*',
read_permission => '.*',
provider => 'rabbitmqctl',
}->Anchor<| title == 'cinder-start' |>
} -> Anchor['cinder::service::begin']
}
rabbitmq_vhost { $virtual_host:
provider => 'rabbitmqctl',

View File

@ -28,19 +28,15 @@ class cinder::scheduler (
$manage_service = true
) {
include ::cinder::deps
include ::cinder::params
validate_bool($manage_service)
validate_bool($enabled)
Cinder_config<||> ~> Service['cinder-scheduler']
Cinder_api_paste_ini<||> ~> Service['cinder-scheduler']
Exec<| title == 'cinder-manage db_sync' |> ~> Service['cinder-scheduler']
cinder_config { 'DEFAULT/scheduler_driver': value => $scheduler_driver; }
if $::cinder::params::scheduler_package {
Package['cinder-scheduler'] -> Service['cinder-scheduler']
package { 'cinder-scheduler':
ensure => $package_ensure,
name => $::cinder::params::scheduler_package,
@ -61,7 +57,6 @@ class cinder::scheduler (
name => $::cinder::params::scheduler_service,
enable => $enabled,
hasstatus => true,
require => Package['cinder'],
tag => 'cinder-service',
}
}

View File

@ -12,6 +12,8 @@ class cinder::scheduler::filter (
$scheduler_default_filters = $::os_service_default,
) {
include ::cinder::deps
if (!is_service_default($scheduler_default_filters)) {
cinder_config {
'DEFAULT/scheduler_default_filters': value => join(any2array($scheduler_default_filters),',')

View File

@ -22,15 +22,18 @@ class cinder::setup_test_volume(
$loopback_device = '/dev/loop2'
) {
include ::cinder::deps
package { 'lvm2':
ensure => present,
require => Package['cinder'],
ensure => present,
tag => 'cinder-support-package',
} ~>
exec { "create_${volume_path}/${volume_name}":
command => "dd if=/dev/zero of=\"${volume_path}/${volume_name}\" bs=1 count=0 seek=${size}",
path => ['/bin','/usr/bin','/sbin','/usr/sbin'],
unless => "stat ${volume_path}/${volume_name}",
before => Anchor['cinder::service::begin'],
} ~>
file { "${volume_path}/${volume_name}":
@ -55,6 +58,4 @@ class cinder::setup_test_volume(
unless => "vgdisplay | grep ${volume_name}",
refreshonly => true,
}
}

View File

@ -49,6 +49,8 @@ define cinder::type (
$os_region_name = undef,
) {
include ::cinder::deps
if $os_password or $os_region_name or $os_tenant_name or $os_username or $os_auth_url {
warning('Parameters $os_password/$os_region_name/$os_tenant_name/$os_username/$os_auth_url are not longer required')
warning('Auth creds will be used from env or /root/openrc file or cinder.conf')

View File

@ -46,6 +46,8 @@ define cinder::type_set (
$os_region_name = undef,
) {
include ::cinder::deps
if $os_password or $os_region_name or $os_tenant_name or $os_username or $os_auth_url {
warning('Parameters $os_password/$os_region_name/$os_tenant_name/$os_username/$os_auth_url are not longer required.')
warning('Auth creds will be used from env or /root/openrc file or cinder.conf')

View File

@ -27,6 +27,8 @@ class cinder::vmware (
$os_auth_url = undef
) {
include ::cinder::deps
if $os_password or $os_tenant_name or $os_username or $os_auth_url {
warning('Parameters $os_password/$os_tenant_name/$os_username/$os_auth_url are not longer required.')
warning('Auth creds will be used from env or /root/openrc file or cinder.conf')

View File

@ -38,18 +38,13 @@ class cinder::volume (
$volume_clear_ionice = $::os_service_default,
) {
include ::cinder::deps
include ::cinder::params
validate_bool($manage_service)
validate_bool($enabled)
Cinder_config<||> ~> Service['cinder-volume']
Cinder_api_paste_ini<||> ~> Service['cinder-volume']
Exec<| title == 'cinder-manage db_sync' |> ~> Service['cinder-volume']
if $::cinder::params::volume_package {
Package['cinder'] -> Package['cinder-volume']
Package['cinder-volume'] -> Service['cinder-volume']
package { 'cinder-volume':
ensure => $package_ensure,
name => $::cinder::params::volume_package,
@ -70,7 +65,6 @@ class cinder::volume (
name => $::cinder::params::volume_service,
enable => $enabled,
hasstatus => true,
require => Package['cinder'],
tag => 'cinder-service',
}

View File

@ -59,6 +59,8 @@ class cinder::volume::dellsc_iscsi (
$extra_options = {},
) {
include ::cinder::deps
warning('Usage of cinder::volume::dellsc_iscsi is deprecated, please use
cinder::backend::dellsc_iscsi instead.')

View File

@ -78,6 +78,8 @@ class cinder::volume::emc_vnx(
$naviseccli_path = $::os_service_default,
) {
include ::cinder::deps
warning('Usage of cinder::volume::emc_vnx is deprecated, please use
cinder::backend::emc_vnx instead.')

View File

@ -88,6 +88,8 @@ class cinder::volume::eqlx (
$eqlx_cli_timeout = undef,
) {
include ::cinder::deps
warning('Usage of cinder::volume::eqlx is deprecated, please use
cinder::backend::eqlx instead.')

View File

@ -52,6 +52,8 @@ class cinder::volume::glusterfs (
$extra_options = {},
) {
include ::cinder::deps
warning('Usage of cinder::volume::glusterfs is deprecated, please use
cinder::backend::glusterfs instead.')

View File

@ -93,6 +93,8 @@ class cinder::volume::gpfs(
$extra_options = {}
) {
include ::cinder::deps
warning('Usage of cinder::volume::gpfs is deprecated, please use
cinder::backend::gpfs instead.')

View File

@ -64,6 +64,8 @@ class cinder::volume::hp3par_iscsi(
$extra_options = {},
) {
include ::cinder::deps
warning('The class cinder::volume::hp3par_iscsi is deprecated and will be removed after Newton cycle, pleasse use the new class cinder::volume::hpe3par_iscsi.')
cinder::backend::hpe3par_iscsi { 'DEFAULT':

View File

@ -66,6 +66,8 @@ class cinder::volume::hpe3par_iscsi(
$extra_options = {},
) {
include ::cinder::deps
warning('Usage of cinder::volume::hpe3par_iscsi is deprecated, please use
cinder::backend::hpe3par_iscsi instead.')

View File

@ -43,6 +43,7 @@ class cinder::volume::iscsi (
$extra_options = {},
) {
include ::cinder::deps
include ::cinder::params
warning('Usage of cinder::volume::iscsi is deprecated, please use

View File

@ -210,6 +210,8 @@ class cinder::volume::netapp (
$netapp_eseries_host_type = undef,
) {
include ::cinder::deps
if $netapp_eseries_host_type {
warning('The "netapp_eseries_host_type" parameter is deprecated. Use "netapp_host_type" instead.')
$netapp_host_type_real = $netapp_eseries_host_type

View File

@ -46,6 +46,8 @@ class cinder::volume::nexenta (
$extra_options = {},
) {
include ::cinder::deps
warning('Usage of cinder::volume::nexenta is deprecated, please use
cinder::backend::nexenta instead.')

View File

@ -65,6 +65,8 @@ class cinder::volume::nfs (
$extra_options = {},
) {
include ::cinder::deps
warning('Usage of cinder::volume::nfs is deprecated, please use
cinder::backend::nfs instead.')

View File

@ -44,6 +44,8 @@ class cinder::volume::pure(
$extra_options = {},
) {
include ::cinder::deps
warning('Usage of cinder::volume::pure is deprecated, please use
cinder::backend::pure instead.')

View File

@ -44,6 +44,8 @@ class cinder::volume::quobyte (
$quobyte_mount_point_base = undef,
) {
include ::cinder::deps
warning('Usage of cinder::volume::quobyte is deprecated, please use
cinder::backend::quobyte instead.')

View File

@ -75,6 +75,8 @@ class cinder::volume::rbd (
$volume_tmp_dir = false,
) {
include ::cinder::deps
warning('Usage of cinder::volume::rbd is deprecated, please use
cinder::backend::rbd instead.')

View File

@ -71,6 +71,8 @@ class cinder::volume::san (
$extra_options = {},
) {
include ::cinder::deps
warning('Usage of cinder::volume::san is deprecated, please use
cinder::backend::san instead.')

View File

@ -65,6 +65,8 @@ class cinder::volume::solidfire(
$extra_options = {},
) {
include ::cinder::deps
warning('Usage of cinder::volume::solidfire is deprecated, please use
cinder::backend::solidfire instead.')

View File

@ -64,6 +64,8 @@ class cinder::volume::vmdk(
$extra_options = {},
) {
include ::cinder::deps
warning('Usage of cinder::volume::vmdk is deprecated, please use
cinder::backend::vmdk instead.')

View File

@ -90,6 +90,7 @@ class cinder::wsgi::apache (
$priority = '10',
) {
include ::cinder::deps
include ::cinder::params
include ::apache
include ::apache::mod::wsgi
@ -120,5 +121,6 @@ class cinder::wsgi::apache (
wsgi_script_dir => $::cinder::params::cinder_wsgi_script_path,
wsgi_script_file => 'cinder-api',
wsgi_script_source => $::cinder::params::cinder_wsgi_script_source,
require => Anchor['cinder::install::end'],
}
}

View File

@ -0,0 +1,5 @@
---
features:
- moves all dependencies to an external class.
This allows keystone to be installed and managed
via external mechanisms like venvs or docker.

View File

@ -49,7 +49,6 @@ describe 'cinder::backup' do
:ensure => 'present',
:tag => ['openstack', 'cinder-package'],
)
is_expected.to contain_package('cinder-backup').with_before(/Service\[cinder-backup\]/)
end
end

View File

@ -21,7 +21,7 @@ describe 'cinder::client' do
is_expected.to contain_package('python-cinderclient').with(
:name => 'python-cinderclient',
:ensure => p[:package_ensure],
:tag => 'openstack'
:tag => ['openstack', 'cinder-support-package'],
)
end

View File

@ -27,7 +27,7 @@ describe 'cinder::cron::db_purge' do
:monthday => params[:monthday],
:month => params[:month],
:weekday => params[:weekday],
:require => 'Package[cinder]',
:require => 'Anchor[cinder::install::end]'
)
end
end

View File

@ -16,7 +16,6 @@ describe 'cinder::scheduler' do
it { is_expected.to contain_package('cinder-scheduler').with(
:name => 'cinder-scheduler',
:ensure => 'present',
:before => ['Service[cinder-scheduler]'],
:tag => ['openstack', 'cinder-package'],
) }
@ -24,7 +23,6 @@ describe 'cinder::scheduler' do
:name => 'cinder-scheduler',
:enable => true,
:ensure => 'running',
:require => 'Package[cinder]',
:hasstatus => true,
:tag => 'cinder-service',
) }
@ -68,7 +66,6 @@ describe 'cinder::scheduler' do
:name => 'openstack-cinder-scheduler',
:enable => true,
:ensure => 'running',
:require => 'Package[cinder]'
) }
end

View File

@ -4,7 +4,6 @@ describe 'cinder::setup_test_volume' do
it { is_expected.to contain_package('lvm2').with(
:ensure => 'present',
:require => 'Package[cinder]'
) }
it 'should contain volume creation execs' do

View File

@ -21,8 +21,8 @@ describe 'cinder::volume::glusterfs' do
is_expected.to contain_cinder_config('DEFAULT/glusterfs_backup_share').with_value('<SERVICE DEFAULT>')
is_expected.to contain_file('/etc/cinder/other_shares.conf').with(
:content => "10.10.10.10:/volumes\n10.10.10.11:/volumes\n",
:require => 'Package[cinder]',
:notify => 'Service[cinder-volume]'
:require => 'Anchor[cinder::install::end]',
:notify => 'Anchor[cinder::service::begin]'
)
end

View File

@ -82,7 +82,6 @@ describe 'cinder::volume::iscsi' do
it { is_expected.to contain_service('target').with(
:ensure => 'running',
:enable => 'true',
:require => 'Package[targetcli]'
) }
end

View File

@ -39,8 +39,8 @@ describe 'cinder::volume::nfs' do
'1.0')
is_expected.to contain_file('/etc/cinder/other_shares.conf').with(
:content => "10.10.10.10:/shares\n10.10.10.10:/shares2",
:require => 'Package[cinder]',
:notify => 'Service[cinder-volume]'
:require => 'Anchor[cinder::install::end]',
:notify => 'Anchor[cinder::service::begin]'
)
end
end

View File

@ -47,7 +47,7 @@ describe 'cinder::volume::rbd' do
is_expected.to contain_file_line('set initscript env DEFAULT').with(
:line => /env CEPH_ARGS=\"--id test\"/,
:path => '/etc/init/cinder-volume.override',
:notify => 'Service[cinder-volume]')
:notify => 'Anchor[cinder::service::begin]')
end
end
@ -82,7 +82,7 @@ describe 'cinder::volume::rbd' do
is_expected.to contain_file_line('set initscript env DEFAULT').with(
:line => /export CEPH_ARGS=\"--id test\"/,
:path => '/etc/sysconfig/openstack-cinder-volume',
:notify => 'Service[cinder-volume]')
:notify => 'Anchor[cinder::service::begin]')
end
end

View File

@ -33,8 +33,8 @@ describe 'cinder::backend::glusterfs' do
'/cinder_mount_point')
is_expected.to contain_file('/etc/cinder/other_shares.conf').with(
:content => "10.10.10.10:/volumes\n10.10.10.11:/volumes\n",
:require => 'Package[cinder]',
:notify => 'Service[cinder-volume]'
:require => 'Anchor[cinder::install::end]',
:notify => 'Anchor[cinder::service::begin]'
)
end

View File

@ -43,8 +43,8 @@ describe 'cinder::backend::nfs' do
'0.9')
is_expected.to contain_file('/etc/cinder/other_shares.conf').with(
:content => "10.10.10.10:/shares\n10.10.10.10:/shares2",
:require => 'Package[cinder]',
:notify => 'Service[cinder-volume]'
:require => 'Anchor[cinder::install::end]',
:notify => 'Anchor[cinder::service::begin]'
)
end
end

View File

@ -55,7 +55,7 @@ describe 'cinder::backend::rbd' do
is_expected.to contain_file_line('set initscript env rbd-ssd').with(
:line => /env CEPH_ARGS=\"--id test\"/,
:path => '/etc/init/cinder-volume.override',
:notify => 'Service[cinder-volume]')
:notify => 'Anchor[cinder::service::begin]')
end
context 'with another RBD backend' do
@ -127,7 +127,7 @@ describe 'cinder::backend::rbd' do
is_expected.to contain_file_line('set initscript env rbd-ssd').with(
:line => /export CEPH_ARGS=\"--id test\"/,
:path => '/etc/sysconfig/openstack-cinder-volume',
:notify => 'Service[cinder-volume]')
:notify => 'Anchor[cinder::service::begin]')
end
end

View File

@ -40,7 +40,7 @@ describe 'cinder::quota_set' do
'OS_AUTH_URL=http://127.127.127.1:5000/v2.0/',
'OS_REGION_NAME=test'],
:onlyif => 'cinder quota-class-show default | grep -qP -- -1',
:require => 'Package[python-cinderclient]')
:require => 'Anchor[cinder-support-package]')
end
end
end

View File

@ -23,12 +23,12 @@ describe 'Puppet::Type.type(:cinder_api_paste_ini)' do
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'cinder')
catalog.add_resource package, @cinder_api_paste_ini
anchor = Puppet::Type.type(:anchor).new(:name => 'cinder::install::end')
catalog.add_resource anchor, @cinder_api_paste_ini
dependency = @cinder_api_paste_ini.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@cinder_api_paste_ini)
expect(dependency[0].source).to eq(package)
expect(dependency[0].source).to eq(anchor)
end
end

View File

@ -8,12 +8,12 @@ describe 'Puppet::Type.type(:cinder_config)' do
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'cinder')
catalog.add_resource package, @cinder_config
anchor = Puppet::Type.type(:anchor).new(:name => 'cinder::install::end')
catalog.add_resource anchor, @cinder_config
dependency = @cinder_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@cinder_config)
expect(dependency[0].source).to eq(package)
expect(dependency[0].source).to eq(anchor)
end
end

View File

@ -17,16 +17,16 @@ describe Puppet::Type.type(:cinder_type) do
it 'should autorequire cinder-api service' do
catalog = Puppet::Resource::Catalog.new
service = Puppet::Type.type(:service).new(:name => 'cinder-api')
anchor = Puppet::Type.type(:anchor).new(:name => 'cinder::service::end')
correct_input = {
:name => 'test_type',
:properties => ['some_key1=value', 'some_key2=value1,value2']
}
cinder_type = Puppet::Type.type(:cinder_type).new(correct_input)
catalog.add_resource service, cinder_type
catalog.add_resource anchor, cinder_type
dependency = cinder_type.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(cinder_type)
expect(dependency[0].source).to eq(service)
expect(dependency[0].source).to eq(anchor)
end
end