Add retries to LVM logical volume activation

We are running into failures activating snapshots where the syslog shows
the output "thin: Unable to activate thin device while pool is suspended"
when attempting to use quickly after creation. This appears to be a race
where there are still internal things being done after the snapshot is
created.

This is a bit of a punt, but with local testing the thin pool state either
does not visibily change or transitions so fast that it is hard to capture
the state transition in the vgdisplay. Since we know this operations works
most of the time, it would seem we are just giving up before the pool gets
back into the right state to do this activation.

Rather than trying to get the thin pool state and parse the output of the
command, just adding retries to the operation that back off between each
attempt. Based on what we've seen with successful runs, this should allow
it to fail while the pool is in this transitional state and attempt again
later when hopefully things have settled.

Change-Id: I3e7037b3571665251db8dee2cf22cab1297106c9
Closes-bug: #1642111
This commit is contained in:
Sean McGinnis 2017-10-06 10:55:22 -05:00
parent f7148319aa
commit a2b7b8d74a
1 changed files with 1 additions and 0 deletions

View File

@ -653,6 +653,7 @@ class LVM(executor.Executor):
else:
LOG.debug("Volume %s has been deactivated.", name)
@utils.retry(putils.ProcessExecutionError, retries=5, backoff_rate=2)
def activate_lv(self, name, is_snapshot=False, permanent=False):
"""Ensure that logical volume/snapshot logical volume is activated.