From 211ca9b5a74592550b1555edf7f517856c9c9c41 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 22 Nov 2021 15:49:56 +0530 Subject: [PATCH] rbd: do deep copy for dummyVol struct with shallow copy of rbdVol to dummyVol the image name update of the dummyVol is getting reflected on the rbdVol which we dont want. do deep copy to avoid this problem. Signed-off-by: Madhu Rajanna --- internal/rbd/replicationcontrollerserver.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/rbd/replicationcontrollerserver.go b/internal/rbd/replicationcontrollerserver.go index f1729e2d1..bd5d4d58e 100644 --- a/internal/rbd/replicationcontrollerserver.go +++ b/internal/rbd/replicationcontrollerserver.go @@ -290,9 +290,9 @@ func createDummyImage(ctx context.Context, rbdVol *rbdVolume) error { if err != nil { return err } - dummyVol := rbdVol + dummyVol := *rbdVol dummyVol.RbdImageName = imgName - err = createImage(ctx, dummyVol, dummyVol.conn.Creds) + err = createImage(ctx, &dummyVol, dummyVol.conn.Creds) if err != nil && !strings.Contains(err.Error(), "File exists") { return err } @@ -310,7 +310,7 @@ func tickleMirroringOnDummyImage(rbdVol *rbdVolume, mirroringMode librbd.ImageMi if err != nil { return err } - dummyVol := rbdVol + dummyVol := *rbdVol dummyVol.RbdImageName = imgName dummyImageOpsLock.Lock()