Readd RBD lock detection and clearing on startup

This is still needed due to the nature of the locks and freeing them on
startup, and to preserve lock=fail behaviour on VM startup.

Also fixes the fencing lock flush to directly use the client library
outside of Celery. I don't like this hack but it seems prudent until we
move fencing to the workers as well.
This commit is contained in:
2023-11-10 01:28:41 -05:00
parent 2a9bc632fa
commit 83c4c6633d
3 changed files with 52 additions and 6 deletions

View File

@ -33,6 +33,8 @@ class TaskFailure(Exception):
def start(celery, msg, current=0, total=1):
logger = getLogger(__name__)
logger.info(f"Starting {current}/{total}: {msg}")
if celery is None:
return
celery.update_state(
state="RUNNING", meta={"current": current, "total": total, "status": msg}
)
@ -64,6 +66,8 @@ def log_err(celery, msg):
def update(celery, msg, current=1, total=2):
logger = getLogger(__name__)
logger.info(f"Task update {current}/{total}: {msg}")
if celery is None:
return
celery.update_state(
state="RUNNING", meta={"current": current, "total": total, "status": msg}
)
@ -73,6 +77,8 @@ def update(celery, msg, current=1, total=2):
def finish(celery, msg, current=2, total=2):
logger = getLogger(__name__)
logger.info(f"Task update {current}/{total}: Finishing up")
if celery is None:
return
celery.update_state(
state="RUNNING",
meta={"current": current, "total": total, "status": "Finishing up"},