From 6b93ecf0e1b64c9150a301a80e1ee74d090b1782 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 13 Mar 2024 00:29:19 +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. Also, guestagent.conf is not used by trove services but the overall file is loaded each time when trove launches an instance, so we don't have to restart trove services when guesagent.conf is updated. Change-Id: If3eb7e4d2e572735af67eb59f81f67af99527a92 --- manifests/api.pp | 4 ++++ manifests/db.pp | 4 ++++ manifests/deps.pp | 20 +++----------------- manifests/keystone/authtoken.pp | 2 ++ manifests/policy.pp | 6 ++++++ 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/manifests/api.pp b/manifests/api.pp index b5b5645c..7ff597fe 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -196,6 +196,9 @@ class trove::api( package_name => $::trove::params::api_package_name, service_name => $service_name, } + if $manage_service { + Trove_api_paste_ini<||> ~> Service['trove-api'] + } } elsif $service_name == 'httpd' { trove::generic_service { 'api': enabled => false, @@ -207,6 +210,7 @@ class trove::api( if $manage_service { Service<| title == 'httpd' |> { tag +> 'trove-service' } Service['trove-api'] -> Service[$service_name] + Trove_api_paste_ini<||> ~> Service['httpd'] } } else { fail("Invalid service_name. Either trove-api/openstack-trove-api for \ diff --git a/manifests/db.pp b/manifests/db.pp index d6c94ccf..b3e078f6 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -61,4 +61,8 @@ class trove::db ( pool_timeout => $database_pool_timeout, mysql_enable_ndb => $mysql_enable_ndb, } + + # all db settings should be applied and all packages should be installed + # before dbsync starts + Oslo::Db['trove_config'] -> Anchor['trove::dbsync::begin'] } diff --git a/manifests/deps.pp b/manifests/deps.pp index 244b54cd..9546b092 100644 --- a/manifests/deps.pp +++ b/manifests/deps.pp @@ -24,27 +24,13 @@ class trove::deps { ~> Service<| tag == 'trove-service' |> ~> anchor { 'trove::service::end': } - # Include all the other trove config pieces in the config block. - # Don't put them above because there's no chain between each individual part - # of the config. Anchor['trove::config::begin'] -> Trove_guestagent_config<||> - ~> Anchor['trove::config::end'] - - # Also include paste ini config in the config section - Anchor['trove::config::begin'] - -> Trove_api_paste_ini<||> - ~> Anchor['trove::config::end'] - - # policy config should occur in the config block also as soon as - # puppet-trove supports it. Leave commented out for now. - Anchor['trove::config::begin'] - -> Openstacklib::Policy<| tag == 'trove' |> -> Anchor['trove::config::end'] - # all db settings should be applied and all packages should be installed - # before dbsync starts - Oslo::Db<||> -> Anchor['trove::dbsync::begin'] + Anchor['trove::config::begin'] + -> Trove_api_paste_ini<||> + -> Anchor['trove::config::end'] # We need openstackclient installed before marking service end so that trove # will have clients available to create resources. This tag handles the diff --git a/manifests/keystone/authtoken.pp b/manifests/keystone/authtoken.pp index 835e6766..83c0be16 100644 --- a/manifests/keystone/authtoken.pp +++ b/manifests/keystone/authtoken.pp @@ -276,4 +276,6 @@ class trove::keystone::authtoken( service_type => $service_type, interface => $interface, } + + Keystone::Resource::Authtoken['trove_config'] -> Anchor['trove::config::end'] } diff --git a/manifests/policy.pp b/manifests/policy.pp index c21b1c6e..fdc1fc99 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -70,6 +70,12 @@ class trove::policy ( create_resources('openstacklib::policy', { $policy_path => $policy_parameters }) + # policy config should occur in the config block also as soon as + # puppet-trove supports it. Leave commented out for now. + Anchor['trove::config::begin'] + -> Openstacklib::Policy[$policy_path] + -> Anchor['trove::config::end'] + oslo::policy { 'trove_config': enforce_scope => $enforce_scope, enforce_new_defaults => $enforce_new_defaults,