ceph / go-ceph

Go bindings for Ceph :octopus: :octopus: :octopus:
MIT License
611 stars 251 forks source link

Ability to match errors between rados and rbd package #1031

Open nixpanic opened 2 days ago

nixpanic commented 2 days ago

In Ceph-CSI, some functions use both calls from the rados and rbd package. This is probably quite common, as interactions through the IOContext are part of rados, and image operations come from rbd.

In the case of an error on the Ceph side, go-ceph returns either a radosError or an rbdError. Ceph-CSI needs to handle some errors differently than others. A relatively common occurrence for checking an error seems to be

if errors.Is(err, librbd.ErrNotFound) || errors.Is(err, rados.ErrNotFound) {

It would be great if these errors would actually be matching the same, so that either one of these statements can be used:

if errors.Is(err, librbd.ErrNotFound) {

or

if errors.Is(err, rados.ErrNotFound) {