From 45850442d713618f5e16aab534dc80b94540eb15 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Wed, 9 Oct 2019 14:43:16 -0400 Subject: [PATCH] [SQUASH] backport tripleo-container-manage to stable/train This is a squash to facilitate the backport of tripleo-container-manage feature into stable/train. Depends-On: https://review.opendev.org/701849 Add experimental support to deploy containers without Paunch This is experimental and therefore not stable. Only enable it for testing purpose or if you know what you're doing. To disable Paunch and use 100% Ansible to manage the containers, just set that paramter into your environment: EnablePaunch: false Story: 2006732 Task: 37165 Change-Id: I19386ec20aa060f52174588266b4fe82b83ed697 (cherry picked from commit f157e1afb1312700ed484bc985ad2e35602c01cb) container-manage: use new variables use the new variables for the container-manage role, so it gets the proper configuration later when running the tasks. Change-Id: Ia9c3f8fbc4c55a998b8b3d60b0b0f61f174fc89b (cherry picked from commit ed85ec8849e667af4c82cd49e7a2c8d08a5b0727) container without paunch: set tripleo_container_manage_systemd_order tripleo_container_manage_systemd_order is needed to have proper dependencies when a host is started or stopped, so containers managed by systemd and tripleo-ansible will stop before pacemaker and start after pacemaker. Change-Id: Iab87530e2c0c3952bf46022cf5bee5ad337c78f8 (cherry picked from commit 0171d11c64f40c51a2828c4d754a1785203453d9) deploy-steps-tasks/containers: set concurrency to 2 After some testing, it seems like podman run/exec/create commands can be run at the same time and decrease the deployment time when 2 commands (maximum) at the same time are run. Example of benchmark done for an Undercloud deployment in my local environment: - With Paunch enabled: 26 min - With Paunch disabled and concurrency set to 1: 32 min - With Paunch disabled and concurrency set to 2: 29 min - With Paunch disabled and concurrency set to 3: 33 min (Above 4, results are worse). Change-Id: Ie7fc754046611a339c743141fe28f801f4e4b331 (cherry picked from commit fa99329115aa1acf851586e92a8b7e87ba09df6f) --- common/deploy-steps-tasks.yaml | 100 ++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 39 deletions(-) diff --git a/common/deploy-steps-tasks.yaml b/common/deploy-steps-tasks.yaml index 3bf1b8cc16..344e059b4c 100644 --- a/common/deploy-steps-tasks.yaml +++ b/common/deploy-steps-tasks.yaml @@ -207,51 +207,73 @@ tags: - container_config - ################################################## - # Per step starting of the containers using paunch - ################################################## + ##################################### + # Per step starting of the containers + ##################################### # Note container-puppet.py generates the hashed-*.json file, which is a copy of # the *step_n.json with a hash of the generated external config added # This acts as a salt to enable restarting the container if config changes - - name: Start containers for step {{ step }} using paunch - async: 3600 - poll: 0 + - name: Per step starting of the containers using Paunch + when: enable_paunch|default(true) + block: + - name: Start containers for step {{ step }} using paunch + async: 3600 + poll: 0 + environment: + TRIPLEO_MINOR_UPDATE: '{{ tripleo_minor_update | default(false) }}' + paunch: + config: "/var/lib/tripleo-config/container-startup-config/step_{{ step }}" + config_id: "tripleo_step{{ step }}" + action: apply + container_cli: "{{ container_cli }}" + container_log_stdout_path: "{{ container_log_stdout_path }}" + healthcheck_disabled: "{{ container_healthcheck_disabled | bool }}" + managed_by: "tripleo-{{ tripleo_role_name }}" + debug: "{{ enable_debug | bool }}" + register: outputs + register: start_containers_async_result + tags: + - container_startup_configs + + - name: Wait for containers to start for step {{ step }} using paunch + async_status: + jid: "{{ start_containers_async_result.ansible_job_id }}" + register: start_containers_outputs + until: start_containers_outputs.finished + retries: 1200 + delay: 3 + tags: + - container_startup_configs + + - name: "Debug output for task: Start containers for step {{ step }}" + debug: + var: start_containers_outputs.stdout_lines | default([]) | union(start_containers_outputs.stderr_lines | default([])) + when: start_containers_outputs.rc is defined + failed_when: start_containers_outputs.rc != 0 + tags: + - container_startup_configs + + # This is experimental, do not use for production now + - name: Per step starting of the containers using tripleo-ansible + when: not enable_paunch|default(true) environment: TRIPLEO_MINOR_UPDATE: '{{ tripleo_minor_update | default(false) }}' - paunch: - config: "/var/lib/tripleo-config/container-startup-config/step_{{ step }}" - config_id: "tripleo_step{{ step }}" - action: apply - container_cli: "{{ container_cli }}" - container_log_stdout_path: "{{ container_log_stdout_path }}" - healthcheck_disabled: "{{ container_healthcheck_disabled | bool }}" - managed_by: "tripleo-{{ tripleo_role_name }}" - debug: "{{ enable_debug | bool }}" - register: outputs - failed_when: false - when: enable_paunch|default(true) - register: start_containers_async_result - tags: - - container_startup_configs - - - name: Wait for containers to start for step {{ step }} using paunch - async_status: - jid: "{{ start_containers_async_result.ansible_job_id }}" - register: start_containers_outputs - until: start_containers_outputs.finished - retries: 1200 - delay: 3 - tags: - - container_startup_configs - - - name: "Debug output for task: Start containers for step {{ step }}" - debug: - var: start_containers_outputs.stdout_lines | default([]) | union(start_containers_outputs.stderr_lines | default([])) - when: start_containers_outputs.rc is defined - failed_when: start_containers_outputs.rc != 0 - tags: - - container_startup_configs + block: + - name: "Manage containers for step {{ step }} with tripleo-ansible" + include_role: + name: tripleo-container-manage + vars: + tripleo_container_manage_concurrency: 2 + tripleo_container_manage_systemd_order: true + tripleo_container_manage_cli: "{{ container_cli }}" + tripleo_container_manage_config: "/var/lib/tripleo-config/container-startup-config/step_{{ step }}" + tripleo_container_manage_config_id: "tripleo_step{{ step }}" + tripleo_container_manage_debug: "{{ enable_debug | bool }}" + tripleo_container_manage_healthcheck_disabled: "{{ container_healthcheck_disabled | bool }}" + tripleo_container_manage_log_path: "{{ container_log_stdout_path }}" + tags: + - container_startup_configs ######################################################## # Bootstrap tasks - run any tasks that have been defined