From f08ed8036b677ffffab11be320317e2167e84edd Mon Sep 17 00:00:00 2001 From: Alan Bishop Date: Fri, 16 Apr 2021 07:38:59 -0700 Subject: [PATCH] Support removing cinder-backup from pcmk control TripleO traditionally deploys the cinder-backup service to run A/P (active/passive) under pacemaker, but cinder itself supports running A/A. This patch adds deploy_steps_tasks to remove the service from pcmk control (essentially deleting the pcs resource) prior to deploying it as a regular containerized (non-pcmk) service. A new cinder-backup-active-active.yaml environment file helps the user clarify their intent. The legacy cinder-backup.yaml file continues to deploy the service under pacemaker (to preserve the default deployment behavior), but rather than encouraging users to edit the file to switch deployment modes (as a comment in the file used to advise), users can proactively deploy the A/A mode (or switch from A/P to A/A) by including the new environment file. Change-Id: Ic94025f51083da77f4ba6ee934ebcf32bcb9909f --- .../cinder-backup-container-puppet.yaml | 32 +++++++++++++++++++ environments/cinder-backup-active-active.yaml | 2 ++ environments/cinder-backup.yaml | 3 +- ...backup-active-active-2eb8f8cf612a7989.yaml | 8 +++++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 environments/cinder-backup-active-active.yaml create mode 100644 releasenotes/notes/cinder-backup-active-active-2eb8f8cf612a7989.yaml diff --git a/deployment/cinder/cinder-backup-container-puppet.yaml b/deployment/cinder/cinder-backup-container-puppet.yaml index 021c3c8898..8301c71c0f 100644 --- a/deployment/cinder/cinder-backup-container-puppet.yaml +++ b/deployment/cinder/cinder-backup-container-puppet.yaml @@ -215,6 +215,38 @@ outputs: name: virt_sandbox_use_netlink persistent: yes state: yes + deploy_steps_tasks: + - name: Clean up when switching cinder-backup from pcmk to active-active + when: + - step|int == 1 + become: true + block: + - name: Check if cinder-backup is running under pacemaker + command: "pcs status" + register: cinder_backup_pcs_status + check_mode: false + failed_when: false + changed_when: false + + - when: + - '"cinder-backup" in cinder_backup_pcs_status.stdout' + block: + - name: Remove the openstack-cinder-backup pcs resource + pacemaker_resource: + resource: openstack-cinder-backup + state: delete + run_once: true + + - name: Identify the cinder-backup pcmklatest container image + shell: "{{container_cli}} images | awk '$1 ~ \"cinder-backup\" && $2 == \"pcmklatest\" {print $1\":\"$2}'" + register: cinder_backup_pcmklatest_image + check_mode: false + changed_when: false + + - name: Remove the cinder-backup pcmklatest container image + command: "{{container_cli}} rmi {{cinder_backup_pcmklatest_image.stdout}}" + when: + - cinder_backup_pcmklatest_image.stdout|length > 0 external_upgrade_tasks: - when: - step|int == 1 diff --git a/environments/cinder-backup-active-active.yaml b/environments/cinder-backup-active-active.yaml new file mode 100644 index 0000000000..1829af7b2a --- /dev/null +++ b/environments/cinder-backup-active-active.yaml @@ -0,0 +1,2 @@ +resource_registry: + OS::TripleO::Services::CinderBackup: ../deployment/cinder/cinder-backup-container-puppet.yaml diff --git a/environments/cinder-backup.yaml b/environments/cinder-backup.yaml index d8ae01748b..ee144dca42 100644 --- a/environments/cinder-backup.yaml +++ b/environments/cinder-backup.yaml @@ -1,4 +1,3 @@ resource_registry: OS::TripleO::Services::CinderBackup: ../deployment/cinder/cinder-backup-pacemaker-puppet.yaml - # For non-pcmk managed implementation - # OS::TripleO::Services::CinderBackup: ../deployment/cinder/cinder-backup-container-puppet.yaml + # Use cinder-backup-active-active.yaml for non-pcmk managed implementation diff --git a/releasenotes/notes/cinder-backup-active-active-2eb8f8cf612a7989.yaml b/releasenotes/notes/cinder-backup-active-active-2eb8f8cf612a7989.yaml new file mode 100644 index 0000000000..c5fc6ad15a --- /dev/null +++ b/releasenotes/notes/cinder-backup-active-active-2eb8f8cf612a7989.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + The Cinder Backup service can be switched from running active/passive + under pacemaker, to active-active mode where it runs simultaneously on + every node on which it's deployed. Note that the service will be restarted + when switching modes, which will interrupt any backup operations currently + in progress.