]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
ceph-volume: retry when acquiring lock fails 36925/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:17:03 +0000 (15:17 +0200)
commitc040cefa25bbb155bae69ae854e683df1c97e002
treef286487af902ccb725073b7043a756afb4b6ac56
parentd2c0087509fbc6d51d305426be93ad7c5b765f9c
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