mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-23 21:40:20 +00:00
cephfs: set metadata on the subvolume snapshot on create
Set snapshot-name/snapshot-namespace/snapshotcontent-name details on subvolume snapshots as metadata on create. Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
parent
8c0dd482fa
commit
7c9259a45e
@ -854,7 +854,8 @@ func (cs *ControllerServer) CreateSnapshot(
|
||||
}
|
||||
}
|
||||
}()
|
||||
snap, err := doSnapshot(ctx, parentVolOptions, sID.FsSnapshotName)
|
||||
metadata := k8s.GetSnapshotMetadata(req.GetParameters())
|
||||
snap, err := doSnapshot(ctx, parentVolOptions, sID.FsSnapshotName, metadata)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
@ -874,6 +875,7 @@ func doSnapshot(
|
||||
ctx context.Context,
|
||||
volOpt *store.VolumeOptions,
|
||||
snapshotName string,
|
||||
metadata map[string]string,
|
||||
) (core.SnapshotInfo, error) {
|
||||
snapID := fsutil.VolumeID(snapshotName)
|
||||
snap := core.SnapshotInfo{}
|
||||
@ -909,6 +911,15 @@ func doSnapshot(
|
||||
log.ErrorLog(ctx, "failed to protect snapshot %s %v", snapID, err)
|
||||
}
|
||||
|
||||
// Set snapshot-name/snapshot-namespace/snapshotcontent-name details
|
||||
// on subvolume snapshot as metadata on create
|
||||
if len(metadata) != 0 {
|
||||
err = snapClient.SetAllSnapshotMetadata(metadata)
|
||||
if err != nil {
|
||||
return snap, err
|
||||
}
|
||||
}
|
||||
|
||||
return snap, err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user