Skip to content

Commit

Permalink
Rename access_points throughout the rest of the code and tests
Browse files Browse the repository at this point in the history
Required-githooks: true
  • Loading branch information
mjmac committed Dec 3, 2024
1 parent abdfd51 commit d16f04d
Show file tree
Hide file tree
Showing 50 changed files with 336 additions and 322 deletions.
2 changes: 1 addition & 1 deletion src/control/cmd/daos_server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ The control API is responsible for working out which `daos_server` instance
is the MS leader and issuing the request, `dmg` uses the control API.
The `dmg` tool requires the hostlist of all hosts in the DAOS system to be
specified either on the command line or in the `daos_control.yml` config file.
A list of access point servers is defined in the server's config file.
A list of MS replica servers is defined in the server's config file.

## Functionality

Expand Down
12 changes: 6 additions & 6 deletions src/control/cmd/daos_server/auto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,16 +338,16 @@ func TestDaosServer_Auto_confGen(t *testing.T) {
hf: defHostFabric,
hs: defHostStorage,
expCfg: control.MockServerCfg("ofi+psm2", exmplEngineCfgs).
WithAccessPoints("localhost:10001").
WithMgmtSvcReplicas("localhost:10001").
WithControlLogFile("/tmp/daos_server.log"),
},
"MS replicas set": {
msReplicas: "moon-111,mars-115,jupiter-119",
hf: defHostFabric,
hs: defHostStorage,
expCfg: control.MockServerCfg("ofi+psm2", exmplEngineCfgs).
WithAccessPoints("localhost:10001").
WithAccessPoints("moon-111:10001", "mars-115:10001", "jupiter-119:10001").
WithMgmtSvcReplicas("localhost:10001").
WithMgmtSvcReplicas("moon-111:10001", "mars-115:10001", "jupiter-119:10001").
WithControlLogFile("/tmp/daos_server.log"),
},
"unmet min nr ssds": {
Expand Down Expand Up @@ -391,7 +391,7 @@ func TestDaosServer_Auto_confGen(t *testing.T) {
},
},
expCfg: control.MockServerCfg("ofi+psm2", tmpfsEngineCfgs).
WithAccessPoints("localhost:10001").
WithMgmtSvcReplicas("localhost:10001").
WithControlLogFile("/tmp/daos_server.log"),
},
"dcpm scm; control_metadata path set": {
Expand All @@ -418,7 +418,7 @@ func TestDaosServer_Auto_confGen(t *testing.T) {
},
},
expCfg: control.MockServerCfg("ofi+psm2", mdOnSSDEngineCfgs).
WithAccessPoints("localhost:10001").
WithMgmtSvcReplicas("localhost:10001").
WithControlLogFile("/tmp/daos_server.log").
WithControlMetadata(controlMetadata),
},
Expand Down Expand Up @@ -510,7 +510,7 @@ func TestDaosServer_Auto_confGen(t *testing.T) {
WithBdevDeviceList("0000:97:00.5", "0000:e2:00.5"),
),
}).
WithAccessPoints("localhost:10001").
WithMgmtSvcReplicas("localhost:10001").
WithControlLogFile("/tmp/daos_server.log"),
},
} {
Expand Down
10 changes: 5 additions & 5 deletions src/control/cmd/dmg/auto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestAuto_ConfigCommands(t *testing.T) {

runConfGenCmdTests(t, []cmdTest{
{
"Generate with no access point",
"Generate with no MS replica",
"config generate",
printCGRReq(t, func() control.ConfGenerateRemoteReq {
req := control.ConfGenerateRemoteReq{
Expand Down Expand Up @@ -376,17 +376,17 @@ func TestAuto_confGen(t *testing.T) {
{storHostResp},
},
expCfg: control.MockServerCfg("ofi+psm2", exmplEngineCfgs).
WithAccessPoints("localhost:10001").
WithMgmtSvcReplicas("localhost:10001").
WithControlLogFile("/tmp/daos_server.log"),
},
"dcpm scm; access points set": {
"dcpm scm; MS replicas set": {
msReplicas: "moon-111,mars-115,jupiter-119",
hostResponsesSet: [][]*control.HostResponse{
{netHostResp},
{storHostResp},
},
expCfg: control.MockServerCfg("ofi+psm2", exmplEngineCfgs).
WithAccessPoints("moon-111:10001", "mars-115:10001", "jupiter-119:10001").
WithMgmtSvcReplicas("moon-111:10001", "mars-115:10001", "jupiter-119:10001").
WithControlLogFile("/tmp/daos_server.log"),
},
"dcpm scm; unmet min nr ssds": {
Expand Down Expand Up @@ -609,7 +609,7 @@ hyperthreads: false
typicalAutoGenOutCfg := config.DefaultServer().
WithControlLogFile(defaultControlLogFile).
WithFabricProvider("ofi+verbs").
WithAccessPoints("hostX:10002").
WithMgmtSvcReplicas("hostX:10002").
WithDisableVMD(false).
WithEngines(
engine.MockConfig().
Expand Down
4 changes: 2 additions & 2 deletions src/control/fault/code/codes.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ const (
ServerNoConfigPath
ServerConfigBadControlPort
ServerConfigBadTelemetryPort
ServerConfigBadAccessPoints
ServerConfigEvenAccessPoints
ServerConfigBadMgmtSvcReplicas
ServerConfigEvenMgmtSvcReplicas
ServerConfigBadProvider
ServerConfigNoEngines
ServerConfigDuplicateFabric
Expand Down
2 changes: 1 addition & 1 deletion src/control/lib/control/auto.go
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ func genServerConfig(req ConfGenerateReq, ecs []*engine.Config, tc *threadCounts
}

cfg := config.DefaultServer().
WithAccessPoints(req.MgmtSvcReplicas...).
WithMgmtSvcReplicas(req.MgmtSvcReplicas...).
WithFabricProvider(ecs[0].Fabric.Provider).
WithEngines(ecs...).
WithControlLogFile(defaultControlLogFile)
Expand Down
16 changes: 8 additions & 8 deletions src/control/lib/control/auto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1644,13 +1644,13 @@ func TestControl_AutoConfig_genServerConfig(t *testing.T) {
ecs: []*engine.Config{exmplEngineCfg0},
expErr: errors.New("no MS replicas"),
},
"access points without the same port": {
"MS replicas without the same port": {
msReplicas: []string{"bob:1", "joe:2"},
threadCounts: &threadCounts{16, 0},
ecs: []*engine.Config{exmplEngineCfg0},
expErr: errors.New("numbers do not match"),
},
"access points some with port specified": {
"MS replicas some with port specified": {
msReplicas: []string{"bob:1", "joe"},
threadCounts: &threadCounts{16, 0},
ecs: []*engine.Config{exmplEngineCfg0},
Expand All @@ -1664,7 +1664,7 @@ func TestControl_AutoConfig_genServerConfig(t *testing.T) {
[]*engine.Config{
exmplEngineCfg0.WithHelperStreamCount(0),
}).
WithAccessPoints("hostX:10001"), // Default applied.
WithMgmtSvcReplicas("hostX:10001"), // Default applied.
},
"single engine config; default port number specified": {
msReplicas: []string{"hostX:10001"},
Expand All @@ -1674,9 +1674,9 @@ func TestControl_AutoConfig_genServerConfig(t *testing.T) {
[]*engine.Config{
exmplEngineCfg0.WithHelperStreamCount(0),
}).
WithAccessPoints("hostX:10001"), // ControlPort remains at 10001.
WithMgmtSvcReplicas("hostX:10001"), // ControlPort remains at 10001.
},
"dual engine config; custom access point port number": {
"dual engine config; custom MS replica port number": {
msReplicas: []string{"hostX:10002"},
threadCounts: &threadCounts{16, 0},
ecs: []*engine.Config{
Expand All @@ -1688,10 +1688,10 @@ func TestControl_AutoConfig_genServerConfig(t *testing.T) {
exmplEngineCfg0.WithHelperStreamCount(0),
exmplEngineCfg1.WithHelperStreamCount(0),
}).
WithAccessPoints("hostX:10002").
WithMgmtSvcReplicas("hostX:10002").
WithControlPort(10002), // ControlPort updated to AP port.
},
"bad accesspoint port": {
"bad MS replica port": {
msReplicas: []string{"hostX:-10001"},
threadCounts: &threadCounts{16, 0},
ecs: []*engine.Config{
Expand Down Expand Up @@ -1737,7 +1737,7 @@ func TestControl_AutoConfig_genServerConfig(t *testing.T) {
storage.BdevOutConfName),
),
}).
WithAccessPoints("hostX:10002", "hostY:10002", "hostZ:10002").
WithMgmtSvcReplicas("hostX:10002", "hostY:10002", "hostZ:10002").
WithControlPort(10002). // ControlPort updated to AP port.
WithControlMetadata(controlMetadata),
},
Expand Down
24 changes: 12 additions & 12 deletions src/control/lib/control/event.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// (C) Copyright 2021-2022 Intel Corporation.
// (C) Copyright 2021-2024 Intel Corporation.
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
Expand Down Expand Up @@ -68,11 +68,11 @@ func eventNotify(ctx context.Context, rpcClient UnaryInvoker, seq uint64, evt *e
}

// EventForwarder implements the events.Handler interface, increments sequence
// number for each event forwarded and distributes requests to MS access points.
// number for each event forwarded and distributes requests to MS replicas.
type EventForwarder struct {
seq <-chan uint64
client UnaryInvoker
accessPts []string
seq <-chan uint64
client UnaryInvoker
msReplicas []string
}

// OnEvent implements the events.Handler interface.
Expand All @@ -81,21 +81,21 @@ func (ef *EventForwarder) OnEvent(ctx context.Context, evt *events.RASEvent) {
case evt == nil:
ef.client.Debug("skip event forwarding, nil event")
return
case len(ef.accessPts) == 0:
ef.client.Debug("skip event forwarding, missing access points")
case len(ef.msReplicas) == 0:
ef.client.Debug("skip event forwarding, missing MS replicas")
return
case !evt.ShouldForward():
ef.client.Debugf("forwarding disabled for %s event", evt.ID)
return
}

if err := eventNotify(ctx, ef.client, <-ef.seq, evt, ef.accessPts); err != nil {
if err := eventNotify(ctx, ef.client, <-ef.seq, evt, ef.msReplicas); err != nil {
ef.client.Debugf("failed to forward event to MS: %s", err)
}
}

// NewEventForwarder returns an initialized EventForwarder.
func NewEventForwarder(rpcClient UnaryInvoker, accessPts []string) *EventForwarder {
func NewEventForwarder(rpcClient UnaryInvoker, replicas []string) *EventForwarder {
seqCh := make(chan uint64)
go func(ch chan<- uint64) {
for i := uint64(1); ; i++ {
Expand All @@ -104,9 +104,9 @@ func NewEventForwarder(rpcClient UnaryInvoker, accessPts []string) *EventForward
}(seqCh)

return &EventForwarder{
seq: seqCh,
client: rpcClient,
accessPts: accessPts,
seq: seqCh,
client: rpcClient,
msReplicas: replicas,
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/control/lib/control/event_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// (C) Copyright 2021-2022 Intel Corporation.
// (C) Copyright 2021-2024 Intel Corporation.
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
Expand Down Expand Up @@ -89,25 +89,25 @@ func TestControl_EventForwarder_OnEvent(t *testing.T) {
rasEventEngineDiedFwdable := mockEvtEngineDied(t).WithForwardable(true)

for name, tc := range map[string]struct {
aps []string
replicas []string
event *events.RASEvent
nilClient bool
expInvokeCount int
}{
"nil event": {
event: nil,
},
"missing access points": {
"missing MS replicas": {
event: rasEventEngineDiedFwdable,
},
"successful forward": {
event: rasEventEngineDiedFwdable,
aps: []string{"192.168.1.1"},
replicas: []string{"192.168.1.1"},
expInvokeCount: 2,
},
"skip non-forwardable event": {
event: rasEventEngineDied,
aps: []string{"192.168.1.1"},
event: rasEventEngineDied,
replicas: []string{"192.168.1.1"},
},
} {
t.Run(name, func(t *testing.T) {
Expand All @@ -126,7 +126,7 @@ func TestControl_EventForwarder_OnEvent(t *testing.T) {
callCount++ // call at least once
}

ef := NewEventForwarder(mi, tc.aps)
ef := NewEventForwarder(mi, tc.replicas)
for i := 0; i < callCount; i++ {
ef.OnEvent(test.Context(t), tc.event)
}
Expand Down
18 changes: 9 additions & 9 deletions src/control/server/config/faults.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ var (
"invalid telemetry port in configuration",
"specify a positive non-zero network port in configuration ('telemetry_port' parameter) and restart the control server",
)
FaultConfigBadAccessPoints = serverConfigFault(
code.ServerConfigBadAccessPoints,
"invalid list of access points in configuration",
"'access_points' must contain resolvable addresses; fix the configuration and restart the control server",
)
FaultConfigEvenAccessPoints = serverConfigFault(
code.ServerConfigEvenAccessPoints,
"non-odd number of access points in configuration",
"'access_points' must contain an odd number (e.g. 1, 3, 5, etc.) of addresses; fix the configuration and restart the control server",
FaultConfigBadMgmtSvcReplicas = serverConfigFault(
code.ServerConfigBadMgmtSvcReplicas,
"invalid list of MS replicas in configuration",
"'mgmt_svc_replicas' must contain resolvable addresses; fix the configuration and restart the control server",
)
FaultConfigEvenMgmtSvcReplicas = serverConfigFault(
code.ServerConfigEvenMgmtSvcReplicas,
"non-odd number of MS replicas in configuration",
"'mgmt_svc_replicas' must contain an odd number (e.g. 1, 3, 5, etc.) of addresses; fix the configuration and restart the control server",
)
FaultConfigNoProvider = serverConfigFault(
code.ServerConfigBadProvider,
Expand Down
16 changes: 8 additions & 8 deletions src/control/server/config/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ func (cfg *Server) WithEngines(engineList ...*engine.Config) *Server {
return cfg
}

// WithAccessPoints sets the access point list.
func (cfg *Server) WithAccessPoints(aps ...string) *Server {
cfg.MgmtSvcReplicas = aps
// WithMgmtSvcReplicas sets the MS replicas list.
func (cfg *Server) WithMgmtSvcReplicas(reps ...string) *Server {
cfg.MgmtSvcReplicas = reps
return cfg
}

Expand Down Expand Up @@ -435,7 +435,7 @@ func GetMSReplicaPort(log logging.Logger, addr string) (int, error) {
_, port, err := net.SplitHostPort(addr)
if err != nil {
log.Errorf("invalid MS replica %q: %s", addr, err)
return 0, FaultConfigBadAccessPoints
return 0, FaultConfigBadMgmtSvcReplicas
}

portNum, err := strconv.Atoi(port)
Expand Down Expand Up @@ -675,8 +675,8 @@ func (cfg *Server) Validate(log logging.Logger) (err error) {
newReps = append(newReps, newAP)
}
if common.StringSliceHasDuplicates(newReps) {
log.Error("duplicate access points addresses")
return FaultConfigBadAccessPoints
log.Error("duplicate MS replica addresses")
return FaultConfigBadMgmtSvcReplicas
}
cfg.MgmtSvcReplicas = newReps

Expand All @@ -699,9 +699,9 @@ func (cfg *Server) Validate(log logging.Logger) (err error) {

switch {
case len(cfg.MgmtSvcReplicas) < 1:
return FaultConfigBadAccessPoints
return FaultConfigBadMgmtSvcReplicas
case len(cfg.MgmtSvcReplicas)%2 == 0:
return FaultConfigEvenAccessPoints
return FaultConfigEvenMgmtSvcReplicas
case len(cfg.MgmtSvcReplicas) == 1:
log.Noticef("Configuration includes only one MS replica. This provides no redundancy " +
"in the event of a MS replica failure.")
Expand Down
Loading

0 comments on commit d16f04d

Please sign in to comment.