Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait for 10 minutes before the 5th sr-destroy attempt #172

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lib/sr.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import time

import lib.commands as commands

Expand Down Expand Up @@ -95,7 +96,17 @@ def destroy(self, verify=False, force=False):
else:
logging.info("SR destroy failed due to SR not empty but there aren't any managed VDIs left.")
if i < max_tries:
logging.info(f"Retrying sr-destroy in case it failed due to incomplete GC.")
if i == max_tries - 1:
# We tried already 4 times to destroy the SR, and there still are hidden VDIs that
# couldn't be force-GCed. In this case, we likely need to give time to the normal GC
# to run, which might also coalesce some VDIs if that's what it really needs.
# The GC should kick approximately 5 minutes after the last operation we did, so let's
# give it these 5 minutes plus extra time to complete.
gc_delay = 600
logging.warning(f"SR destroy failed {i} times in a row. "
f"Wait for {gc_delay}s, hoping GC fully runs before next try")
time.sleep(gc_delay)
logging.info("Retrying sr-destroy in case it previously failed due to incomplete GC.")
continue
else:
raise Exception(f"Could not destroy the SR even after {i} attempts.")
Expand Down
Loading