Skip to content

Commit

Permalink
Merge pull request #316 from yati1998/drivercheck
Browse files Browse the repository at this point in the history
csi: add check to include only cephfs subvolumes
  • Loading branch information
subhamkrai committed Jul 31, 2024
2 parents 532e89c + f17fb54 commit 1f78cc3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions pkg/filesystem/subvolume.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,16 @@ func getK8sRefSubvolume(ctx context.Context, clientsets *k8sutil.Clientsets) map
subvolumeNames := make(map[string]subVolumeInfo)
for _, pv := range pvList.Items {
if pv.Spec.CSI != nil {
subvolumePath := pv.Spec.CSI.VolumeAttributes["subvolumePath"]
name, err := getSubvolumeNameFromPath(subvolumePath)
if err != nil {
logging.Error(err, "failed to get subvolume name")
continue
driverName := pv.Spec.CSI.Driver
if strings.Contains(driverName, "cephfs.csi.ceph.com") {
subvolumePath := pv.Spec.CSI.VolumeAttributes["subvolumePath"]
name, err := getSubvolumeNameFromPath(subvolumePath)
if err != nil {
logging.Error(err, "failed to get subvolume name")
continue
}
subvolumeNames[name] = subVolumeInfo{}
}
subvolumeNames[name] = subVolumeInfo{}
}
}
return subvolumeNames
Expand Down

0 comments on commit 1f78cc3

Please sign in to comment.