From 73bb3149fba6125fa99832af42fe1f873c9f461e Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Fri, 31 Jan 2020 19:04:16 +0100 Subject: [PATCH] Remove all the "container_cli rmi -f" from HA containers Back in the days we had added the rmi -f container calls in order to try and clean up any old unused container images whenever we updated any HA container. Nowadays this already happens via the tripleo_ansible/tripleo_podman/purge role which prunes any unused container image. There is no point in keeping this code around since we already purge images as a post upgrade/update task. We want to remove this code also because it fails horribly when we update the HA containers with an image that is based off the previously deployed image. In fact that fails with: TASK [Remove previous galera images] ******************************************* Friday 31 January 2020 10:34:40 +0000 (0:00:02.684) 0:02:56.021 ******** fatal: [database-0]: FAILED! => {"changed": true, "cmd": "podman rmi -f 209e952aa6cb3c212e57e5f81693eb4776c0c4b6cf96fb4faabdaa7403b2a94d", "delta": "0:00:00.110460", "end": "2020-01-31 10:34:40.772522", "msg": "non-zero return code", "rc": 2, "start": "2020-01-31 10:34:40.662062", "stderr": "Error: unable to delete \"209e952aa6cb3c212e57e5f81693eb4776c0c4b6cf96fb4faabdaa7403b2a94d\" (cannot be forced) - image has dependent child images", "stderr_lines": ["Error: unable to delete \"209e952aa6cb3c212e57e5f81693eb4776c0c4b6cf96fb4faabdaa7403b2a94d\" (cannot be forced) - image has dependent child images"], "stdout": "", "stdout_lines": []} This is particularly important because any hotfix container generated with tripleo-modify-image role will be affected by this issue. We tested this by doing the following: 1) Deploying an overcloud 2) Patching all HA containers with tripleo-modify-image 3) Running an update With this change the update did not fail any longer and the correct images were being used by pacemaker after the update process. Co-Authored-By: Sofer Athlan-Guyot Change-Id: I5346b32962b8cee5c64e4f07c0b68e2512085e83 Closes-Bug: #1861498 (cherry picked from commit 9a830255b73ec42edbdc8f7c417ebddc3ba364e4) --- .../cinder/cinder-backup-pacemaker-puppet.yaml | 13 ------------- .../cinder/cinder-volume-pacemaker-puppet.yaml | 13 ------------- deployment/database/mysql-pacemaker-puppet.yaml | 13 ------------- deployment/database/redis-pacemaker-puppet.yaml | 13 ------------- deployment/haproxy/haproxy-pacemaker-puppet.yaml | 13 ------------- .../manila/manila-share-pacemaker-puppet.yaml | 13 ------------- deployment/ovn/ovn-dbs-pacemaker-puppet.yaml | 13 ------------- .../rabbitmq-messaging-notify-pacemaker-puppet.yaml | 13 ------------- .../rabbitmq-messaging-pacemaker-puppet.yaml | 13 ------------- .../rabbitmq-messaging-rpc-pacemaker-puppet.yaml | 13 ------------- 10 files changed, 130 deletions(-) diff --git a/deployment/cinder/cinder-backup-pacemaker-puppet.yaml b/deployment/cinder/cinder-backup-pacemaker-puppet.yaml index 0dca083833..deb836319b 100644 --- a/deployment/cinder/cinder-backup-pacemaker-puppet.yaml +++ b/deployment/cinder/cinder-backup-pacemaker-puppet.yaml @@ -260,19 +260,6 @@ outputs: container_image_latest: "{{cinder_backup_image_latest}}" when: - old_cinder_backup_image_id.stdout != new_cinder_backup_image_id.stdout - - block: - - name: Get a list of containers using cinder_backup image - shell: "{{container_cli}} ps -a -q -f 'ancestor={{old_cinder_backup_image_id.stdout}}'" - register: cinder_backup_containers_to_destroy - # It will be recreated with the deploy step. - - name: Remove any containers using the same cinder_backup image - shell: "{{container_cli}} rm -fv {{item}}" - with_items: "{{ cinder_backup_containers_to_destroy.stdout_lines }}" - - name: Remove previous cinder_backup images - shell: "{{container_cli}} rmi -f {{old_cinder_backup_image_id.stdout}}" - when: - - old_cinder_backup_image_id.stdout != '' - - old_cinder_backup_image_id.stdout != new_cinder_backup_image_id.stdout upgrade_tasks: - name: Prepare switch of cinder_backup image name diff --git a/deployment/cinder/cinder-volume-pacemaker-puppet.yaml b/deployment/cinder/cinder-volume-pacemaker-puppet.yaml index f60448717d..2e3bad2661 100644 --- a/deployment/cinder/cinder-volume-pacemaker-puppet.yaml +++ b/deployment/cinder/cinder-volume-pacemaker-puppet.yaml @@ -246,19 +246,6 @@ outputs: container_image_latest: "{{cinder_volume_image_latest}}" when: - old_cinder_volume_image_id.stdout != new_cinder_volume_image_id.stdout - - block: - - name: Get a list of containers using cinder_volume image - shell: "{{container_cli}} ps -a -q -f 'ancestor={{old_cinder_volume_image_id.stdout}}'" - register: cinder_volume_containers_to_destroy - # It will be recreated with the delpoy step. - - name: Remove any containers using the same cinder_volume image - shell: "{{container_cli}} rm -fv {{item}}" - with_items: "{{ cinder_volume_containers_to_destroy.stdout_lines }}" - - name: Remove previous cinder_volume images - shell: "{{container_cli}} rmi -f {{old_cinder_volume_image_id.stdout}}" - when: - - old_cinder_volume_image_id.stdout != '' - - old_cinder_volume_image_id.stdout != new_cinder_volume_image_id.stdout upgrade_tasks: - name: Prepare switch of cinder_volume image name diff --git a/deployment/database/mysql-pacemaker-puppet.yaml b/deployment/database/mysql-pacemaker-puppet.yaml index 6fc7ecda1a..6528a52230 100644 --- a/deployment/database/mysql-pacemaker-puppet.yaml +++ b/deployment/database/mysql-pacemaker-puppet.yaml @@ -359,19 +359,6 @@ outputs: container_image_latest: "{{galera_image_latest}}" when: - old_galera_image_id.stdout != new_galera_image_id.stdout - - block: - - name: Get a list of container using galera image - shell: "{{container_cli}} ps -a -q -f 'ancestor={{old_galera_image_id.stdout}}'" - register: galera_containers_to_destroy - # It will be recreated with the delpoy step. - - name: Remove any container using the same galera image - shell: "{{container_cli}} rm -fv {{item}}" - with_items: "{{ galera_containers_to_destroy.stdout_lines }}" - - name: Remove previous galera images - shell: "{{container_cli}} rmi -f {{old_galera_image_id.stdout}}" - when: - - old_galera_image_id.stdout != '' - - old_galera_image_id.stdout != new_galera_image_id.stdout upgrade_tasks: - vars: diff --git a/deployment/database/redis-pacemaker-puppet.yaml b/deployment/database/redis-pacemaker-puppet.yaml index dc9f28a7e4..c292ecbf2b 100644 --- a/deployment/database/redis-pacemaker-puppet.yaml +++ b/deployment/database/redis-pacemaker-puppet.yaml @@ -338,19 +338,6 @@ outputs: container_image_latest: "{{redis_image_latest}}" when: - old_redis_image_id.stdout != new_redis_image_id.stdout - - block: - - name: Get a list of containers using redis image - shell: "{{container_cli}} ps -a -q -f 'ancestor={{old_redis_image_id.stdout}}'" - register: redis_containers_to_destroy - # It will be recreated with the delpoy step. - - name: Remove any containers using the same redis image - shell: "{{container_cli}} rm -fv {{item}}" - with_items: "{{ redis_containers_to_destroy.stdout_lines }}" - - name: Remove previous redis images - shell: "{{container_cli}} rmi -f {{old_redis_image_id.stdout}}" - when: - - old_redis_image_id.stdout != '' - - old_redis_image_id.stdout != new_redis_image_id.stdout upgrade_tasks: - name: Prepare switch of redis image name diff --git a/deployment/haproxy/haproxy-pacemaker-puppet.yaml b/deployment/haproxy/haproxy-pacemaker-puppet.yaml index 953c1bbfc6..344fc854cc 100644 --- a/deployment/haproxy/haproxy-pacemaker-puppet.yaml +++ b/deployment/haproxy/haproxy-pacemaker-puppet.yaml @@ -438,19 +438,6 @@ outputs: container_image_latest: "{{haproxy_image_latest}}" when: - old_haproxy_image_id.stdout != new_haproxy_image_id.stdout - - block: - - name: Get a list of container using haproxy image - shell: "{{container_cli}} ps -a -q -f 'ancestor={{old_haproxy_image_id.stdout}}'" - register: haproxy_containers_to_destroy - # It will be recreated with the delpoy step. - - name: Remove any container using the same haproxy image - shell: "{{container_cli}} rm -fv {{item}}" - with_items: "{{ haproxy_containers_to_destroy.stdout_lines }}" - - name: Remove previous haproxy images - shell: "{{container_cli}} rmi -f {{old_haproxy_image_id.stdout}}" - when: - - old_haproxy_image_id.stdout != '' - - old_haproxy_image_id.stdout != new_haproxy_image_id.stdout upgrade_tasks: - name: Prepare switch of haproxy image name diff --git a/deployment/manila/manila-share-pacemaker-puppet.yaml b/deployment/manila/manila-share-pacemaker-puppet.yaml index 3e8c8c1ed9..11b980e226 100644 --- a/deployment/manila/manila-share-pacemaker-puppet.yaml +++ b/deployment/manila/manila-share-pacemaker-puppet.yaml @@ -248,19 +248,6 @@ outputs: container_image_latest: "{{manila_share_image_latest}}" when: - old_manila_share_image_id.stdout != new_manila_share_image_id.stdout - - block: - - name: Get a list of containers using manila_share image - shell: "{{container_cli}} ps -a -q -f 'ancestor={{old_manila_share_image_id.stdout}}'" - register: manila_share_containers_to_destroy - # It will be recreated with the delpoy step. - - name: Remove any containers using the same manila_share image - shell: "{{container_cli}} rm -fv {{item}}" - with_items: "{{ manila_share_containers_to_destroy.stdout_lines }}" - - name: Remove previous manila_share images - shell: "{{container_cli}} rmi -f {{manila_share_image_id.stdout}}" - when: - - old_manila_share_image_id.stdout != '' - - old_manila_share_image_id.stdout != new_manila_share_image_id.stdout upgrade_tasks: - name: Prepare switch of manila_share image name diff --git a/deployment/ovn/ovn-dbs-pacemaker-puppet.yaml b/deployment/ovn/ovn-dbs-pacemaker-puppet.yaml index fad189f680..b2b29e2a1a 100644 --- a/deployment/ovn/ovn-dbs-pacemaker-puppet.yaml +++ b/deployment/ovn/ovn-dbs-pacemaker-puppet.yaml @@ -316,19 +316,6 @@ outputs: container_image_latest: "{{ovn_dbs_image_latest}}" when: - old_ovn_dbs_image_id.stdout != new_ovn_dbs_image_id.stdout - - block: - - name: Get a list of containers using ovn-dbs image - shell: "{{container_cli}} ps -a -q -f 'ancestor={{old_ovn_dbs_image_id.stdout}}'" - register: ovn_dbs_containers_to_destroy - # It will be recreated with the deploy step. - - name: Remove any containers using the same ovn-dbs image - shell: "{{container_cli}} rm -fv {{item}}" - with_items: "{{ ovn_dbs_containers_to_destroy.stdout_lines }}" - - name: Remove previous ovn-dbs images - shell: "{{container_cli}} rmi -f {{old_ovn_dbs_image_id.stdout}}" - when: - - old_ovn_dbs_image_id.stdout != '' - - old_ovn_dbs_image_id.stdout != new_ovn_dbs_image_id.stdout # We remove any leftover error and remove the ban. - name: Ensure the cluster converge back even in case of schema change shell: "pcs resource cleanup ovn-dbs-bundle" diff --git a/deployment/rabbitmq/rabbitmq-messaging-notify-pacemaker-puppet.yaml b/deployment/rabbitmq/rabbitmq-messaging-notify-pacemaker-puppet.yaml index d54cfabf22..cece8c3520 100644 --- a/deployment/rabbitmq/rabbitmq-messaging-notify-pacemaker-puppet.yaml +++ b/deployment/rabbitmq/rabbitmq-messaging-notify-pacemaker-puppet.yaml @@ -296,19 +296,6 @@ outputs: container_image_latest: "{{rabbitmq_image_latest}}" when: - old_rabbitmq_image_id.stdout != new_rabbitmq_image_id.stdout - - block: - - name: Get a list of container using rabbitmq image - shell: "{{container_cli}} ps -a -q -f 'ancestor={{old_rabbitmq_image_id.stdout}}'" - register: rabbitmq_containers_to_destroy - # It will be recreated with the delpoy step. - - name: Remove any container using the same rabbitmq image - shell: "{{container_cli}} rm -fv {{item}}" - with_items: "{{ rabbitmq_containers_to_destroy.stdout_lines }}" - - name: Remove previous rabbitmq images - shell: "{{container_cli}} rmi -f {{old_rabbitmq_image_id.stdout}}" - when: - - old_rabbitmq_image_id.stdout != '' - - old_rabbitmq_image_id.stdout != new_rabbitmq_image_id.stdout upgrade_tasks: - name: Prepare switch of rabbitmq image name diff --git a/deployment/rabbitmq/rabbitmq-messaging-pacemaker-puppet.yaml b/deployment/rabbitmq/rabbitmq-messaging-pacemaker-puppet.yaml index e5bdc06949..eb8d424e76 100644 --- a/deployment/rabbitmq/rabbitmq-messaging-pacemaker-puppet.yaml +++ b/deployment/rabbitmq/rabbitmq-messaging-pacemaker-puppet.yaml @@ -296,19 +296,6 @@ outputs: container_image_latest: "{{rabbitmq_image_latest}}" when: - old_rabbitmq_image_id.stdout != new_rabbitmq_image_id.stdout - - block: - - name: Get a list of container using rabbitmq image - shell: "{{container_cli}} ps -a -q -f 'ancestor={{old_rabbitmq_image_id.stdout}}'" - register: rabbitmq_containers_to_destroy - # It will be recreated with the delpoy step. - - name: Remove any container using the same rabbitmq image - shell: "{{container_cli}} rm -fv {{item}}" - with_items: "{{ rabbitmq_containers_to_destroy.stdout_lines }}" - - name: Remove previous rabbitmq images - shell: "{{container_cli}} rmi -f {{old_rabbitmq_image_id.stdout}}" - when: - - old_rabbitmq_image_id.stdout != '' - - old_rabbitmq_image_id.stdout != new_rabbitmq_image_id.stdout upgrade_tasks: - name: Prepare switch of rabbitmq image name diff --git a/deployment/rabbitmq/rabbitmq-messaging-rpc-pacemaker-puppet.yaml b/deployment/rabbitmq/rabbitmq-messaging-rpc-pacemaker-puppet.yaml index 5027687d42..8ee1c01b71 100644 --- a/deployment/rabbitmq/rabbitmq-messaging-rpc-pacemaker-puppet.yaml +++ b/deployment/rabbitmq/rabbitmq-messaging-rpc-pacemaker-puppet.yaml @@ -302,19 +302,6 @@ outputs: container_image_latest: "{{rabbitmq_image_latest}}" when: - old_rabbitmq_image_id.stdout != new_rabbitmq_image_id.stdout - - block: - - name: Get a list of container using rabbitmq image - shell: "{{container_cli}} ps -a -q -f 'ancestor={{old_rabbitmq_image_id.stdout}}'" - register: rabbitmq_containers_to_destroy - # It will be recreated with the delpoy step. - - name: Remove any container using the same rabbitmq image - shell: "{{container_cli}} rm -fv {{item}}" - with_items: "{{ rabbitmq_containers_to_destroy.stdout_lines }}" - - name: Remove previous rabbitmq images - shell: "{{container_cli}} rmi -f {{old_rabbitmq_image_id.stdout}}" - when: - - old_rabbitmq_image_id.stdout != '' - - old_rabbitmq_image_id.stdout != new_rabbitmq_image_id.stdout upgrade_tasks: - name: Prepare switch of rabbitmq image name