Revert "Update cell0 db connection, if required"

This reverts commit 81c4c23f70.

Reason for revert: https://bugs.launchpad.net/tripleo/+bug/1958580

Change-Id: I5e027e757ce0dcb9c086130cd8253c71558e216a
This commit is contained in:
Ronelle Landy 2022-01-20 22:09:55 +00:00
parent 9175f821cd
commit b9a3359181
1 changed files with 22 additions and 43 deletions

View File

@ -459,7 +459,28 @@ outputs:
config_files: *nova_api_db_sync
permissions: *nova_api_permissions
/var/lib/kolla/config_files/nova_api_map_cell0.json:
command: "/usr/bin/bootstrap_host_exec nova_api /nova_api_map_cell0.sh"
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}'
config_files: *nova_api_db_sync
permissions: *nova_api_permissions
/var/lib/kolla/config_files/nova_api_ensure_default_cell.json:
@ -532,47 +553,6 @@ outputs:
- '/'
- '?'
- '{query}'
nova_api_map_cell0.sh:
mode: "0700"
content:
str_replace:
template: |
#!/bin/bash
CLIST=$(su nova -s /bin/bash -c "nova-manage cell_v2 list_cells")
CELLID=$(printf "$CLIST" | sed -e '1,3d' -e '$d' | awk -F ' *| *' '$2 == "cell0" {print $4}')
CELLDBC=$(printf "$CLIST" | sed -e '1,3d' -e '$d' | awk -F ' *| *' '$2 == "cell0" {print $8}')
if [ "$CELLID" ]; then
if [ ! "$CELLDBC" = "CELL0DB" ]; then
# NOTE(bogdando): cached data must be updated w/ SIGHUP
# for all the scheduler, conductor, API service workers.
# For now that's achieved as the containers get recreated
echo "(cellv2) Updating cell0 cell_v2 cell $CELLID"
su nova -s /bin/bash -c "/usr/bin/nova-manage cell_v2 update_cell --cell_uuid $CELLID --name=cell0 --database_connection='CELL0DB'"
fi
else
echo "(cellv2) Creating cell0 cell_v2 cell"
su nova -s /bin/bash -c "/usr/bin/nova-manage cell_v2 map_cell0 --database_connection='CELL0DB'"
fi
# skip DB sync as the conductor container executes it later
params:
CELL0DB:
list_join:
- ''
- - '{scheme}'
- '://'
- '{username}'
- ':'
- '{password}'
- '@'
-
if:
- mysql_ipv6_use_ip_address
- '[{hostname}]'
- '{hostname}'
- '/'
- 'nova_cell0'
- '?'
- '{query}'
docker_config:
step_2:
get_attr: [NovaApiLogging, docker_config, step_2]
@ -604,7 +584,6 @@ outputs:
- {get_attr: [NovaApiLogging, volumes]}
- - /var/lib/kolla/config_files/nova_api_map_cell0.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/nova:/var/lib/kolla/config_files/src:ro
- /var/lib/container-config-scripts/nova_api_map_cell0.sh:/nova_api_map_cell0.sh:ro
environment:
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
nova_api_ensure_default_cell: