From be1fee4af6a5ed7ef4eff4ede26f5d3666132398 Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Fri, 1 May 2020 13:12:46 +0200 Subject: [PATCH] pcs commands on host: mysql This implements the creation of the haproxy bundle on the host. The testing protocol used is documented in the depends-on. The reason for adding a post_update task is that during a minor update the deployment tasks are not run during the node update procedure but only during the final converge. So we ran the role again there to make sure that any config change will trigger a restart during the minor update, so the disruption is only local to the single node being updated. If we did not do this a final converge could potentially trigger a global restart of HA bundles which would be quite disruptive. NB: in this case we keep the container init_bundle (renamed to wait_bundle) around just use it to wait for galera to be up. Depends-On: Iaa7e89f0d25221c2a6ef0b81eb88a6f496f01696 NB: We also merged Ic6c65e6849368185177aeaa31d50f52761225f62 in this review so that the ussuri upgrade job can pass (Make sure we noop the Mysql_ providers) Change-Id: Ie14819b66cecdb5a9cc6299b68a0cc70a7aa3370 Related-Bug: #1863442 (cherry picked from commit da3d5e80562f7aa3d0039d44a2fd0a2f4c093cf4) --- .../database/mysql-pacemaker-puppet.yaml | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/deployment/database/mysql-pacemaker-puppet.yaml b/deployment/database/mysql-pacemaker-puppet.yaml index 0c51196366..d41eb58cd4 100644 --- a/deployment/database/mysql-pacemaker-puppet.yaml +++ b/deployment/database/mysql-pacemaker-puppet.yaml @@ -262,7 +262,7 @@ outputs: - {get_param: MysqlRootPassword} - {get_param: [DefaultPasswords, mysql_root_password]} step_2: - mysql_init_bundle: + mysql_wait_bundle: start_order: 0 detach: false net: host @@ -272,8 +272,8 @@ outputs: list_concat: - - '/container_puppet_apply.sh' - '2' - - 'file,file_line,concat,augeas,pacemaker::resource::bundle,pacemaker::property,pacemaker::resource::ocf,pacemaker::constraint::order,pacemaker::constraint::colocation,galera_ready,mysql_database,mysql_grant,mysql_user' - - 'include tripleo::profile::base::pacemaker;include tripleo::profile::pacemaker::database::mysql_bundle' + - 'file,file_line,concat,augeas,galera_ready,mysql_database,mysql_grant,mysql_user' + - 'include tripleo::profile::pacemaker::database::mysql_bundle' - if: - puppet_debug_enabled - - '--debug' @@ -292,21 +292,6 @@ outputs: # NOTE: this should force this container to re-run on each # update (scale-out, etc.) TRIPLEO_DEPLOY_IDENTIFIER: {get_param: DeployIdentifier} - mysql_restart_bundle: - start_order: 1 - config_volume: mysql - detach: false - net: host - ipc: host - user: root - environment: - TRIPLEO_MINOR_UPDATE: '' - command: /var/lib/container-config-scripts/pacemaker_restart_bundle.sh mysql galera galera-bundle Master - image: {get_param: ContainerMysqlImage} - volumes: - list_concat: - - {get_attr: [ContainersCommon, pacemaker_restart_volumes]} - - - /var/lib/config-data/puppet-generated/mysql:/var/lib/kolla/config_files/src:ro host_prep_tasks: - name: create persistent directories file: @@ -328,6 +313,21 @@ outputs: vars: container_image: {get_param: ContainerMysqlImage} container_image_latest: *mysql_image_pcmklatest + - name: MySQL HA Wrappers Step + when: step|int == 2 + block: &mysql_puppet_bundle + - name: Mysql puppet bundle + import_role: + name: tripleo_ha_wrapper + vars: + tripleo_ha_wrapper_service_name: mysql + tripleo_ha_wrapper_resource_name: galera + tripleo_ha_wrapper_bundle_name: galera-bundle + tripleo_ha_wrapper_resource_state: Master + tripleo_ha_wrapper_puppet_config_volume: mysql + tripleo_ha_wrapper_puppet_execute: '["Mysql_datadir", "Mysql_user", "Mysql_database", "Mysql_grant", "Mysql_plugin"].each |String $val| { noop_resource($val) }; include ::tripleo::profile::base::pacemaker; include ::tripleo::profile::pacemaker::database::mysql_bundle' + tripleo_ha_wrapper_puppet_tags: 'pacemaker::resource::bundle,pacemaker::property,pacemaker::resource::ocf,pacemaker::constraint::order,pacemaker::constraint::colocation' + tripleo_ha_wrapper_puppet_debug: {get_param: ConfigDebug} update_tasks: - name: Tear-down non-HA mysql container @@ -386,6 +386,13 @@ outputs: when: - old_galera_image_id.stdout != new_galera_image_id.stdout + post_update_tasks: + - name: Mysql bundle post update + when: step|int == 1 + block: *mysql_puppet_bundle + vars: + tripleo_ha_wrapper_minor_update: true + upgrade_tasks: - name: Tear-down non-HA mysql container when: @@ -537,7 +544,7 @@ outputs: name: tripleo_container_rm vars: tripleo_containers_to_rm: - - mysql_init_bundle + - mysql_wait_bundle when: - mysql_short_node_names_upgraded | length > 1 - name: add the mysql short name to hiera data for the upgrade.