Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Merge "Revert "Update cell0 db connection, if required""
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Jan 22, 2022
2 parents df5ea48 + db63209 commit 61cef90
Showing 1 changed file with 22 additions and 43 deletions.
65 changes: 22 additions & 43 deletions deployment/nova/nova-api-container-puppet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,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:
Expand Down Expand Up @@ -525,47 +546,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]
Expand Down Expand Up @@ -597,7 +577,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:
Expand Down

0 comments on commit 61cef90

Please sign in to comment.