From a0fa1ce1d6fe8803274cff8a5ef05a0d67ab137c Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Thu, 22 Sep 2022 17:25:06 +0200 Subject: [PATCH] copr-be: ibm cloud - attempt to remove all volumes Even though it will fail most of the time. We keep cycling in the `cmd_list` termination loop all the time only because some of those volumes are some inconsistent state. It is just pity to not re-deliver the removal request (it could work, who knows). --- roles/copr/backend/templates/resalloc/ibm-cloud-vm.j2 | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/roles/copr/backend/templates/resalloc/ibm-cloud-vm.j2 b/roles/copr/backend/templates/resalloc/ibm-cloud-vm.j2 index 9a8d0fd284..e9c37f604f 100755 --- a/roles/copr/backend/templates/resalloc/ibm-cloud-vm.j2 +++ b/roles/copr/backend/templates/resalloc/ibm-cloud-vm.j2 @@ -263,20 +263,15 @@ def delete_instance_attempt(service, instance_name, opts): log.debug("Found volume %s %s %s", volume["name"], volume["status"], volume["id"]) - - # Otherwise Error: Delete volume failed. Volume can be deleted - # only when its status is available or failed., Code: 409 - if not volume["status"] in ["available", "failed"]: - continue - volume_ids.append(volume["id"]) if volume_ids: for volume_id in volume_ids: log.info("Deleting volume %s", volume_id) resp = service.delete_volume(volume_id) - assert resp.status_code == 204 - log.debug("Delete volume request delivered") + if resp.status_code != 204: + log.error("Can't delete volume %s, response status: %s", + volume_id, resp.status_code) def _get_arg_parser():