mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-03-06 15:39:29 +00:00
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 <ndevos@ibm.com>
(cherry picked from commit b3faa04504
)
This commit is contained in:
parent
43c3cc8de6
commit
bd73674596
@ -1226,7 +1226,11 @@ func (cs *ControllerServer) CreateSnapshot(
|
|||||||
return nil, status.Error(codes.Internal, err.Error())
|
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 {
|
if err != nil {
|
||||||
return nil, status.Error(codes.Internal, err.Error())
|
return nil, status.Error(codes.Internal, err.Error())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user