From 967d42b54378559d9e33d657a525176f06b40189 Mon Sep 17 00:00:00 2001 From: Lee Yarwood Date: Wed, 6 Feb 2019 11:13:32 +0000 Subject: [PATCH] placement: Add nova_api data extraction step during deployment This change adds an additional deployment step that will attempt to extract all Placement data from the nova_api database ahead of db syncs being preformed. For the time being this is a noop as there should be no data to move across. Eventually this will be used during upgrades and actually used to migrate data between the nova_api and placement database. Co-Authored-By: Martin Schuppert Change-Id: Ifaa1101d05b835529730002ef985990c6469a449 --- .../placement-api-container-puppet.yaml | 58 ++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/deployment/placement/placement-api-container-puppet.yaml b/deployment/placement/placement-api-container-puppet.yaml index 9cbd55fe4f..ee9cf10186 100644 --- a/deployment/placement/placement-api-container-puppet.yaml +++ b/deployment/placement/placement-api-container-puppet.yaml @@ -64,6 +64,10 @@ parameters: default: tag: openstack.placement path: /var/log/containers/httpd/placement_wsgi_error_ssl.log + NovaPassword: + description: The password for the nova service and db account + type: string + hidden: true conditions: placement_workers_zero: {equals : [{get_param: PlacementWorkers}, 0]} @@ -197,9 +201,53 @@ outputs: step_2: get_attr: [PlacementLogging, docker_config, step_2] step_3: + placement_api_db_extract_data_from_nova_api: + start_order: 0 + image: &placement_api_image {get_param: DockerPlacementImage} + net: host + detach: false + user: root + volumes: + list_concat: + - {get_attr: [ContainersCommon, volumes]} + - {get_attr: [PlacementLogging, volumes]} + - + - /var/lib/config-data/placement/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro + - /var/lib/config-data/placement/etc/placement/:/etc/placement/:ro + - /var/lib/config-data/nova/etc/nova/:/etc/nova/:ro + environment: + - PLACEMENT_USER=placement + - NOVA_API_USER=nova_api + - list_join: + - '=' + - - 'PLACEMENT_DB_HOST' + - {get_param: [EndpointMap, MysqlInternal, host_nobrackets]} + - list_join: + - '=' + - - 'PLACEMENT_PASS' + - {get_param: PlacementPassword} + - list_join: + - '=' + - - 'NOVA_API_DB_HOST' + - {get_param: [EndpointMap, MysqlInternal, host_nobrackets]} + - list_join: + - '=' + - - 'NOVA_API_PASS' + - {get_param: NovaPassword} + # NOTE(lyarwood): We can swallow return codes of 0, 3 and 4 as they + # suggest this is a fresh deployment with no data to extract. The + # current list of return codes provided by the migrate script is: + # 0: Success + # 1: Usage error + # 2: Configuration missing or incomplete + # 3: Migration already completed + # 4: No data to migrate from nova (new deployment) + # 5: Unable to connect to one or both databases + # 6: Unable to execute placement's CLI commands + command: "/usr/bin/bootstrap_host_exec placement su placement -s /bin/bash -c 'cd /tmp && /usr/share/placement/mysql-migrate-db.sh --migrate -; ret=$?; if [ $ret -ne 0 ] && [ $ret -ne 3 ] && [ $ret -ne 4 ]; then exit $ret; else exit 0; fi'" placement_api_db_sync: start_order: 1 - image: &placement_api_image {get_param: DockerPlacementImage} + image: *placement_api_image net: host detach: false user: root @@ -240,3 +288,11 @@ outputs: environment: - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS host_prep_tasks: {get_attr: [PlacementLogging, host_prep_tasks]} + upgrade_tasks: [] + post_upgrade_tasks: + - when: step|int == 1 + import_role: + name: tripleo-docker-rm + vars: + containers_to_rm: + - nova_placement