Skip to content

Commit

Permalink
Merge pull request #859 from mowangdk/cleanup/delete_remove_all
Browse files Browse the repository at this point in the history
cleanup: delete RemoveAll MkdirAll method
  • Loading branch information
mowangdk authored Sep 5, 2023
2 parents 8488217 + b36f1f6 commit b9f0aeb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pkg/metric/fuse_stat_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ func NewFuseStatCollector() (Collector, error) {
func getPodUID(fsClientPathPrefix string, fsClientType string) ([]string, error) {
fsClientPath := fsClientPathPrefix + fsClientType
if !utils.IsFileExisting(fsClientPath) {
_ = utils.MkdirAll(fsClientPath, os.FileMode(0755))
_ = os.MkdirAll(fsClientPath, os.FileMode(0755))
}
return listDirectory(fsClientPathPrefix + fsClientType)
}
Expand Down
11 changes: 1 addition & 10 deletions pkg/utils/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"errors"
"fmt"
"io"
"io/fs"
"io/ioutil"
"net"
"net/http"
Expand Down Expand Up @@ -918,21 +917,13 @@ func IsPathAvailiable(path string) error {
return nil
}

func RemoveAll(deletePath string) error {
return os.RemoveAll(deletePath)
}

func MkdirAll(path string, mode fs.FileMode) error {
return os.MkdirAll(path, mode)
}

func WriteMetricsInfo(metricsPathPrefix string, req *csi.NodePublishVolumeRequest, metricsTop string, clientName string, storageBackendName string, fsName string) {
podUIDPath := metricsPathPrefix + req.VolumeContext["csi.storage.k8s.io/pod.uid"] + "/"
mountPointPath := podUIDPath + req.GetVolumeId() + "/"
podInfoName := "pod_info"
mountPointName := "mount_point_info"
if !IsFileExisting(mountPointPath) {
_ = MkdirAll(mountPointPath, os.FileMode(0755))
_ = os.MkdirAll(mountPointPath, os.FileMode(0755))
}
if !IsFileExisting(podUIDPath + podInfoName) {
info := req.VolumeContext["csi.storage.k8s.io/pod.namespace"] + " " +
Expand Down

0 comments on commit b9f0aeb

Please sign in to comment.