From b3faa04504618fe5e50c5edf9ee368a545d2aa62 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Tue, 18 Feb 2025 16:11:48 +0100 Subject: [PATCH] rbd: always include the `SourceVolumeID` when returning a Snapshot `doSnapshotClone()` returns a new `rbdVolume` object from a temporary snapshot. This conversion drops the `SourceVolumeID` attribute, as a `rbdVolume` does not have that. After converting the `rbdVolume` back to a `rbdSnapshot`, the `SourceVolumeID` attribute can be set again, and the `ToCSI()` function can create an appropriate CSI Snapshot struct. Signed-off-by: Niels de Vos --- internal/rbd/controllerserver.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/rbd/controllerserver.go b/internal/rbd/controllerserver.go index 44c9e231d..fab44ae30 100644 --- a/internal/rbd/controllerserver.go +++ b/internal/rbd/controllerserver.go @@ -1248,7 +1248,11 @@ func (cs *ControllerServer) CreateSnapshot( return nil, status.Error(codes.Internal, err.Error()) } - csiSnap, err := vol.toSnapshot().ToCSI(ctx) + // FIXME: doSnapshotClone() returns a rbdVolume, some attributes may be missing? + snap := vol.toSnapshot() + snap.SourceVolumeID = rbdSnap.SourceVolumeID + + csiSnap, err := snap.ToCSI(ctx) if err != nil { return nil, status.Error(codes.Internal, err.Error()) }