Refactor resource dependencies
This refactors resource dependencies to improve the following points. - Avoid unnecessary dependencies across services. For example aodh service does not require cinder db. - Restart only api service when config files like paste.ini, which are used only be api service is changed. Change-Id: Ib89091baaf9aba0809c2e9405389545168b755ec
This commit is contained in:
parent
eaa7e93aec
commit
3bf5d9ed3c
@ -98,6 +98,12 @@ class gnocchi::api (
|
||||
hasrestart => true,
|
||||
tag => ['gnocchi-service', 'gnocchi-db-sync-service'],
|
||||
}
|
||||
|
||||
# On any paste-api.ini config change, we must rstart Gnocchi API.
|
||||
Gnocchi_api_paste_ini<||> ~> Service['gnocchi-api']
|
||||
# On any uwsgi config change, we must restart Gnocchi API.
|
||||
Gnocchi_api_uwsgi_config<||> ~> Service['gnocchi-api']
|
||||
|
||||
} elsif $service_name == 'httpd' {
|
||||
service { 'gnocchi-api':
|
||||
ensure => 'stopped',
|
||||
@ -109,6 +115,10 @@ class gnocchi::api (
|
||||
|
||||
# we need to make sure gnocchi-api/eventlet is stopped before trying to start apache
|
||||
Service['gnocchi-api'] -> Service[$service_name]
|
||||
|
||||
# On any paste-api.ini config change, we must rstart Gnocchi API.
|
||||
Gnocchi_api_paste_ini<||> ~> Service[$service_name]
|
||||
|
||||
} else {
|
||||
fail("Invalid service_name. Either gnocchi/openstack-gnocchi-api for running as a \
|
||||
standalone service, or httpd for being run by a httpd server")
|
||||
|
@ -28,4 +28,8 @@ class gnocchi::db (
|
||||
gnocchi_config {
|
||||
'indexer/url': value => $database_connection, secret => true;
|
||||
}
|
||||
|
||||
# all db settings should be applied and all packages should be installed
|
||||
# before dbsync starts
|
||||
Oslo::Db['gnocchi_config'] -> Anchor['gnocchi::dbsync::begin']
|
||||
}
|
||||
|
@ -24,28 +24,13 @@ class gnocchi::deps {
|
||||
~> Service<| tag == 'gnocchi-service' |>
|
||||
~> anchor { 'gnocchi::service::end': }
|
||||
|
||||
# paste-api.ini config should occur in the config block also.
|
||||
Anchor['gnocchi::config::begin']
|
||||
-> Gnocchi_api_paste_ini<||>
|
||||
~> Anchor['gnocchi::config::end']
|
||||
|
||||
# all coordination settings should be applied and all packages should be
|
||||
# installed before service startup
|
||||
Oslo::Coordination<||> -> Anchor['gnocchi::service::begin']
|
||||
|
||||
# all db settings should be applied and all packages should be installed
|
||||
# before dbsync starts
|
||||
Oslo::Db<||> -> Anchor['gnocchi::dbsync::begin']
|
||||
|
||||
# policy config should occur in the config block also.
|
||||
Anchor['gnocchi::config::begin']
|
||||
-> Openstacklib::Policy<| tag == 'gnocchi' |>
|
||||
-> Anchor['gnocchi::config::end']
|
||||
|
||||
# On any uwsgi config change, we must restart gnocchi-api.
|
||||
Anchor['gnocchi::config::begin']
|
||||
-> Gnocchi_api_uwsgi_config<||>
|
||||
~> Anchor['gnocchi::config::end']
|
||||
-> Anchor['gnocchi::config::end']
|
||||
|
||||
# Installation or config changes will always restart services.
|
||||
Anchor['gnocchi::install::end'] ~> Anchor['gnocchi::service::begin']
|
||||
|
@ -42,4 +42,8 @@ class gnocchi (
|
||||
gnocchi_config {
|
||||
'DEFAULT/coordination_url' : value => $coordination_url, secret => true;
|
||||
}
|
||||
|
||||
# all coordination settings should be applied and all packages should be
|
||||
# installed before service startup
|
||||
Oslo::Coordination['gnocchi_config'] -> Anchor['gnocchi::service::begin']
|
||||
}
|
||||
|
@ -279,4 +279,6 @@ class gnocchi::keystone::authtoken(
|
||||
service_type => $service_type,
|
||||
interface => $interface;
|
||||
}
|
||||
|
||||
Keystone::Resource::Authtoken['gnocchi_config'] -> Anchor['gnocchi::config::end']
|
||||
}
|
||||
|
@ -65,11 +65,15 @@ class gnocchi::policy (
|
||||
file_group => $::gnocchi::params::group,
|
||||
file_format => 'yaml',
|
||||
purge_config => $purge_config,
|
||||
tag => 'gnocchi',
|
||||
}
|
||||
|
||||
create_resources('openstacklib::policy', { $policy_path => $policy_parameters })
|
||||
|
||||
# policy config should occur in the config block also.
|
||||
Anchor['gnocchi::config::begin']
|
||||
-> Openstacklib::Policy[$policy_path]
|
||||
-> Anchor['gnocchi::config::end']
|
||||
|
||||
oslo::policy { 'gnocchi_config':
|
||||
enforce_scope => $enforce_scope,
|
||||
enforce_new_defaults => $enforce_new_defaults,
|
||||
@ -77,5 +81,4 @@ class gnocchi::policy (
|
||||
policy_default_rule => $policy_default_rule,
|
||||
policy_dirs => $policy_dirs,
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ describe 'gnocchi::policy' do
|
||||
:file_group => 'gnocchi',
|
||||
:file_format => 'yaml',
|
||||
:purge_config => false,
|
||||
:tag => 'gnocchi',
|
||||
)
|
||||
is_expected.to contain_oslo__policy('gnocchi_config').with(
|
||||
:enforce_scope => false,
|
||||
@ -64,7 +63,6 @@ describe 'gnocchi::policy' do
|
||||
:file_group => 'gnocchi',
|
||||
:file_format => 'yaml',
|
||||
:purge_config => true,
|
||||
:tag => 'gnocchi',
|
||||
)
|
||||
is_expected.to contain_oslo__policy('gnocchi_config').with(
|
||||
:enforce_scope => false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user