From 11361b05a88eb783f29e08172f110f240ffb6798 Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Thu, 9 Mar 2023 16:55:24 +0530 Subject: [PATCH] cephfs/admin: Add Subvolume{Group} pinning API Signed-off-by: Anoop C S --- cephfs/admin/pin.go | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 cephfs/admin/pin.go diff --git a/cephfs/admin/pin.go b/cephfs/admin/pin.go new file mode 100644 index 0000000..5c29d91 --- /dev/null +++ b/cephfs/admin/pin.go @@ -0,0 +1,46 @@ +//go:build !nautilus && ceph_preview +// +build !nautilus,ceph_preview + +package admin + +// PinSubVolume pins subvolume to ranks according to policies. A valid pin +// setting value depends on the type of pin as described in the docs from +// https://docs.ceph.com/en/latest/cephfs/multimds/#cephfs-pinning and +// https://docs.ceph.com/en/latest/cephfs/multimds/#setting-subtree-partitioning-policies +// +// Similar To: +// +// ceph fs subvolume pin +func (fsa *FSAdmin) PinSubVolume(volume, subvolume, pintype, pinsetting string) (string, error) { + m := map[string]string{ + "prefix": "fs subvolume pin", + "format": "json", + "vol_name": volume, + "sub_name": subvolume, + "pin_type": pintype, + "pin_setting": pinsetting, + } + + return parsePathResponse(fsa.marshalMgrCommand(m)) +} + +// PinSubVolumeGroup pins subvolume to ranks according to policies. A valid pin +// setting value depends on the type of pin as described in the docs from +// https://docs.ceph.com/en/latest/cephfs/multimds/#cephfs-pinning and +// https://docs.ceph.com/en/latest/cephfs/multimds/#setting-subtree-partitioning-policies +// +// Similar To: +// +// ceph fs subvolumegroup pin +func (fsa *FSAdmin) PinSubVolumeGroup(volume, group, pintype, pinsetting string) (string, error) { + m := map[string]string{ + "prefix": "fs subvolumegroup pin", + "format": "json", + "vol_name": volume, + "group_name": group, + "pin_type": pintype, + "pin_setting": pinsetting, + } + + return parsePathResponse(fsa.marshalMgrCommand(m)) +}