From 141b89f514724b45f26ce0f9e74b9d7b5c750782 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Wed, 5 Aug 2020 13:05:56 +0530 Subject: [PATCH] e2e: add function to get subvolume list added a helper function in e2e to list subvolumes in a filesystem Signed-off-by: Madhu Rajanna --- e2e/utils.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/e2e/utils.go b/e2e/utils.go index 3f2f9b0d3..0b93adca7 100644 --- a/e2e/utils.go +++ b/e2e/utils.go @@ -948,6 +948,22 @@ func writeDataInPod(app *v1.Pod, f *framework.Framework) error { return nil } +type cephfsSubVolume struct { + Name string `json:"name"` +} + +func listCephFSSubVolumes(f *framework.Framework, filesystem, groupname string) []cephfsSubVolume { + stdout, stdErr := execCommandInToolBoxPod(f, fmt.Sprintf("ceph fs subvolume ls %s --group_name=%s --format=json", filesystem, groupname), rookNamespace) + Expect(stdErr).Should(BeEmpty()) + var subVols []cephfsSubVolume + + err := json.Unmarshal([]byte(stdout), &subVols) + if err != nil { + Fail(err.Error()) + } + return subVols +} + func checkDataPersist(pvcPath, appPath string, f *framework.Framework) error { data := "checking data persist" pvc, err := loadPVC(pvcPath)