Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MANUALLY BACKPORT v1.5.x] refactor(utils): move is mount read only function to common lib #428

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ require (
github.com/golang/protobuf v1.5.4
github.com/google/uuid v1.6.0
github.com/longhorn/backupstore v0.0.0-20240219094812-3a87ee02df77
github.com/longhorn/go-common-libs v0.0.0-20240307063052-6e77996eda29
github.com/longhorn/go-spdk-helper v0.0.0-20231113055029-9acddd184246
github.com/longhorn/longhorn-engine v1.5.4
github.com/longhorn/longhorn-spdk-engine v0.0.0-20231005170812-e9b634e07e47
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
github.com/urfave/cli v1.22.14
golang.org/x/net v0.20.0
golang.org/x/sync v0.5.0
google.golang.org/grpc v1.61.0
golang.org/x/sync v0.6.0
google.golang.org/grpc v1.62.1
google.golang.org/protobuf v1.33.0
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
k8s.io/mount-utils v0.27.1
k8s.io/mount-utils v0.29.2
)

require (
Expand All @@ -34,7 +35,7 @@ require (
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/gammazero/deque v0.2.1 // indirect
github.com/gammazero/workerpool v1.1.3 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gorilla/handlers v1.5.2 // indirect
github.com/jmespath/go-jmespath v0.3.0 // indirect
Expand All @@ -52,17 +53,16 @@ require (
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rancher/go-fibmap v0.0.0-20160418233256-5fc9f8c1ed47 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/slok/goresilience v0.2.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
k8s.io/apimachinery v0.27.1 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
)

replace golang.org/x/text v0.3.2 => golang.org/x/text v0.3.3
89 changes: 21 additions & 68 deletions go.sum

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion pkg/process/process_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"google.golang.org/grpc/status"
"k8s.io/mount-utils"

commonUtils "github.com/longhorn/go-common-libs/utils"
rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
"github.com/longhorn/longhorn-instance-manager/pkg/types"
"github.com/longhorn/longhorn-instance-manager/pkg/util"
Expand Down Expand Up @@ -160,7 +161,7 @@ func (pm *Manager) getProcessesToUpdateConditions(volumeMountPointMap map[string
volumeNameSHAStr := hex.EncodeToString(volumeNameSHA[:])

if mp, exists := volumeMountPointMap[volumeNameSHAStr]; exists {
p.Conditions[types.EngineConditionFilesystemReadOnly] = util.IsMountPointReadOnly(mp)
p.Conditions[types.EngineConditionFilesystemReadOnly] = commonUtils.IsMountPointReadOnly(mp)
processesToUpdate = append(processesToUpdate, p)
}
}
Expand Down
9 changes: 0 additions & 9 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,6 @@ func IsSPDKTgtReady(timeout time.Duration) bool {
return false
}

func IsMountPointReadOnly(mp mount.MountPoint) bool {
for _, opt := range mp.Opts {
if opt == "ro" {
return true
}
}
return false
}

func GetVolumeMountPointMap() (map[string]mount.MountPoint, error) {
volumeMountPointMap := make(map[string]mount.MountPoint)

Expand Down
113 changes: 112 additions & 1 deletion vendor/github.com/go-logr/logr/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions vendor/github.com/go-logr/logr/SECURITY.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 24 additions & 11 deletions vendor/github.com/go-logr/logr/logr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading