cephfs: validate if subvolume has snapshot-retention feature

Add validateSnapshotRetention() to verify if subvolume has
`snapshot-retention` feature.

Signed-off-by: Yug <yuggupta27@gmail.com>
(cherry picked from commit 59fc4aa00f)
This commit is contained in:
Yug 2020-09-10 17:35:53 +05:30 committed by mergify[bot]
parent 5daf21831e
commit 0f51df99e8

View File

@ -269,3 +269,16 @@ func purgeVolume(ctx context.Context, volID volumeID, cr *util.Credentials, volO
return nil
}
// checkSubvolumeHasFeature verifies if the referred subvolume has
// the required feature.
func checkSubvolumeHasFeature(feature string, subVolFeatures []string) bool {
// The subvolume "features" are based on the internal version of the subvolume.
// Verify if subvolume supports the required feature.
for _, subvolFeature := range subVolFeatures {
if subvolFeature == feature {
return true
}
}
return false
}