From 9f4d1d61327bf87963edf3c637c65e1920fa9421 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 4 Mar 2024 10:05:53 +0900 Subject: [PATCH] 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: Ibb4ec743e772716153eefe07ac36b888c0fb2b84 --- manifests/api.pp | 4 ++++ manifests/db.pp | 3 +++ manifests/deps.pp | 12 +----------- manifests/keystone/authtoken.pp | 2 ++ manifests/policy.pp | 5 +++++ 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/manifests/api.pp b/manifests/api.pp index a8a2af02..6d136af7 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -187,6 +187,10 @@ Use the enabled_provider_drivers parameter instead.') hasrestart => true, tag => 'octavia-service', } + + # On any uwsgi config change, we must restart Octavia API. + Octavia_api_uwsgi_config<||> ~> Service['octavia-api'] + } elsif $service_name == 'httpd' { service { 'octavia-api': ensure => 'stopped', diff --git a/manifests/db.pp b/manifests/db.pp index 0c6bc3ee..141c1518 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -69,4 +69,7 @@ class octavia::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['octavia_config'] -> Anchor['octavia::dbsync::begin'] } diff --git a/manifests/deps.pp b/manifests/deps.pp index d1d5a522..b15b3bd2 100644 --- a/manifests/deps.pp +++ b/manifests/deps.pp @@ -27,19 +27,9 @@ class octavia::deps { ~> Service<| tag == 'octavia-service' |> ~> anchor { 'octavia::service::end': } - # policy config should occur in the config block also. - Anchor['octavia::config::begin'] - -> Openstacklib::Policy<| tag == 'octavia' |> - -> Anchor['octavia::config::end'] - - # On any uwsgi config change, we must restart Octavia API. Anchor['octavia::config::begin'] -> Octavia_api_uwsgi_config<||> - ~> Anchor['octavia::config::end'] - - # all db settings should be applied and all packages should be installed - # before dbsync starts - Oslo::Db<||> -> Anchor['octavia::dbsync::begin'] + -> Anchor['octavia::config::end'] # Installation or config changes will always restart services. Anchor['octavia::install::end'] ~> Anchor['octavia::service::begin'] diff --git a/manifests/keystone/authtoken.pp b/manifests/keystone/authtoken.pp index 01243c23..7bd95fae 100644 --- a/manifests/keystone/authtoken.pp +++ b/manifests/keystone/authtoken.pp @@ -279,5 +279,7 @@ class octavia::keystone::authtoken( service_type => $service_type, interface => $interface; } + + Keystone::Resource::Authtoken['octavia_config'] -> Anchor['octavia::config::end'] } diff --git a/manifests/policy.pp b/manifests/policy.pp index a2893155..20ed026a 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -70,6 +70,11 @@ class octavia::policy ( create_resources('openstacklib::policy', { $policy_path => $policy_parameters }) + # policy config should occur in the config block also. + Anchor['octavia::config::begin'] + -> Openstacklib::Policy[$policy_path] + -> Anchor['octavia::config::end'] + oslo::policy { 'octavia_config': enforce_scope => $enforce_scope, enforce_new_defaults => $enforce_new_defaults,