rbd: Use rados namespace when getting clone depth

When the Ceph user is restricted to a specific namespace in the pool, it is
crucial that evey interaction with the cluster is done within that namespace.
This wasn't the case in `getCloneDepth()`.

This issue was causing snapshot creation to fail with

> Failed to check and update snapshot content: failed to take snapshot of the
> volume X: "rpc error: code = Internal desc = rbd: ret=-1, Operation not
> permitted"

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
This commit is contained in:
Benoît Knecht 2022-07-06 11:03:12 +02:00 committed by mergify[bot]
parent aed7d8d4e4
commit 507844c9b1

View File

@ -681,6 +681,7 @@ func (ri *rbdImage) getCloneDepth(ctx context.Context) (uint, error) {
vol.Pool = ri.Pool vol.Pool = ri.Pool
vol.Monitors = ri.Monitors vol.Monitors = ri.Monitors
vol.RbdImageName = ri.RbdImageName vol.RbdImageName = ri.RbdImageName
vol.RadosNamespace = ri.RadosNamespace
vol.conn = ri.conn.Copy() vol.conn = ri.conn.Copy()
for { for {