From 002eec951f336b07ef3a7f277e9c0fe6aae9a952 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Mon, 20 May 2019 10:17:32 +0100
Subject: [PATCH] nova: Fix DBNotAllowed during compute startup

backport: stein, rocky

During startup of nova-compute, we see the following error message:

Error gathering result from cell 00000000-0000-0000-0000-000000000000:
DBNotAllowed: nova-compute

This issue was observed in devstack [1], and fixed [2] by removing
database configuration from the compute service.

This change takes the same approach, removing DB config from nova.conf
in the nova-compute* containers.

[1] https://bugs.launchpad.net/devstack/+bug/1812398
[2] https://opendev.org/openstack/devstack/commit/82537871376afe98a286e1ba424cf192ae60869a

Change-Id: I18c99ff4213ce456868e64eab63a4257910b9b8e
Closes-Bug: #1829705
---
 ansible/roles/nova/templates/nova.conf.j2 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ansible/roles/nova/templates/nova.conf.j2 b/ansible/roles/nova/templates/nova.conf.j2
index e2a10b73bc..04b196b916 100644
--- a/ansible/roles/nova/templates/nova.conf.j2
+++ b/ansible/roles/nova/templates/nova.conf.j2
@@ -153,6 +153,7 @@ project_name = service
 username = {{ neutron_keystone_user }}
 password = {{ neutron_keystone_password }}
 
+{% if not service_name.startswith('nova-compute') %}
 [database]
 connection = mysql+pymysql://{{ nova_database_user }}:{{ nova_database_password }}@{{ nova_database_address }}/{{ nova_database_name }}
 max_pool_size = 50
@@ -162,6 +163,7 @@ max_retries = -1
 [api_database]
 connection = mysql+pymysql://{{ nova_api_database_user }}:{{ nova_api_database_password }}@{{ nova_api_database_address }}/{{ nova_api_database_name }}
 max_retries = -1
+{% endif %}
 
 [cache]
 backend = oslo_cache.memcache_pool
-- 
GitLab