rbd: remove redundant rbdVolume.connect() in flattenRbdImage()

This commit removes `rv.Connect(cr)` since the rbdVolume should
have an active connection in this stage of the function call.

`rv.getCloneDepth(ctx)` will work after a connect to the cluster.

Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
Rakshith R 2021-11-09 17:18:29 +05:30 committed by mergify[bot]
parent ad3c334a3a
commit 7b0f051fd4

View File

@ -871,10 +871,6 @@ func (rv *rbdVolume) flattenRbdImage(
"task manager does not support flatten,image will be flattened once hardlimit is reached: %v", "task manager does not support flatten,image will be flattened once hardlimit is reached: %v",
err) err)
if forceFlatten || depth >= hardlimit { if forceFlatten || depth >= hardlimit {
err = rv.Connect(cr)
if err != nil {
return err
}
err := rv.flatten() err := rv.flatten()
if err != nil { if err != nil {
log.ErrorLog(ctx, "rbd failed to flatten image %s %s: %v", rv.Pool, rv.RbdImageName, err) log.ErrorLog(ctx, "rbd failed to flatten image %s %s: %v", rv.Pool, rv.RbdImageName, err)