Skip to content

Commit cd72874

Browse files
authored
Support IB network type (#91)
This support is added to enable mgmtd listener to listen on ib interface. Signed-off-by: diabloneo <diabloneo@gmail.com>
1 parent 3e30f8c commit cd72874

File tree

9 files changed

+34
-7
lines changed

9 files changed

+34
-7
lines changed

Diff for: README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ Then, edit **cluster.yml**:
5353
name: "open3fs"
5454
workDir: "/opt/3fs"
5555
# networkType configure the network type of the cluster, can be one of the following:
56-
# - RDMA: use RDMA network protocol
56+
# - IB: use InfiniBand network protocol
57+
# - RDMA: use RDMA network protocol
5758
# - ERDMA: use aliyun ERDMA as RDMA network protocol
58-
# - RXE: use linux rxe kernel module to mock RDMA network protocol
59+
# - RXE: use Linux rxe kernel module to mock RDMA network protocol
5960
networkType: "ERDMA"
6061
nodes:
6162
- name: node1

Diff for: cluster.yml.sample

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ name: "open3fs"
77
# workDir is the work dir for all 3fs services
88
workDir: "/opt/3fs"
99
# networkType configure the network type of the cluster, can be one of the following:
10-
# - RDMA: use RDMA network protocol
10+
# - IB: use InfiniBand network protocol
11+
# - RDMA: use RDMA network protocol
1112
# - ERDMA: use aliyun ERDMA as RDMA network protocol
12-
# - RXE: use linux rxe kernel module to mock RDMA network protocol
13+
# - RXE: use Linux rxe kernel module to mock RDMA network protocol
1314
networkType: "RDMA"
1415
# Set the log level of 3fs services.
1516
# Supported values: "DEBUG", "INFO", "WARN", "ERROR", "FATAL"

Diff for: pkg/config/config.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ type NetworkType string
2929

3030
// defines network types
3131
const (
32+
NetworkTypeIB NetworkType = "IB"
3233
NetworkTypeRDMA NetworkType = "RDMA"
3334
NetworkTypeRXE NetworkType = "RXE"
3435
NetworkTypeERDMA NetworkType = "ERDMA"
3536
)
3637

37-
var networkTypes = utils.NewSet(NetworkTypeRDMA, NetworkTypeRXE, NetworkTypeERDMA)
38+
var networkTypes = utils.NewSet(NetworkTypeIB, NetworkTypeRDMA, NetworkTypeRXE, NetworkTypeERDMA)
3839

3940
// DiskType is the type of disk definition
4041
type DiskType string

Diff for: pkg/mgmtd/steps.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ func (s *genAdminCliConfigStep) Execute(ctx context.Context) error {
8888
port := strconv.Itoa(s.Runtime.Services.Mgmtd.RDMAListenPort)
8989
for i, nodeName := range s.Runtime.Services.Mgmtd.Nodes {
9090
node := s.Runtime.Nodes[nodeName]
91-
mgmtdServerAddresses[i] = fmt.Sprintf(`"RDMA://%s"`, net.JoinHostPort(node.Host, port))
91+
mgmtdServerAddresses[i] = fmt.Sprintf(`"%s://%s"`,
92+
s.Runtime.MgmtdProtocol, net.JoinHostPort(node.Host, port))
9293
}
9394
mgmtdServerAddressesStr := fmt.Sprintf("[%s]", strings.Join(mgmtdServerAddresses, ","))
9495
s.Runtime.Store(task.RuntimeMgmtdServerAddressesKey, mgmtdServerAddressesStr)

Diff for: pkg/mgmtd/templates/mgmtd_main.toml.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ proc_thread_pool_stratetry = 'SHARED_QUEUE'
8080
[[server.base.groups]]
8181
check_connections_interval = '1min'
8282
connection_expiration_time = '1day'
83-
network_type = 'RDMA'
83+
network_type = '{{ .MgmtdProtocol }}'
8484
services = [ 'Mgmtd' ]
8585
use_independent_thread_pool = false
8686

Diff for: pkg/task/runner.go

+11
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ type Runtime struct {
5252
WorkDir string
5353
LocalEm *external.Manager
5454
LocalNode *config.Node
55+
56+
// MgmtdProtocol is used to set the protocol of mgmtd address.
57+
// It maps RDMA types to RDMA://
58+
// It maps IB types to IPoIB://
59+
// Currently, only mgmtd address uses IPoIB protocol, all other services still use RDMA protocol.
60+
// TODO: Find the reason from 3FS code base.
61+
MgmtdProtocol string
5562
}
5663

5764
// LoadString load string value form sync map
@@ -96,6 +103,10 @@ type Runner struct {
96103
// Init initializes all tasks.
97104
func (r *Runner) Init() {
98105
r.Runtime = &Runtime{Cfg: r.cfg, WorkDir: r.cfg.WorkDir, LocalNode: r.localNode}
106+
r.Runtime.MgmtdProtocol = "RDMA"
107+
if r.cfg.NetworkType == config.NetworkTypeIB {
108+
r.Runtime.MgmtdProtocol = "IPoIB"
109+
}
99110
r.Runtime.Nodes = make(map[string]config.Node, len(r.cfg.Nodes))
100111
for _, node := range r.cfg.Nodes {
101112
r.Runtime.Nodes[node.Name] = node

Diff for: pkg/task/runner_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ func (s *runnerSuite) TestInit() {
5050
s.mockTask.AssertExpectations(s.T())
5151
}
5252

53+
func (s *runnerSuite) TestInitWithIB() {
54+
s.runner.cfg.NetworkType = config.NetworkTypeIB
55+
s.TestInit()
56+
57+
s.Equal(s.runner.Runtime.MgmtdProtocol, "IPoIB")
58+
}
59+
5360
func (s *runnerSuite) TestRegisterAfterInit() {
5461
s.TestInit()
5562
s.mockTask.On("Name").Return("mockTask")

Diff for: pkg/task/steps/3fs_steps.go

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ func (s *prepare3FSConfigStep) genConfigs(tmpDir string) error {
206206
"RDMAListenPort": s.rdmaListenPort,
207207
"TCPListenPort": s.tcpListenPort,
208208
"MgmtdServerAddresses": mgmtdServerAddresses,
209+
"MgmtdProtocol": s.Runtime.MgmtdProtocol,
209210
}
210211
for k, v := range s.extraMainTomlData {
211212
mainTmplData[k] = v

Diff for: pkg/task/task.go

+4
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ func (s *BaseStep) GetErdmaSoPath(ctx context.Context) error {
211211
// GetRdmaVolumes returns the volumes need mapped to container for the rdma network.
212212
func (s *BaseStep) GetRdmaVolumes() []*external.VolumeArgs {
213213
volumes := []*external.VolumeArgs{}
214+
if s.Runtime.Cfg.NetworkType == config.NetworkTypeIB {
215+
return volumes
216+
}
217+
214218
if s.Runtime.Cfg.NetworkType != config.NetworkTypeRDMA {
215219
ibdev2netdevScriptPath := path.Join(s.Runtime.Cfg.WorkDir, "bin", "ibdev2netdev")
216220
volumes = append(volumes, &external.VolumeArgs{

0 commit comments

Comments
 (0)