ceph / ceph-helm

Curated applications for Kubernetes
Apache License 2.0
108 stars 36 forks source link

Fix device occasionally not exist after doing parted #57

Closed zenglg closed 6 years ago

zenglg commented 6 years ago

I use parted command to do some tests:

parted -s /dev/sdd print > /dev/null;  for i in `seq 1 1000` ;
> do ls -alh /dev/sdd13 >/dev/null || echo $i: not found sdd13 ; done

Occasionally, the test maybe faild like:

ls: cannot access /dev/sdd13: No such file or directory
1: not found sdd13

And, through the udevadm monitor output:

KERNEL[1126040.921247] remove   /devices/pci0000:00/0000:00:01.0/0000:02:00.0/host0/target0:0:3/0:0:3:0/block/sdd/sdd13 (block)
KERNEL[1126040.927888] change   /devices/pci0000:00/0000:00:01.0/0000:02:00.0/host0/target0:0:3/0:0:3:0/block/sdd (block)
KERNEL[1126040.928020] add      /devices/pci0000:00/0000:00:01.0/0000:02:00.0/host0/target0:0:3/0:0:3:0/block/sdd/sdd13 (block)
UDEV  [1126040.929398] remove   /devices/pci0000:00/0000:00:01.0/0000:02:00.0/host0/target0:0:3/0:0:3:0/block/sdd/sdd13 (block)
UDEV  [1126040.942840] change   /devices/pci0000:00/0000:00:01.0/0000:02:00.0/host0/target0:0:3/0:0:3:0/block/sdd (block)
UDEV  [1126040.957819] add      /devices/pci0000:00/0000:00:01.0/0000:02:00.0/host0/target0:0:3/0:0:3:0/block/sdd/sdd13 (block)

Seems like, the device is lost after being removed by udev(or kernel), and, reappear after being added.

Add udevadm settle to make sure all current udev event be handled.

Signed-off-by: Linggang Zeng linggang.zeng@easystack.cn

zenglg commented 6 years ago

In the host:

[root@node-1 ~]# parted -s /dev/sdd print > /dev/null; udevadm settle ; for i in `seq 1 100` ; do ls -alh /dev/sdd13 >/dev/null || echo $i: not found sdd13 ; done
[root@node-1 ~]# echo $?
0

In the container:

[root@node-1 /]# parted -s /dev/sdd print > /dev/null; udevadm settle ; for i in `seq 1 100` ; do ls -alh /dev/sdd13 >/dev/null || echo $i: not found sdd13 ; done
ls: cannot access /dev/sdd13: No such file or directory
1: not found sdd13
ls: cannot access /dev/sdd13: No such file or directory
2: not found sdd13

So, I think udevadm settle maybe not work well in the container.