mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-22 13:00:19 +00:00
cephfs: add support for RWX clone from ROX
Add support to create RWX clone from the ROX clone, in ceph no subvolume clone is created when ROX clone is created from a snapshot just a internal ref counter is added. This PR allows creating a RWX clone from a ROX clone which allows users to create RW copy of PVC where cephcsi will identify the snapshot created for the ROX volume and creates a subvolume from the CephFS snapshot. updates: #3603 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
5d034b1124
commit
771470d975
@ -299,6 +299,23 @@ func (cs *ControllerServer) CreateVolume(
|
||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||
}
|
||||
|
||||
// As we are trying to create RWX volume from backing snapshot, we need to
|
||||
// retrieve the snapshot details from the backing snapshot and create a
|
||||
// subvolume clone from the snapshot.
|
||||
if parentVol != nil && parentVol.BackingSnapshot && !store.IsVolumeCreateRO(req.VolumeCapabilities) {
|
||||
// unset pvID as we dont have real subvolume for the parent volumeID as its a backing snapshot
|
||||
pvID = nil
|
||||
parentVol, _, sID, err = store.NewSnapshotOptionsFromID(ctx, parentVol.BackingSnapshotID, cr,
|
||||
req.GetSecrets(), cs.ClusterName, cs.SetMetadata)
|
||||
if err != nil {
|
||||
if errors.Is(err, cerrors.ErrSnapNotFound) {
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
}
|
||||
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
vID, err := store.CheckVolExists(ctx, volOptions, parentVol, pvID, sID, cr, cs.ClusterName, cs.SetMetadata)
|
||||
if err != nil {
|
||||
if cerrors.IsCloneRetryError(err) {
|
||||
|
Loading…
Reference in New Issue
Block a user