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
This commit is contained in:
Takashi Kajinami 2024-03-04 10:05:53 +09:00
parent ca43069521
commit c23ad97125
5 changed files with 21 additions and 11 deletions

View File

@ -187,6 +187,12 @@ Use the enabled_provider_drivers parameter instead.')
hasrestart => true,
tag => 'octavia-service',
}
# On any api-paste.ini config change, we must restart Octavia API.
Octavia_api_paste_ini<||> ~> Service['octavia-api']
# 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',
@ -196,6 +202,10 @@ Use the enabled_provider_drivers parameter instead.')
}
Service['octavia-api'] -> Service[$service_name]
Service<| title == 'httpd' |> { tag +> 'octavia-service' }
# On any api-paste.ini config change, we must restart Octavia API.
Octavia_api_paste_ini<||> ~> Service['octavia-api']
} else {
fail("Invalid service_name. Either octavia-api/openstack-octavia-api for \
running as a standalone service, or httpd for being run by a httpd server")

View File

@ -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']
}

View File

@ -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']

View File

@ -279,5 +279,7 @@ class octavia::keystone::authtoken(
service_type => $service_type,
interface => $interface;
}
Keystone::Resource::Authtoken['octavia_config'] -> Anchor['octavia::config::end']
}

View File

@ -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,