]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
ceph-volume: retry when acquiring lock fails 36926/head
authorSébastien Han <seb@redhat.com>
Tue, 18 Aug 2020 13:41:31 +0000 (15:41 +0200)
committerSébastien Han <seb@redhat.com>
Tue, 1 Sep 2020 13:21:31 +0000 (15:21 +0200)
commit3f9d90d58fc92c6ee466ef663230177b37ee53e2
tree73690a263010e1457a80bd732013e592875e8bb2
parentaf0268dc910f84b47655e83a83ca54b6fb92dbaf
ceph-volume: retry when acquiring lock fails

When preaparing the osd device with --mkfs, the ceph-osd binary tries to
acquire an exclusive lock on the device (soon to become an OSD).
Unfortunately, when running in containers, we have seen cases where
there is a race between ceph-osd and systemd-udevd to acquire a lock on
the device. Sometimes systemd-udevd gets the lock and releases it soon
so that the ceph-osd gets sometimes the lock is still held and because
ceph-osd uses LOCK_NB the command fails.

This commit retries if the lock cannot be acquired, up to 5 times for 5
seconds, this should be more than enough to acquire the lock and
proceed with the OSD mkfs.

Unfortunately, this is so transient that we cannot lock earlier from c-v,
this won't do anything.

Fixes: https://tracker.ceph.com/issues/47010
Signed-off-by: Sébastien Han <seb@redhat.com>
(cherry picked from commit a285cd08921f51ef1101950eb6b9addcdfbecc35)
src/ceph-volume/ceph_volume/util/prepare.py