[root@ceph01 ceph]# rbd ls --pool sunday-rbd -l
NAME SIZE PARENT FMT PROT LOCK
rbd-demo.img 1 GiB
[root@ceph01 ceph]# rbd remove sunday-rbd/rbd-demo.img
2024-05-22 12:36:33.129 7f82c569c700 -1 librbd::image::PreRemoveRequest: 0x558238a32260 check_image_watchers: image has watchers - not removing
Removing image: 0% complete...failed.
rbd: error: image still has watchers
This means the image is still open or the client using it crashed. Try again after closing/unmapping it or waiting 30s for the crashed client to timeout.
解决:
- 查看rbd 残留的watch信息
- 将该残留的watch信息添加到osd的黑名单,再
-查看watch是否存在。 - 没有残留的watch信息再进行删除操作
[root@ceph01 ceph]# rbd status sunday-rbd/rbd-demo.img
Watchers:
watcher=192.168.77.41:0/256293269 client.4684 cookie=18446462598732840962
[root@ceph01 ceph]# ceph osd blacklist add 192.168.77.41:0/256293269
blacklisting 192.168.77.41:0/256293269 until 2024-05-22 13:39:04.317302 (3600 sec)
[root@ceph01 ceph]# rbd status sunday-rbd/rbd-demo.img
Watchers: none
[root@ceph01 ceph]# rbd remove sunday-rbd/rbd-demo.img
Removing image: 100% complete...done.