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 <sathlang@redhat.com>

Change-Id: I5346b32962b8cee5c64e4f07c0b68e2512085e83
Closes-Bug: #1861498
This commit is contained in:
Michele Baldessari 2020-01-31 19:04:16 +01:00
parent eb857079f5
commit 9a830255b7
10 changed files with 0 additions and 130 deletions

View File

@ -260,19 +260,6 @@ outputs:
container_image_latest: "{{cinder_backup_image_latest}}" container_image_latest: "{{cinder_backup_image_latest}}"
when: when:
- old_cinder_backup_image_id.stdout != new_cinder_backup_image_id.stdout - 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: upgrade_tasks:
- name: Prepare switch of cinder_backup image name - name: Prepare switch of cinder_backup image name

View File

@ -246,19 +246,6 @@ outputs:
container_image_latest: "{{cinder_volume_image_latest}}" container_image_latest: "{{cinder_volume_image_latest}}"
when: when:
- old_cinder_volume_image_id.stdout != new_cinder_volume_image_id.stdout - 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: upgrade_tasks:
- name: Prepare switch of cinder_volume image name - name: Prepare switch of cinder_volume image name

View File

@ -352,19 +352,6 @@ outputs:
container_image_latest: "{{galera_image_latest}}" container_image_latest: "{{galera_image_latest}}"
when: when:
- old_galera_image_id.stdout != new_galera_image_id.stdout - 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: upgrade_tasks:
- vars: - vars:

View File

@ -330,19 +330,6 @@ outputs:
container_image_latest: "{{redis_image_latest}}" container_image_latest: "{{redis_image_latest}}"
when: when:
- old_redis_image_id.stdout != new_redis_image_id.stdout - 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: upgrade_tasks:
- name: Prepare switch of redis image name - name: Prepare switch of redis image name

View File

@ -431,19 +431,6 @@ outputs:
container_image_latest: "{{haproxy_image_latest}}" container_image_latest: "{{haproxy_image_latest}}"
when: when:
- old_haproxy_image_id.stdout != new_haproxy_image_id.stdout - 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: upgrade_tasks:
- name: Prepare switch of haproxy image name - name: Prepare switch of haproxy image name

View File

@ -240,19 +240,6 @@ outputs:
container_image_latest: "{{manila_share_image_latest}}" container_image_latest: "{{manila_share_image_latest}}"
when: when:
- old_manila_share_image_id.stdout != new_manila_share_image_id.stdout - 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: upgrade_tasks:
- name: Prepare switch of manila_share image name - name: Prepare switch of manila_share image name

View File

@ -308,19 +308,6 @@ outputs:
container_image_latest: "{{ovn_dbs_image_latest}}" container_image_latest: "{{ovn_dbs_image_latest}}"
when: when:
- old_ovn_dbs_image_id.stdout != new_ovn_dbs_image_id.stdout - 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. # We remove any leftover error and remove the ban.
- name: Ensure the cluster converge back even in case of schema change - name: Ensure the cluster converge back even in case of schema change
shell: "pcs resource cleanup ovn-dbs-bundle" shell: "pcs resource cleanup ovn-dbs-bundle"

View File

@ -288,19 +288,6 @@ outputs:
container_image_latest: "{{rabbitmq_image_latest}}" container_image_latest: "{{rabbitmq_image_latest}}"
when: when:
- old_rabbitmq_image_id.stdout != new_rabbitmq_image_id.stdout - 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: upgrade_tasks:
- name: Prepare switch of rabbitmq image name - name: Prepare switch of rabbitmq image name

View File

@ -288,19 +288,6 @@ outputs:
container_image_latest: "{{rabbitmq_image_latest}}" container_image_latest: "{{rabbitmq_image_latest}}"
when: when:
- old_rabbitmq_image_id.stdout != new_rabbitmq_image_id.stdout - 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: upgrade_tasks:
- name: Prepare switch of rabbitmq image name - name: Prepare switch of rabbitmq image name

View File

@ -294,19 +294,6 @@ outputs:
container_image_latest: "{{rabbitmq_image_latest}}" container_image_latest: "{{rabbitmq_image_latest}}"
when: when:
- old_rabbitmq_image_id.stdout != new_rabbitmq_image_id.stdout - 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: upgrade_tasks:
- name: Prepare switch of rabbitmq image name - name: Prepare switch of rabbitmq image name