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: I33f0123caa057169be0e7eee6c17d1d4d387f87f
This commit is contained in:
Takashi Kajinami 2024-03-04 09:53:05 +09:00
parent 2447fdad14
commit 6dc78a00e3
6 changed files with 29 additions and 20 deletions

View File

@ -117,6 +117,11 @@ class manila::api (
tag => 'manila-service',
}
# On any api-paste.ini config change, we must restart Manila API.
Manila_api_paste_ini<||> ~> Service['manila-api']
# On any uwsgi config change, we must restart Manila API.
Manila_api_uwsgi_config<||> ~> Service['manila-api']
} elsif $service_name == 'httpd' {
# We need to make sure manila-api/eventlet is stopped before trying to
# start apache
@ -129,6 +134,10 @@ class manila::api (
Service <| title == 'httpd' |> { tag +> 'manila-service' }
Service['manila-api'] -> Service[$service_name]
# On any api-paste.ini config change, we must restart Manila API.
Manila_api_paste_ini<||> ~> Service[$service_name]
} else {
fail("Invalid service_name. Either use manila-api/openstack-manila-api \
for running as a standalone service, or httpd for being run by a httpd \

View File

@ -17,4 +17,8 @@ class manila::coordination (
oslo::coordination{ 'manila_config':
backend_url => $backend_url
}
# all coordination settings should be applied and all packages should be
# installed before service startup
Oslo::Coordination['manila_config'] -> Anchor['manila::service::begin']
}

View File

@ -68,4 +68,8 @@ class manila::db (
mysql_enable_ndb => $mysql_enable_ndb,
db_max_retries => $database_db_max_retries,
}
# all db settings should be applied and all packages should be installed
# before dbsync starts
Oslo::Db['manila_config'] -> Anchor['manila::dbsync::begin']
}

View File

@ -24,34 +24,19 @@ class manila::deps {
~> Service<| tag == 'manila-service' |>
~> anchor { 'manila::service::end': }
# paste-api.ini config should occur in the config block also.
Anchor['manila::config::begin']
-> Manila_api_paste_ini<||>
~> Anchor['manila::config::end']
-> Anchor['manila::config::end']
Anchor['manila::config::begin']
-> Manila_api_uwsgi_config<||>
-> Anchor['manila::config::end']
# rootwrap config should occur in the config block also.
Anchor['manila::config::begin']
-> Manila_rootwrap_config<||>
~> Anchor['manila::config::end']
# all coordination settings should be applied and all packages should be
# installed before service startup
Oslo::Coordination<||> -> Anchor['manila::service::begin']
# all db settings should be applied and all packages should be installed
# before dbsync starts
Oslo::Db<||> -> Anchor['manila::dbsync::begin']
# policy config should occur in the config block also.
Anchor['manila::config::begin']
-> Openstacklib::Policy<| tag == 'manila' |>
-> Anchor['manila::config::end']
# On any uwsgi config change, we must restart Manila API.
Anchor['manila::config::begin']
-> Manila_api_uwsgi_config<||>
~> Anchor['manila::config::end']
# Support packages need to be installed in the install phase, but we don't
# put them in the chain above because we don't want any false dependencies
# between packages with the manila-package tag and the manila-support-package

View File

@ -279,4 +279,6 @@ class manila::keystone::authtoken(
service_type => $service_type,
interface => $interface;
}
Keystone::Resource::Authtoken['manila_config'] -> Anchor['manila::config::end']
}

View File

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