From 6a82baf5d348eb6b2427eba26c1122072145d9b1 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 20 Dec 2021 19:44:10 +0530 Subject: [PATCH] rbd: remove SizeBytes from rbdSnapshot struct as we are moving the VolSize to rbdImage struct we should reuse the same instead of maintaining one more field in rbdSnapshot struct. Signed-off-by: Madhu Rajanna --- internal/rbd/controllerserver.go | 4 ++-- internal/rbd/rbd_journal.go | 2 +- internal/rbd/rbd_util.go | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/rbd/controllerserver.go b/internal/rbd/controllerserver.go index 7d576cf22..64c6175cf 100644 --- a/internal/rbd/controllerserver.go +++ b/internal/rbd/controllerserver.go @@ -1001,7 +1001,7 @@ func (cs *ControllerServer) CreateSnapshot( return nil, status.Error(codes.Internal, err.Error()) } rbdSnap.RbdImageName = rbdVol.RbdImageName - rbdSnap.SizeBytes = rbdVol.VolSize + rbdSnap.VolSize = rbdVol.VolSize rbdSnap.SourceVolumeID = req.GetSourceVolumeId() rbdSnap.RequestName = req.GetName() @@ -1134,7 +1134,7 @@ func cloneFromSnapshot( return &csi.CreateSnapshotResponse{ Snapshot: &csi.Snapshot{ - SizeBytes: rbdSnap.SizeBytes, + SizeBytes: rbdSnap.VolSize, SnapshotId: rbdSnap.VolID, SourceVolumeId: rbdSnap.SourceVolumeID, CreationTime: rbdSnap.CreatedAt, diff --git a/internal/rbd/rbd_journal.go b/internal/rbd/rbd_journal.go index a1633506e..5f81fafc5 100644 --- a/internal/rbd/rbd_journal.go +++ b/internal/rbd/rbd_journal.go @@ -176,7 +176,7 @@ func checkSnapCloneExists( // Code from here on, rolls the transaction forward. rbdSnap.CreatedAt = vol.CreatedAt - rbdSnap.SizeBytes = vol.VolSize + rbdSnap.VolSize = vol.VolSize // found a snapshot already available, process and return its information rbdSnap.VolID, err = util.GenerateVolID(ctx, rbdSnap.Monitors, cr, snapData.ImagePoolID, rbdSnap.Pool, rbdSnap.ClusterID, snapUUID, volIDVersion) diff --git a/internal/rbd/rbd_util.go b/internal/rbd/rbd_util.go index 69bcc913a..91068d399 100644 --- a/internal/rbd/rbd_util.go +++ b/internal/rbd/rbd_util.go @@ -184,7 +184,6 @@ type rbdSnapshot struct { SourceVolumeID string ReservedID string RbdSnapName string - SizeBytes int64 } // imageFeature represents required image features and value.