]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
ceph-volume: retry when acquiring lock fails 36700/head
authorSébastien Han <seb@redhat.com>
Tue, 18 Aug 2020 13:41:31 +0000 (15:41 +0200)
committerSébastien Han <seb@redhat.com>
Mon, 31 Aug 2020 17:04:04 +0000 (19:04 +0200)
commita285cd08921f51ef1101950eb6b9addcdfbecc35
tree642a2aa1853706e4a83c3088a2a300899f60fc7d
parent63f74105c0fc2b0100765a088a46bde54840c6ae
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>
src/ceph-volume/ceph_volume/util/prepare.py