Skip to content

Commit

Permalink
Fix not waiting on virtual disk being deleted
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Cinkelj <[email protected]>
  • Loading branch information
justinc1 committed Sep 28, 2023
1 parent b6b7d81 commit c5f3f91
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/modules/virtual_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
from ansible.module_utils.basic import AnsibleModule
from typing import Tuple, Optional
import os
import time

from ..module_utils.typed_classes import (
TypedVirtualDiskToAnsible,
Expand Down Expand Up @@ -166,6 +167,14 @@ def ensure_absent(
else:
before = virtual_disk_obj.to_ansible()
task = virtual_disk_obj.send_delete_request(rest_client)
if task["taskTag"] == "":
# HyperCore does not return taskTag for deleted virtual disk,
# we get back "{'createdUUID': '', 'taskTag': ''}".
# CI jobs managed to issue GET before disk was relly deleted -
# see https://github.com/ScaleComputing/HyperCoreAnsibleCollection/actions/runs/6334360083/job/17229898281#step:8:173
# CI runner is on same physical host as tested VSNS hypercore - small latency.
# 1 sec delay is just a guess; I was not able to reproduce if hypercore was on same LAN.
time.sleep(1)
after = wait_task_and_get_updated(rest_client, module, task, must_exist=False)
return is_changed(before, after), after, dict(before=before, after=after)

Expand Down

0 comments on commit c5f3f91

Please sign in to comment.