aboutsummaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorOliver Walsh <owalsh@redhat.com>2017-09-22 12:06:43 +0100
committerOliver Walsh <owalsh@redhat.com>2017-11-10 09:25:59 +0000
commit3205096b741f5ebcfba4dc90476526cc1df14823 (patch)
treec2aae78c0566181807b575e986a27497c48ef27d /docker
parent4217767d8782abae02b11f553fc14daf7cd72916 (diff)
Update default cell_v2 cell when it already exists
nova-manage cell_v2 create_cell just uses a dumb string comparison to detect when a cell already exists. If there is a slight difference (e.g ordering of params in the db uri query string) it can result in duplicate cells. With this patch we should detect that the default cell already exists and update it to use the current transport_url/database_connection instead of attempting to create a new cell. Change-Id: If6a32e87b19cb0edf683144367701a115657ad0a Closes-bug: 1718912 (cherry picked from commit ebcaabcc5c5d2840128b3609c82c4a70a81ea0a0)
Diffstat (limited to 'docker')
-rw-r--r--docker/services/nova-api.yaml32
1 files changed, 22 insertions, 10 deletions
diff --git a/docker/services/nova-api.yaml b/docker/services/nova-api.yaml
index ee73f704..d4816ba4 100644
--- a/docker/services/nova-api.yaml
+++ b/docker/services/nova-api.yaml
@@ -165,6 +165,18 @@ outputs:
done
echo "(cellv2) Running host discovery..."
su nova -s /bin/bash -c "/usr/bin/nova-manage cell_v2 discover_hosts --verbose"
+ 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
docker_config:
# db sync runs before permissions set by kolla_config
step_2:
@@ -192,9 +204,6 @@ outputs:
- /var/log/containers/nova:/var/log/nova
- /var/log/containers/httpd/nova-api:/var/log/httpd
command: "/usr/bin/bootstrap_host_exec nova_api su nova -s /bin/bash -c '/usr/bin/nova-manage api_db sync'"
- # FIXME: we probably want to wait on the 'cell_v2 update' in order for this
- # to be capable of upgrading a baremetal setup. This is to ensure the name
- # of the cell is 'default'
nova_api_map_cell0:
start_order: 1
image: *nova_api_image
@@ -203,18 +212,21 @@ outputs:
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'"
- nova_api_create_default_cell:
+ nova_api_ensure_default_cell:
start_order: 2
image: *nova_api_image
net: host
detach: false
- volumes: *nova_api_bootstrap_volumes
- # NOTE: allowing the exit code 2 is a dirty way of making
- # this idempotent (if the resource already exists a conflict
- # is raised)
- exit_codes: [0,2]
+ volumes:
+ list_concat:
+ - *nova_api_bootstrap_volumes
+ -
+ - /var/lib/config-data/nova/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro
+ - /var/lib/config-data/nova/etc/nova/:/etc/nova/:ro
+ - /var/log/containers/nova:/var/log/nova
+ - /var/lib/docker-config-scripts/nova_api_ensure_default_cell.sh:/nova_api_ensure_default_cell.sh:ro
user: root
- command: "/usr/bin/bootstrap_host_exec nova_api su nova -s /bin/bash -c '/usr/bin/nova-manage cell_v2 create_cell --name=default'"
+ command: "/usr/bin/bootstrap_host_exec nova_api /nova_api_ensure_default_cell.sh"
nova_db_sync:
start_order: 3
image: *nova_api_image