1、使用rbd rm删除image
> rbd rm ceph-block/csi-vol-00939e28-14f7-11eb-ac08-2a0aff2a8247
2020-10-31T07:34:50.079+0000 7fa2e53dd700 -1 librbd::image::PreRemoveRequest: 0x5563cae15e90 check_image_watchers: image has watchers - not removing
Removing image: 0% complete...failed.
rbd: error: image still has watchers
报出了image still has watchers错误
2、检查watcher image的client
> rbd status ceph-block/csi-vol-0068f225-14f7-11eb-ac08-2a0aff2a8247 Watchers: watcher=10.244.2.0:0/1036319188 client.974190 cookie=18446462598732840961
可以看到watcher client的IP信息,找到对应ip的应用并停止,可破解此错误
3、好吧,没办法锁定ip的应用,那就把watcher ip加入到黑名单
> ceph osd blacklist add 10.244.2.0:0/1036319188
blacklisting 10.244.2.0:0/1036319188 until 2020-10-31T08:47:43.513987+0000 (3600 sec)
4、再删除image
> rbd rm ceph-block/csi-vol-0068f225-14f7-11eb-ac08-2a0aff2a8247 Removing image: 100% complete...done.
5、把刚才加入的ip退出黑名单
> ceph osd blacklist rm 10.244.2.0:0/1036319188 un-blacklisting 10.244.2.0:0/1036319188
#查看黑名单列表
> ceph osd blacklist ls