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: I85d05bd9679007f3d0def4d7d345f55d87d0d903
This commit is contained in:
Takashi Kajinami 2024-03-29 11:01:26 +09:00
parent 378ad7beb5
commit e9ec895f91
5 changed files with 22 additions and 8 deletions

View File

@ -138,6 +138,13 @@ class magnum::api(
hasstatus => true,
tag => 'magnum-service',
}
# On any paste config change, we must restart Magnum API.
Magnum_api_paste_ini<||> ~> Service['magnum-api']
# On any uwsgi config change, we must restart Magnum API.
Magnum_api_uwsgi_config<||> ~> Service['magnum-api']
} elsif $service_name == 'httpd' {
service { 'magnum-api':
ensure => 'stopped',
@ -148,6 +155,9 @@ class magnum::api(
}
Service['magnum-api'] -> Service[$service_name]
Service<| title == 'httpd' |> { tag +> 'magnum-service' }
# On any paste config change, we must restart Magnum API.
Magnum_api_paste_ini<||> ~> Service[$service_name]
}
}

View File

@ -69,4 +69,7 @@ class magnum::db (
db_max_retries => $database_db_max_retries,
}
# all db settings should be applied and all packages should be installed
# before dbsync starts
Oslo::Db['magnum_config'] -> Anchor['magnum::dbsync::begin']
}

View File

@ -24,19 +24,13 @@ class magnum::deps {
~> Service<| tag == 'magnum-service' |>
~> anchor { 'magnum::service::end': }
# all db settings should be applied and all packages should be installed
# before dbsync starts
Oslo::Db<||> -> Anchor['magnum::dbsync::begin']
# policy config should occur in the config block also.
Anchor['magnum::config::begin']
-> Openstacklib::Policy<| tag == 'magnum' |>
-> Magnum_api_paste_ini<||>
-> Anchor['magnum::config::end']
# On any uwsgi config change, we must restart Magnum API.
Anchor['magnum::config::begin']
-> Magnum_api_uwsgi_config<||>
~> Anchor['magnum::config::end']
-> Anchor['magnum::config::end']
# Installation or config changes will always restart services.
Anchor['magnum::install::end'] ~> Anchor['magnum::service::begin']

View File

@ -270,4 +270,6 @@ class magnum::keystone::authtoken(
service_type => $service_type,
interface => $interface,
}
Keystone::Resource::Authtoken['magnum_config'] -> Anchor['magnum::config::end']
}

View File

@ -70,6 +70,11 @@ class magnum::policy (
create_resources('openstacklib::policy', { $policy_path => $policy_parameters })
# policy config should occur in the config block also.
Anchor['magnum::config::begin']
-> Openstacklib::Policy[$policy_path]
-> Anchor['magnum::config::end']
oslo::policy { 'magnum_config':
enforce_scope => $enforce_scope,
enforce_new_defaults => $enforce_new_defaults,