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>
This commit is contained in:
Yug 2020-09-10 17:35:53 +05:30 committed by mergify[bot]
parent 6351358752
commit 59fc4aa00f

View File

@ -269,3 +269,16 @@ func purgeVolume(ctx context.Context, volID volumeID, cr *util.Credentials, volO
return nil 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
}