Skip to content

Commit

Permalink
Fixes mirroring timeout issue
Browse files Browse the repository at this point in the history
Signed-off-by: uday kurundwade <[email protected]>
  • Loading branch information
uday kurundwade committed Oct 9, 2023
1 parent 8a34a1d commit d4af86f
Showing 1 changed file with 33 additions and 12 deletions.
45 changes: 33 additions & 12 deletions ocs_ci/ocs/resources/mcg.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,20 +799,41 @@ def _check_mirroring():
else:
results.append(False)

return all(results)

try:
for mirroring_is_complete in TimeoutSampler(timeout, 5, _check_mirroring):
if mirroring_is_complete:
return results

is_mirroring_complete = _check_mirroring()
current_percentage = (
is_mirroring_complete.count(True) / len(is_mirroring_complete)
) * 100
logger.info(f"{current_percentage}% mirroring is done.")
previous_percentage = 0
if current_percentage == 100:
logger.info("All objects mirrored successfully.")
return True
else:
while current_percentage < 100:
previous_percentage = current_percentage
for i in range(timeout):
is_mirroring_complete = _check_mirroring()
current_percentage = (
is_mirroring_complete.count(True) / len(is_mirroring_complete)
) * 100
if previous_percentage == current_percentage:
import time

time.sleep(3)
if i + 1 == timeout:
logger.error("The mirroring process is stuck.")
assert False
else:
break
is_mirroring_complete = _check_mirroring()
current_percentage = (
is_mirroring_complete.count(True) / len(is_mirroring_complete)
) * 100
if current_percentage == 100:
logger.info("All objects mirrored successfully.")
return True
else:
logger.info("Waiting for the mirroring process to finish...")
except TimeoutExpiredError:
logger.error(
"The mirroring process did not complete within the time limit."
)
assert False

def check_backingstore_state(self, backingstore_name, desired_state, timeout=600):
"""
Expand Down

0 comments on commit d4af86f

Please sign in to comment.