]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
ceph-disk: get_partition_dev() should fail until get_dev_path(partname) is populated 21415/head
authorErwan Velu <erwan@redhat.com>
Fri, 13 Apr 2018 10:32:22 +0000 (12:32 +0200)
committerErwan Velu <erwan@redhat.com>
Wed, 9 May 2018 14:33:51 +0000 (16:33 +0200)
commitd501c7b33a6418c525cde62dedb8348d718ff2b4
tree1fccc6b2a0a0e9f10499bb0a7d10b63d900f5067
parent84aaeb3c5e46e347f53774132ba1435abfefdfee
ceph-disk: get_partition_dev() should fail until get_dev_path(partname) is populated

get_partition_dev() is a function called to get a block device path.

The @retry decorator implements a timeout mecanism as it exist a race
between the partition creation command and the actual presence of the
partition.

This function have a semantic issue.
The function is asked if /dev/sda6 exists but check if /sys/block/sda/sda6 exists.
Once /sys/block/sda/sda6 is populated within the timeout, the function returns "/dev/sda6".
But this doesn't check if "/dev/sda6" really exists, so a function
using this value fall into a race condition and fails too.

We do have this case inside the CI where timing are very variable
regarding the workload and VM's performance and even sometimes nasted VMs.

This patch offer to double-check before returning that the actual /dev/
entry actually exist once the BLOCKDIR (/sys) is populated. If not, the
@retry is triggered to let some time resolution this temporary situation.

If this state is permanent, an explicit error message is reported like :
    /dev/sdb1 is not populated while /sys/block/sdb has it

Signed-off-by: Erwan Velu <erwan@redhat.com>
src/ceph-disk/ceph_disk/main.py