Use templating for nova cell database_connection
Nova now allows use of templated urls in the database and mq connections which will allow static configuration elements to be applied to the urls read from the database per-node. This should be a simpler and less obscure method of configuring things like the per-node bind_address necessary for director's HA arrangement. This patch addresses the templated DB urls as part 1. Nova support added here: https://review.openstack.org/#/c/578163/ Related-Bug: 1808134 Co-Authored-By: Martin Schuppert <mschuppert@redhat.com> Change-Id: If30b4647bca210663a22fd653e752d4d57345bdd
This commit is contained in:
parent
834a3d8335
commit
7288062676
@ -62,11 +62,20 @@ parameters:
|
||||
description: The password for the nova service and db account
|
||||
type: string
|
||||
hidden: true
|
||||
MysqlIPv6:
|
||||
default: false
|
||||
description: Enable IPv6 in MySQL
|
||||
type: boolean
|
||||
|
||||
conditions:
|
||||
|
||||
internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
|
||||
|
||||
mysql_ipv6_use_ip_address:
|
||||
and:
|
||||
- {equals: [{get_param: MysqlIPv6}, true]}
|
||||
- {equals: [{get_param: EnableInternalTLS}, false]}
|
||||
|
||||
resources:
|
||||
|
||||
ContainersCommon:
|
||||
@ -195,16 +204,37 @@ outputs:
|
||||
|
||||
nova_api_ensure_default_cell.sh:
|
||||
mode: "0700"
|
||||
content: |
|
||||
#!/bin/bash
|
||||
DEFID=$(nova-manage cell_v2 list_cells | sed -e '1,3d' -e '$d' | awk -F ' *| *' '$2 == "default" {print $4}')
|
||||
if [ "$DEFID" ]; then
|
||||
echo "(cellv2) Updating default cell_v2 cell $DEFID"
|
||||
su nova -s /bin/bash -c "/usr/bin/nova-manage cell_v2 update_cell --cell_uuid $DEFID --name=default"
|
||||
else
|
||||
echo "(cellv2) Creating default cell_v2 cell"
|
||||
su nova -s /bin/bash -c "/usr/bin/nova-manage cell_v2 create_cell --name=default"
|
||||
fi
|
||||
content:
|
||||
str_replace:
|
||||
template: |
|
||||
#!/bin/bash
|
||||
DEFID=$(nova-manage cell_v2 list_cells | sed -e '1,3d' -e '$d' | awk -F ' *| *' '$2 == "default" {print $4}')
|
||||
if [ "$DEFID" ]; then
|
||||
echo "(cellv2) Updating default cell_v2 cell $DEFID"
|
||||
su nova -s /bin/bash -c "/usr/bin/nova-manage cell_v2 update_cell --cell_uuid $DEFID --name=default --database_connection='CELLDB'"
|
||||
else
|
||||
echo "(cellv2) Creating default cell_v2 cell"
|
||||
su nova -s /bin/bash -c "/usr/bin/nova-manage cell_v2 create_cell --name=default --database_connection='CELLDB'"
|
||||
fi
|
||||
params:
|
||||
CELLDB:
|
||||
list_join:
|
||||
- ''
|
||||
- - '{scheme}'
|
||||
- '://'
|
||||
- '{username}'
|
||||
- ':'
|
||||
- '{password}'
|
||||
- '@'
|
||||
-
|
||||
if:
|
||||
- mysql_ipv6_use_ip_address
|
||||
- '[{hostname}]'
|
||||
- '{hostname}'
|
||||
- '/'
|
||||
- 'nova'
|
||||
- '?'
|
||||
- '{query}'
|
||||
docker_config:
|
||||
step_2:
|
||||
get_attr: [NovaApiLogging, docker_config, step_2]
|
||||
@ -230,7 +260,28 @@ outputs:
|
||||
detach: false
|
||||
user: root
|
||||
volumes: *nova_api_bootstrap_volumes
|
||||
command: "/usr/bin/bootstrap_host_exec nova_api su nova -s /bin/bash -c '/usr/bin/nova-manage cell_v2 map_cell0'"
|
||||
command:
|
||||
str_replace:
|
||||
template: "/usr/bin/bootstrap_host_exec nova_api su nova -s /bin/bash -c '/usr/bin/nova-manage cell_v2 map_cell0 --database_connection=\"CELL0DB\"'"
|
||||
params:
|
||||
CELL0DB:
|
||||
list_join:
|
||||
- ''
|
||||
- - '{scheme}'
|
||||
- '://'
|
||||
- '{username}'
|
||||
- ':'
|
||||
- '{password}'
|
||||
- '@'
|
||||
-
|
||||
if:
|
||||
- mysql_ipv6_use_ip_address
|
||||
- '[{hostname}]'
|
||||
- '{hostname}'
|
||||
- '/'
|
||||
- 'nova_cell0'
|
||||
- '?'
|
||||
- '{query}'
|
||||
nova_api_ensure_default_cell:
|
||||
start_order: 2
|
||||
image: *nova_api_image
|
||||
@ -477,19 +528,50 @@ outputs:
|
||||
- name: Setup cell_v2 (map cell0)
|
||||
shell:
|
||||
str_replace:
|
||||
template: nova-manage cell_v2 map_cell0 --database_connection=CELL
|
||||
template: nova-manage cell_v2 map_cell0 --database_connection='CELL0DB'
|
||||
params:
|
||||
CELL:
|
||||
make_url:
|
||||
scheme: {get_param: [EndpointMap, MysqlInternal, protocol]}
|
||||
username: nova
|
||||
password: {get_param: NovaPassword}
|
||||
host: {get_param: [EndpointMap, MysqlInternal, host]}
|
||||
path: /nova_cell0
|
||||
CELL0DB:
|
||||
list_join:
|
||||
- ''
|
||||
- - '{scheme}'
|
||||
- '://'
|
||||
- '{username}'
|
||||
- ':'
|
||||
- '{password}'
|
||||
- '@'
|
||||
-
|
||||
if:
|
||||
- mysql_ipv6_use_ip_address
|
||||
- '[{hostname}]'
|
||||
- '{hostname}'
|
||||
- '/'
|
||||
- 'nova_cell0'
|
||||
- '?'
|
||||
- '{query}'
|
||||
- name: Setup cell_v2 (create default cell)
|
||||
# (owalsh) puppet-nova expects the cell name 'default'
|
||||
# (owalsh) pass the db uri explicitly to avoid https://bugs.launchpad.net/tripleo/+bug/1662344
|
||||
shell: nova-manage cell_v2 create_cell --name='default' --database_connection=$(hiera nova::database_connection)
|
||||
shell:
|
||||
str_replace:
|
||||
template: nova-manage cell_v2 create_cell --name='default' --database_connection='CELLDB'
|
||||
params:
|
||||
CELLDB:
|
||||
list_join:
|
||||
- ''
|
||||
- - '{scheme}'
|
||||
- '://'
|
||||
- '{username}'
|
||||
- ':'
|
||||
- '{password}'
|
||||
- '@'
|
||||
-
|
||||
if:
|
||||
- mysql_ipv6_use_ip_address
|
||||
- '[{hostname}]'
|
||||
- '{hostname}'
|
||||
- '/'
|
||||
- 'nova'
|
||||
- '?'
|
||||
- '{query}'
|
||||
register: nova_api_create_cell
|
||||
failed_when: nova_api_create_cell.rc not in [0,2]
|
||||
changed_when: nova_api_create_cell.rc == 0
|
||||
|
@ -0,0 +1,10 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Nova now allows use of templated urls in the database and mq
|
||||
connections which will allow static configuration elements to be
|
||||
applied to the urls read from the database per-node. This should
|
||||
be a simpler and less obscure method of configuring things like
|
||||
the per-node bind_address necessary for director's HA arrangement.
|
||||
This patch addresses the templated DB urls as part 1.
|
||||
Nova support added here - https://review.openstack.org/578163
|
@ -65,6 +65,7 @@
|
||||
- OS::TripleO::Services::MistralEventEngine
|
||||
- OS::TripleO::Services::MistralExecutor
|
||||
- OS::TripleO::Services::MySQL
|
||||
- OS::TripleO::Services::MySQLClient
|
||||
- OS::TripleO::Services::NeutronApi
|
||||
- OS::TripleO::Services::NeutronCorePlugin
|
||||
- OS::TripleO::Services::NeutronDhcpAgent
|
||||
|
@ -68,6 +68,7 @@
|
||||
- OS::TripleO::Services::MistralEventEngine
|
||||
- OS::TripleO::Services::MistralExecutor
|
||||
- OS::TripleO::Services::MySQL
|
||||
- OS::TripleO::Services::MySQLClient
|
||||
- OS::TripleO::Services::NeutronApi
|
||||
- OS::TripleO::Services::NeutronCorePlugin
|
||||
- OS::TripleO::Services::NeutronDhcpAgent
|
||||
|
Loading…
Reference in New Issue
Block a user