Skip to content

Commit

Permalink
refactor(utils): move is mount read only function to common lib
Browse files Browse the repository at this point in the history
ref: longhorn/longhorn 7394

Signed-off-by: Jack Lin <jack.lin@suse.com>
  • Loading branch information
ChanYiLin committed Mar 7, 2024
1 parent d9b06ab commit 768a5d8
Show file tree
Hide file tree
Showing 79 changed files with 2,590 additions and 1,060 deletions.
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ go 1.21
require (
github.com/RoaringBitmap/roaring v1.9.0
github.com/google/uuid v1.6.0
github.com/longhorn/backupstore v0.0.0-20240126140439-9c90a8728ca2
github.com/longhorn/go-common-libs v0.0.0-20240109042507-23627e6416b7
github.com/longhorn/go-spdk-helper v0.0.0-20240117135122-26f8acb2a13d
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-20240301101140-6eb6aa5fc09d
github.com/longhorn/longhorn-engine v1.6.0-dev-20240105.0.20240126141003-067f67803ee8
github.com/longhorn/longhorn-spdk-engine v0.0.0-20240123044045-c5f14845bd83
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
github.com/urfave/cli v1.22.12
github.com/urfave/cli v1.22.14
golang.org/x/net v0.21.0
golang.org/x/sync v0.6.0
google.golang.org/grpc v1.62.0
google.golang.org/protobuf v1.32.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.29.2
)
Expand Down Expand Up @@ -58,14 +58,14 @@ require (
github.com/rancher/go-fibmap v0.0.0-20160418233256-5fc9f8c1ed47 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/shirou/gopsutil/v3 v3.23.7 // indirect
github.com/shirou/gopsutil/v3 v3.24.2 // indirect
github.com/slok/goresilience v0.2.0 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
k8s.io/apimachinery v0.27.1 // indirect
k8s.io/apimachinery v0.29.2 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
)
78 changes: 27 additions & 51 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/protobuf/types/known/emptypb"
"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 @@ -161,7 +162,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
2 changes: 1 addition & 1 deletion pkg/proxy/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func (p *Proxy) RemountReadOnlyVolume(ctx context.Context, req *rpc.RemountVolum
"remount,rw",
mp.Path,
}
if _, err := nsexec.Execute("mount", opts, lhtypes.ExecuteDefaultTimeout); err != nil {
if _, err := nsexec.Execute(nil, "mount", opts, lhtypes.ExecuteDefaultTimeout); err != nil {
return nil, grpcstatus.Errorf(grpccodes.Internal, "remount failed with error: %v", err)
}
}
Expand Down
22 changes: 22 additions & 0 deletions vendor/github.com/longhorn/backupstore/config.go

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

11 changes: 11 additions & 0 deletions vendor/github.com/longhorn/backupstore/deltablock.go

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

3 changes: 3 additions & 0 deletions vendor/github.com/longhorn/backupstore/renovate.json

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

1 change: 1 addition & 0 deletions vendor/github.com/longhorn/go-common-libs/io/file.go

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

2 changes: 1 addition & 1 deletion vendor/github.com/longhorn/go-common-libs/ns/crypto.go

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

19 changes: 12 additions & 7 deletions vendor/github.com/longhorn/go-common-libs/ns/executor.go

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

2 changes: 1 addition & 1 deletion vendor/github.com/longhorn/go-common-libs/ns/filelock.go

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

10 changes: 5 additions & 5 deletions vendor/github.com/longhorn/go-common-libs/sys/sys.go

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

12 changes: 12 additions & 0 deletions vendor/github.com/longhorn/go-common-libs/types/file.go

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

14 changes: 14 additions & 0 deletions vendor/github.com/longhorn/go-common-libs/utils/mount.go

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

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

18 changes: 9 additions & 9 deletions vendor/github.com/longhorn/go-spdk-helper/pkg/nvme/nvmecli.go

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

Loading

0 comments on commit 768a5d8

Please sign in to comment.