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 by api service, is changed.

Change-Id: I517e2fb19cc74a08f31c463b70b89b70de2e790c
This commit is contained in:
Takashi Kajinami 2024-03-05 10:43:07 +09:00
parent 68cceacff2
commit cb2251e0fc
6 changed files with 27 additions and 17 deletions

View File

@ -243,4 +243,8 @@ class neutron::cache (
hashclient_retry_delay => $hashclient_retry_delay,
dead_timeout => $dead_timeout,
}
# all cache settings should be applied and all packages should be installed
# before service startup
Oslo::Cache['neutron_config'] -> Anchor['neutron::service::begin']
}

View File

@ -72,4 +72,7 @@ class neutron::db (
}
# all db settings should be applied and all packages should be installed
# before dbsync starts
Oslo::Db['neutron_config'] -> Anchor['neutron::dbsync::begin']
}

View File

@ -33,11 +33,12 @@ class neutron::deps {
File<| tag == 'neutron-config-file' |> -> File_line<| tag == 'neutron-file-line' |>
# All other inifile providers need to be processed in the config block
Anchor['neutron::config::begin'] -> Neutron_api_paste_ini<||> -> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_api_uwsgi_config<||> -> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_agent_linuxbridge<||> -> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_agent_macvtap<||> -> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_agent_ovs<||> -> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_agent_ovn<||> -> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_api_paste_ini<||> ~> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_bgpvpn_bagpipe_config<||> -> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_bgpvpn_service_config<||> ~> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_sfc_service_config<||> ~> Anchor['neutron::config::end']
@ -57,12 +58,6 @@ class neutron::deps {
Anchor['neutron::config::begin'] -> Neutron_rootwrap_config<||> ~> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Ovn_metadata_agent_config<||> -> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Ironic_neutron_agent_config<||> -> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_api_uwsgi_config<||> ~> Anchor['neutron::config::end']
# policy config should occur in the config block also.
Anchor['neutron::config::begin']
-> Openstacklib::Policy<| tag == 'neutron' |>
-> Anchor['neutron::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
@ -82,14 +77,6 @@ class neutron::deps {
-> Package<| tag == 'neutron-plugin-ml2-package'|>
~> Anchor['neutron::config::end']
# all cache settings should be applied and all packages should be installed
# before service startup
Oslo::Cache<||> -> Anchor['neutron::service::begin']
# all db settings should be applied and all packages should be installed
# before dbsync starts
Oslo::Db<||> -> Anchor['neutron::dbsync::begin']
# We need openstackclient before marking service end so that neutron
# will have clients available to create resources. This tag handles the
# openstackclient but indirectly since the client is not available in

View File

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

View File

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

View File

@ -398,8 +398,11 @@ the neutron::services::vpnaas class.")
hasrestart => true,
tag => ['neutron-service', 'neutron-server-eventlet'],
}
Neutron_api_paste_ini<||> ~> Service['neutron-server']
} elsif $service_name == 'httpd' {
fail('Use api_service_name and rpc_service_name to run api service by httpd')
} else {
warning('Support for arbitrary service name is deprecated')
# backward compatibility so operators can customize the service name.
@ -412,6 +415,7 @@ the neutron::services::vpnaas class.")
tag => ['neutron-service'],
}
}
} else {
if $::neutron::params::server_service {
# we need to make sure neutron-server is stopped before trying to
@ -429,9 +433,10 @@ the neutron::services::vpnaas class.")
if $api_service_name {
if $api_service_name == 'httpd' {
Service <| title == 'httpd' |> { tag +> 'neutron-service' }
Neutron_api_paste_ini<||> ~> Service[$api_service_name]
if $::neutron::params::server_service {
Service['neutron-server'] -> Service['httpd']
Service['neutron-server'] -> Service[$api_service_name]
}
if $::neutron::params::api_service_name {
@ -445,8 +450,9 @@ the neutron::services::vpnaas class.")
hasrestart => true,
tag => ['neutron-service'],
}
Service['neutron-api'] -> Service['httpd']
Service['neutron-api'] -> Service[$api_service_name]
}
} else {
service { 'neutron-api':
ensure => $service_ensure,
@ -457,6 +463,9 @@ the neutron::services::vpnaas class.")
tag => ['neutron-service', 'neutron-server-eventlet'],
}
Neutron_api_paste_ini<||> ~> Service['neutron-api']
Neutron_api_uwsgi_config<||> ~> Service['neutron-api']
if $::neutron::params::server_service {
Service['neutron-server'] -> Service['neutron-api']
}