Add hooks for external install & svc management
This adds defined anchor points for external modules to hook into the software install, config and service dependency chain. This allows external modules to manage software installation (virtualenv, containers, etc) and service management (pacemaker) without needing rely on resources that may change or be renamed. Change-Id: If6423151f75e384ac5539a848942e82fc4c8e95c
This commit is contained in:
@@ -24,6 +24,8 @@ class rally::config (
|
||||
$rally_config = {},
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
validate_hash($rally_config)
|
||||
|
||||
create_resources('rally_config', $rally_config)
|
||||
|
||||
@@ -49,6 +49,8 @@ class rally::db (
|
||||
$database_db_max_retries = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
$database_connection_real = pick($::rally::database_connection, $database_connection)
|
||||
$database_idle_timeout_real = pick($::rally::database_idle_timeout, $database_idle_timeout)
|
||||
$database_min_pool_size_real = pick($::rally::database_min_pool_size, $database_min_pool_size)
|
||||
|
||||
@@ -53,6 +53,8 @@ class rally::db::mysql(
|
||||
$allowed_hosts = undef
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
validate_string($password)
|
||||
|
||||
::openstacklib::db::mysql { 'rally':
|
||||
@@ -65,5 +67,8 @@ class rally::db::mysql(
|
||||
allowed_hosts => $allowed_hosts,
|
||||
}
|
||||
|
||||
::Openstacklib::Db::Mysql['rally'] ~> Exec<| title == 'rally-manage db_sync' |>
|
||||
Anchor['rally::db::begin']
|
||||
~> Class['rally::db::mysql']
|
||||
~> Anchor['rally::db::end']
|
||||
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class rally::db::postgresql(
|
||||
$privileges = 'ALL',
|
||||
) {
|
||||
|
||||
Class['rally::db::postgresql'] -> Service<| title == 'rally' |>
|
||||
include ::rally::deps
|
||||
|
||||
::openstacklib::db::postgresql { 'rally':
|
||||
password_hash => postgresql_password($user, $password),
|
||||
@@ -50,6 +50,8 @@ class rally::db::postgresql(
|
||||
privileges => $privileges,
|
||||
}
|
||||
|
||||
::Openstacklib::Db::Postgresql['rally'] ~> Exec<| title == 'rally-manage db_sync' |>
|
||||
Anchor['rally::db::begin']
|
||||
~> Class['rally::db::postgresql']
|
||||
~> Anchor['rally::db::end']
|
||||
|
||||
}
|
||||
|
||||
@@ -13,12 +13,9 @@ class rally::db::sync(
|
||||
$extra_params = '--config-file /etc/rally/rally.conf',
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
include ::rally::params
|
||||
|
||||
Package<| tag == 'rally-package' |> ~> Exec['rally-manage db_sync']
|
||||
|
||||
Rally_config<||> ~> Exec['rally-manage db_sync']
|
||||
|
||||
exec { 'rally-manage db_sync':
|
||||
command => "rally-manage ${extra_params} db create",
|
||||
path => '/usr/bin',
|
||||
@@ -27,6 +24,12 @@ class rally::db::sync(
|
||||
try_sleep => 5,
|
||||
tries => 10,
|
||||
logoutput => on_failure,
|
||||
subscribe => [
|
||||
Anchor['rally::install::end'],
|
||||
Anchor['rally::config::end'],
|
||||
Anchor['rally::dbsync::begin']
|
||||
],
|
||||
notify => Anchor['rally::dbsync::end'],
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
30
manifests/deps.pp
Normal file
30
manifests/deps.pp
Normal file
@@ -0,0 +1,30 @@
|
||||
# == Class: rally::deps
|
||||
#
|
||||
# Rally anchors and dependency management
|
||||
#
|
||||
class rally::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 { 'rally::install::begin': }
|
||||
-> Package<| tag == 'rally-package'|>
|
||||
~> anchor { 'rally::install::end': }
|
||||
-> anchor { 'rally::config::begin': }
|
||||
-> Rally_config<||>
|
||||
~> anchor { 'rally::config::end': }
|
||||
-> anchor { 'rally::db::begin': }
|
||||
-> anchor { 'rally::db::end': }
|
||||
~> anchor { 'rally::dbsync::begin': }
|
||||
-> anchor { 'rally::dbsync::end': }
|
||||
~> anchor { 'rally::service::begin': }
|
||||
~> Service<| tag == 'rally-service' |>
|
||||
~> anchor { 'rally::service::end': }
|
||||
|
||||
# Installation or config changes will always restart services.
|
||||
Anchor['rally::install::end'] ~> Anchor['rally::service::begin']
|
||||
Anchor['rally::config::end'] ~> Anchor['rally::service::begin']
|
||||
}
|
||||
@@ -33,6 +33,7 @@ class rally (
|
||||
$sync_db = true,
|
||||
) inherits ::rally::params {
|
||||
|
||||
include ::rally::deps
|
||||
include ::rally::db
|
||||
include ::rally::logging
|
||||
include ::rally::settings
|
||||
|
||||
@@ -113,6 +113,8 @@ class rally::logging(
|
||||
$log_date_format = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
oslo::log { 'rally_config':
|
||||
debug => $debug,
|
||||
use_syslog => $use_syslog,
|
||||
|
||||
@@ -32,6 +32,7 @@ class rally::settings (
|
||||
$openstack_client_http_timeout = undef,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
include ::rally::settings::cinder
|
||||
include ::rally::settings::ec2
|
||||
include ::rally::settings::glance
|
||||
|
||||
@@ -32,6 +32,9 @@ class rally::settings::cinder (
|
||||
$volume_delete_poll_interval = $::os_service_default,
|
||||
$volume_delete_timeout = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
rally_config {
|
||||
'benchmark/cinder_volume_create_poll_interval': value => $volume_create_poll_interval;
|
||||
'benchmark/cinder_volume_create_prepoll_delay': value => $volume_create_prepoll_delay;
|
||||
|
||||
@@ -22,6 +22,8 @@ class rally::settings::ec2 (
|
||||
$server_boot_timeout = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
rally_config {
|
||||
'benchmark/ec2_server_boot_poll_interval': value => $server_boot_poll_interval;
|
||||
'benchmark/ec2_server_boot_prepoll_delay': value => $server_boot_prepoll_delay;
|
||||
|
||||
@@ -33,6 +33,8 @@ class rally::settings::glance (
|
||||
$image_delete_timeout = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
rally_config {
|
||||
'benchmark/glance_image_create_poll_interval': value => $image_create_poll_interval;
|
||||
'benchmark/glance_image_create_prepoll_delay': value => $image_create_prepoll_delay;
|
||||
|
||||
@@ -128,6 +128,8 @@ class rally::settings::heat (
|
||||
$stack_user_role = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
rally_config {
|
||||
'benchmark/heat_stack_check_poll_interval': value => $stack_check_poll_interval;
|
||||
'benchmark/heat_stack_check_timeout': value => $stack_check_timeout;
|
||||
|
||||
@@ -12,6 +12,8 @@ class rally::settings::ironic (
|
||||
$node_create_poll_interval = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
rally_config {
|
||||
'benchmark/ironic_node_create_poll_interval': value => $node_create_poll_interval;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ class rally::settings::magnum (
|
||||
$magnum_cluster_create_poll_interval = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
rally_config {
|
||||
'benchmark/magnum_cluster_create_prepoll_delay': value => $magnum_cluster_create_prepoll_delay;
|
||||
'benchmark/magnum_cluster_create_timeout': value => $magnum_cluster_create_timeout;
|
||||
|
||||
@@ -32,6 +32,8 @@ class rally::settings::manila (
|
||||
$share_delete_timeout = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
rally_config {
|
||||
'benchmark/manila_share_create_poll_interval': value => $share_create_poll_interval;
|
||||
'benchmark/manila_share_create_prepoll_delay': value => $share_create_prepoll_delay;
|
||||
|
||||
@@ -12,6 +12,8 @@ class rally::settings::mistral (
|
||||
$mistral_execution_timeout = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
rally_config {
|
||||
'benchmark/mistral_execution_timeout': value => $mistral_execution_timeout;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ class rally::settings::monasca (
|
||||
$monasca_metric_create_prepoll_delay = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
rally_config {
|
||||
'benchmark/monasca_metric_create_prepoll_delay': value => $monasca_metric_create_prepoll_delay;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ class rally::settings::murano (
|
||||
$deploy_environment_timeout = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
rally_config {
|
||||
'benchmark/murano_deploy_environment_check_interval': value => $deploy_environment_check_interval;
|
||||
'benchmark/murano_deploy_environment_timeout': value => $deploy_environment_timeout;
|
||||
|
||||
@@ -342,6 +342,8 @@ class rally::settings::nova (
|
||||
$vm_ping_timeout = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
rally_config {
|
||||
'benchmark/nova_detach_volume_poll_interval': value => $detach_volume_poll_interval;
|
||||
'benchmark/nova_detach_volume_timeout': value => $detach_volume_timeout;
|
||||
|
||||
@@ -37,6 +37,8 @@ class rally::settings::sahara (
|
||||
$workers_per_proxy = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
rally_config {
|
||||
'benchmark/sahara_cluster_check_interval': value => $cluster_check_interval;
|
||||
'benchmark/sahara_cluster_create_timeout': value => $cluster_create_timeout;
|
||||
|
||||
@@ -17,6 +17,8 @@ class rally::settings::swift (
|
||||
$reseller_admin_role = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
rally_config {
|
||||
'role/swift_operator_role': value => $operator_role;
|
||||
'role/swift_reseller_admin_role': value => $reseller_admin_role;
|
||||
|
||||
@@ -63,6 +63,8 @@ class rally::settings::tempest (
|
||||
$heat_instance_type_ram = $::os_service_default
|
||||
) {
|
||||
|
||||
include ::rally::deps
|
||||
|
||||
rally_config {
|
||||
'tempest/img_url': value => $img_url;
|
||||
'tempest/img_disk_format': value => $img_disk_format;
|
||||
|
||||
@@ -12,7 +12,11 @@ describe 'rally::db::sync' do
|
||||
:refreshonly => 'true',
|
||||
:try_sleep => 5,
|
||||
:tries => 10,
|
||||
:logoutput => 'on_failure'
|
||||
:logoutput => 'on_failure',
|
||||
:subscribe => ['Anchor[rally::install::end]',
|
||||
'Anchor[rally::config::end]',
|
||||
'Anchor[rally::dbsync::begin]'],
|
||||
:notify => 'Anchor[rally::dbsync::end]',
|
||||
)
|
||||
end
|
||||
|
||||
@@ -31,7 +35,11 @@ describe 'rally::db::sync' do
|
||||
:refreshonly => 'true',
|
||||
:try_sleep => 5,
|
||||
:tries => 10,
|
||||
:logoutput => 'on_failure'
|
||||
:logoutput => 'on_failure',
|
||||
:subscribe => ['Anchor[rally::install::end]',
|
||||
'Anchor[rally::config::end]',
|
||||
'Anchor[rally::dbsync::begin]'],
|
||||
:notify => 'Anchor[rally::dbsync::end]',
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user