Skip to content

Commit

Permalink
csi: add check to include only cephfs subvolumes
Browse files Browse the repository at this point in the history
this commit adds an extra check to check the drivername.

Signed-off-by: yati1998 <ypadia@redhat.com>
  • Loading branch information
yati1998 committed Jul 31, 2024
1 parent 532e89c commit f17fb54
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 f17fb54

Please sign in to comment.