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: I6a4c65e81b97235d0ce8a142245927c92ab6e48d
This commit is contained in:
parent
0dcda53bb3
commit
8b3054a13f
|
@ -584,6 +584,12 @@ enabled_backends instead.')
|
||||||
hasrestart => true,
|
hasrestart => true,
|
||||||
tag => 'glance-service',
|
tag => 'glance-service',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# On any paste-api.ini config change, we must restart Glance API.
|
||||||
|
Glance_api_paste_ini<||> ~> Service['glance-api']
|
||||||
|
# On any uwsgi config change, we must restart Glance API.
|
||||||
|
Glance_api_uwsgi_config<||> ~> Service['glance-api']
|
||||||
|
|
||||||
} elsif $service_name == 'httpd' {
|
} elsif $service_name == 'httpd' {
|
||||||
service { 'glance-api':
|
service { 'glance-api':
|
||||||
ensure => 'stopped',
|
ensure => 'stopped',
|
||||||
|
@ -595,6 +601,10 @@ enabled_backends instead.')
|
||||||
|
|
||||||
# we need to make sure glance-api/eventlet is stopped before trying to start apache
|
# we need to make sure glance-api/eventlet is stopped before trying to start apache
|
||||||
Service['glance-api'] -> Service[$service_name]
|
Service['glance-api'] -> Service[$service_name]
|
||||||
|
|
||||||
|
# On any paste-api.ini config change, we must restart Glance API.
|
||||||
|
Glance_api_paste_ini<||> ~> Service['glance-api']
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fail("Invalid service_name. ${::glance::params::api_service_name} for \
|
fail("Invalid service_name. ${::glance::params::api_service_name} for \
|
||||||
running as a standalone service, or httpd for being run by a httpd server")
|
running as a standalone service, or httpd for being run by a httpd server")
|
||||||
|
|
|
@ -278,5 +278,7 @@ class glance::api::authtoken(
|
||||||
service_token_roles_required => $service_token_roles_required,
|
service_token_roles_required => $service_token_roles_required,
|
||||||
service_type => $service_type,
|
service_type => $service_type,
|
||||||
interface => $interface;
|
interface => $interface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Keystone::Resource::Authtoken['glance_api_config'] -> Anchor['glance::config::end']
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,4 +68,8 @@ class glance::api::db (
|
||||||
pool_timeout => $database_pool_timeout,
|
pool_timeout => $database_pool_timeout,
|
||||||
mysql_enable_ndb => $mysql_enable_ndb,
|
mysql_enable_ndb => $mysql_enable_ndb,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# all db settings should be applied and all packages should be installed
|
||||||
|
# before dbsync starts
|
||||||
|
Oslo::Db['glance_api_config'] -> Anchor['glance::dbsync::begin']
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,19 +24,13 @@ class glance::deps {
|
||||||
~> Service<| tag == 'glance-service' |>
|
~> Service<| tag == 'glance-service' |>
|
||||||
~> anchor { 'glance::service::end': }
|
~> anchor { 'glance::service::end': }
|
||||||
|
|
||||||
# all db settings should be applied and all packages should be installed
|
|
||||||
# before dbsync starts
|
|
||||||
Oslo::Db<||> -> Anchor['glance::dbsync::begin']
|
|
||||||
|
|
||||||
# policy config should occur in the config block also.
|
|
||||||
Anchor['glance::config::begin']
|
|
||||||
-> Openstacklib::Policy<| tag == 'glance' |>
|
|
||||||
-> Anchor['glance::config::end']
|
|
||||||
|
|
||||||
# On any uwsgi config change, we must restart Glance API.
|
|
||||||
Anchor['glance::config::begin']
|
Anchor['glance::config::begin']
|
||||||
-> Glance_api_uwsgi_config<||>
|
-> Glance_api_uwsgi_config<||>
|
||||||
~> Anchor['glance::config::end']
|
-> Anchor['glance::config::end']
|
||||||
|
|
||||||
|
Anchor['glance::config::begin']
|
||||||
|
-> Glance_api_paste_ini<||>
|
||||||
|
-> Anchor['glance::config::end']
|
||||||
|
|
||||||
# We need openstackclient before marking service end so that glance
|
# We need openstackclient before marking service end so that glance
|
||||||
# will have clients available to create resources. This tag handles the
|
# will have clients available to create resources. This tag handles the
|
||||||
|
@ -46,7 +40,6 @@ class glance::deps {
|
||||||
-> Anchor['glance::service::end']
|
-> Anchor['glance::service::end']
|
||||||
|
|
||||||
# All other inifile providers need to be processed in the config block
|
# All other inifile providers need to be processed in the config block
|
||||||
Anchor['glance::config::begin'] -> Glance_api_paste_ini<||> ~> Anchor['glance::config::end']
|
|
||||||
Anchor['glance::config::begin'] -> Glance_image_import_config<||> ~> Anchor['glance::config::end']
|
Anchor['glance::config::begin'] -> Glance_image_import_config<||> ~> Anchor['glance::config::end']
|
||||||
Anchor['glance::config::begin'] -> Glance_swift_config<||> ~> Anchor['glance::config::end']
|
Anchor['glance::config::begin'] -> Glance_swift_config<||> ~> Anchor['glance::config::end']
|
||||||
Anchor['glance::config::begin'] -> Glance_rootwrap_config<||> ~> Anchor['glance::config::end']
|
Anchor['glance::config::begin'] -> Glance_rootwrap_config<||> ~> Anchor['glance::config::end']
|
||||||
|
|
|
@ -70,6 +70,11 @@ class glance::policy (
|
||||||
|
|
||||||
create_resources('openstacklib::policy', { $policy_path => $policy_parameters })
|
create_resources('openstacklib::policy', { $policy_path => $policy_parameters })
|
||||||
|
|
||||||
|
# policy config should occur in the config block also.
|
||||||
|
Anchor['glance::config::begin']
|
||||||
|
-> Openstacklib::Policy[$policy_path]
|
||||||
|
-> Anchor['glance::config::end']
|
||||||
|
|
||||||
oslo::policy { 'glance_api_config':
|
oslo::policy { 'glance_api_config':
|
||||||
enforce_scope => $enforce_scope,
|
enforce_scope => $enforce_scope,
|
||||||
enforce_new_defaults => $enforce_new_defaults,
|
enforce_new_defaults => $enforce_new_defaults,
|
||||||
|
|
|
@ -33,7 +33,6 @@ describe 'glance::policy' do
|
||||||
:file_group => 'glance',
|
:file_group => 'glance',
|
||||||
:file_format => 'yaml',
|
:file_format => 'yaml',
|
||||||
:purge_config => false,
|
:purge_config => false,
|
||||||
:tag => 'glance',
|
|
||||||
)
|
)
|
||||||
is_expected.to contain_oslo__policy('glance_api_config').with(
|
is_expected.to contain_oslo__policy('glance_api_config').with(
|
||||||
:enforce_scope => false,
|
:enforce_scope => false,
|
||||||
|
@ -64,7 +63,6 @@ describe 'glance::policy' do
|
||||||
:file_group => 'glance',
|
:file_group => 'glance',
|
||||||
:file_format => 'yaml',
|
:file_format => 'yaml',
|
||||||
:purge_config => true,
|
:purge_config => true,
|
||||||
:tag => 'glance',
|
|
||||||
)
|
)
|
||||||
is_expected.to contain_oslo__policy('glance_api_config').with(
|
is_expected.to contain_oslo__policy('glance_api_config').with(
|
||||||
:enforce_scope => false,
|
:enforce_scope => false,
|
||||||
|
|
Loading…
Reference in New Issue