rbd: add rbdVolume.open() to get access to an image

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos
2020-05-08 16:10:18 +02:00
committed by mergify[bot]
parent 3482cb7091
commit 7a18e68a6e
2 changed files with 28 additions and 1 deletions

View File

@ -71,7 +71,13 @@ func (cc *ClusterConnection) GetIoctx(pool string) (*rados.IOContext, error) {
ioctx, err := cc.conn.OpenIOContext(pool)
if err != nil {
return nil, errors.Wrapf(err, "failed to open IOContext for pool %s", pool)
// ErrNotFound indicates the Pool was not found
if err == rados.ErrNotFound {
err = ErrPoolNotFound{pool, err}
} else {
err = errors.Wrapf(err, "failed to open IOContext for pool %s", pool)
}
return nil, err
}
return ioctx, nil