From 028ed43143235289b6ec925aeb78f4e3e85dcf7a Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 9 Oct 2020 16:36:58 +0900 Subject: [PATCH] Fix wrong notification between api service and httpd nova-api service should be stopped before httpd service is started, thus nova-api should notify httpd. Change-Id: Ibffb65269daaeca62554cfbecb536361ab70611a (cherry picked from commit 1f1428e01b81c773b772b850232f910a0fc18aad) --- lib/puppet/type/nova_aggregate.rb | 5 +++++ lib/puppet/type/nova_service.rb | 5 +++++ manifests/api.pp | 2 +- manifests/keystone/auth.pp | 3 +-- spec/classes/nova_keystone_auth_spec.rb | 15 +-------------- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/lib/puppet/type/nova_aggregate.rb b/lib/puppet/type/nova_aggregate.rb index c4099d134..1483858b8 100644 --- a/lib/puppet/type/nova_aggregate.rb +++ b/lib/puppet/type/nova_aggregate.rb @@ -53,6 +53,11 @@ Puppet::Type.newtype(:nova_aggregate) do ['auth_url', 'project_name', 'username', 'password'] end + # Require the nova-api service to be running + autorequire(:anchor) do + ['nova::service::end'] + end + newparam(:name, :namevar => true) do desc 'Name for the new aggregate' validate do |value| diff --git a/lib/puppet/type/nova_service.rb b/lib/puppet/type/nova_service.rb index a420f3df8..d84c5747e 100644 --- a/lib/puppet/type/nova_service.rb +++ b/lib/puppet/type/nova_service.rb @@ -40,6 +40,11 @@ Puppet::Type.newtype(:nova_service) do ensurable + # Require the nova-api service to be running + autorequire(:anchor) do + ['nova::service::end'] + end + newparam(:name, :namevar => true) do desc 'Name of host' validate do |value| diff --git a/manifests/api.pp b/manifests/api.pp index c26005957..4544cadcd 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -276,7 +276,7 @@ class nova::api( } Service <| title == 'httpd' |> { tag +> 'nova-service' } # make sure we start apache before nova-api to avoid binding issues - Service[$service_name] -> Service['nova-api'] + Service['nova-api'] -> Service[$service_name] } else { fail("Invalid service_name. Either nova-api/openstack-nova-api for running \ as a standalone service, or httpd for being run by a httpd server") diff --git a/manifests/keystone/auth.pp b/manifests/keystone/auth.pp index ccdfb187f..751d67f44 100644 --- a/manifests/keystone/auth.pp +++ b/manifests/keystone/auth.pp @@ -78,9 +78,8 @@ class nova::keystone::auth( include nova::deps - if $configure_endpoint { - Keystone_endpoint["${region}/${service_name}::compute"] ~> Service <| name == 'nova-api' |> + Keystone_endpoint["${region}/${service_name}::compute"] -> Anchor['nova::service::end'] } keystone::resource::service_identity { 'nova': diff --git a/spec/classes/nova_keystone_auth_spec.rb b/spec/classes/nova_keystone_auth_spec.rb index e284ea3c5..644e8d72b 100644 --- a/spec/classes/nova_keystone_auth_spec.rb +++ b/spec/classes/nova_keystone_auth_spec.rb @@ -166,7 +166,7 @@ describe 'nova::keystone::auth' do } end - it { should contain_keystone_endpoint('RegionOne/nova::compute').with_notify(platform_params[:nova_api_notify]) } + it { should contain_keystone_endpoint('RegionOne/nova::compute').with_before(['Anchor[nova::service::end]']) } end end @@ -178,19 +178,6 @@ describe 'nova::keystone::auth' do facts.merge!(OSDefaults.get_facts()) end - let (:platform_params) do - case facts[:osfamily] - when 'Debian' - { - :nova_api_notify => ['Service[nova-api]'], - } - when 'RedHat' - { - :nova_api_notify => [], - } - end - end - it_behaves_like 'nova::keystone::auth' end end