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

DAOS-16840 control: Deprecate access_points in server config #15548

Merged
merged 6 commits into from
Dec 17, 2024
Merged
Changes from 1 commit
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
Next Next commit
DAOS-16840 control: Deprecate access_points in server config
The access_points name in the server configuration is
an ongoing source of confusion. Rename it to the more
descriptive mgmt_svc_replicas and emit deprecation
notices for older configurations.

Required-githooks: true

Signed-off-by: Michael MacDonald <[email protected]>
mjmac committed Dec 5, 2024
commit 45869b0dd2fb382db1d7b960955e15ce2c04f57c
2 changes: 2 additions & 0 deletions src/control/cmd/daos_server/auto.go
Original file line number Diff line number Diff line change
@@ -122,6 +122,8 @@ func (cmd *configGenCmd) confGen(ctx context.Context, getFabric getFabricFn, get
}
cmd.Debugf("fetched host storage info on localhost: %+v", hs)

cmd.CheckDeprecated(cmd.Logger)

req := new(control.ConfGenerateReq)
if err := convert.Types(cmd, req); err != nil {
return nil, err
65 changes: 34 additions & 31 deletions src/control/cmd/daos_server/auto_test.go
Original file line number Diff line number Diff line change
@@ -32,33 +32,33 @@ import (
func TestDaosServer_Auto_Commands(t *testing.T) {
runCmdTests(t, []cmdTest{
{
"Generate with no access point",
"Generate with no MS replica",
"config generate",
printCommand(t, func() *configGenCmd {
cmd := &configGenCmd{}
cmd.AccessPoints = "localhost"
cmd.MgmtSvcReplicas = "localhost"
cmd.NetClass = "infiniband"
return cmd
}()),
nil,
},
{
"Generate with defaults",
"config generate -a foo",
"config generate -r foo",
printCommand(t, func() *configGenCmd {
cmd := &configGenCmd{}
cmd.AccessPoints = "foo"
cmd.MgmtSvcReplicas = "foo"
cmd.NetClass = "infiniband"
return cmd
}()),
nil,
},
{
"Generate with no nvme",
"config generate -a foo --scm-only",
"config generate -r foo --scm-only",
printCommand(t, func() *configGenCmd {
cmd := &configGenCmd{}
cmd.AccessPoints = "foo"
cmd.MgmtSvcReplicas = "foo"
cmd.NetClass = "infiniband"
cmd.SCMOnly = true
return cmd
@@ -67,10 +67,10 @@ func TestDaosServer_Auto_Commands(t *testing.T) {
},
{
"Generate with storage parameters",
"config generate -a foo --num-engines 2",
"config generate -r foo --num-engines 2",
printCommand(t, func() *configGenCmd {
cmd := &configGenCmd{}
cmd.AccessPoints = "foo"
cmd.MgmtSvcReplicas = "foo"
cmd.NetClass = "infiniband"
cmd.NrEngines = 2
return cmd
@@ -79,10 +79,10 @@ func TestDaosServer_Auto_Commands(t *testing.T) {
},
{
"Generate with short option storage parameters",
"config generate -a foo -e 2 -s",
"config generate -r foo -e 2 -s",
printCommand(t, func() *configGenCmd {
cmd := &configGenCmd{}
cmd.AccessPoints = "foo"
cmd.MgmtSvcReplicas = "foo"
cmd.NetClass = "infiniband"
cmd.NrEngines = 2
cmd.SCMOnly = true
@@ -92,44 +92,44 @@ func TestDaosServer_Auto_Commands(t *testing.T) {
},
{
"Generate with ethernet network device class",
"config generate -a foo --net-class ethernet",
"config generate -r foo --net-class ethernet",
printCommand(t, func() *configGenCmd {
cmd := &configGenCmd{}
cmd.AccessPoints = "foo"
cmd.MgmtSvcReplicas = "foo"
cmd.NetClass = "ethernet"
return cmd
}()),
nil,
},
{
"Generate with infiniband network device class",
"config generate -a foo --net-class infiniband",
"config generate -r foo --net-class infiniband",
printCommand(t, func() *configGenCmd {
cmd := &configGenCmd{}
cmd.AccessPoints = "foo"
cmd.MgmtSvcReplicas = "foo"
cmd.NetClass = "infiniband"
return cmd
}()),
nil,
},
{
"Generate with deprecated network device class",
"config generate -a foo --net-class best-available",
"config generate -r foo --net-class best-available",
"",
errors.New("Invalid value"),
},
{
"Generate with unsupported network device class",
"config generate -a foo --net-class loopback",
"config generate -r foo --net-class loopback",
"",
errors.New("Invalid value"),
},
{
"Generate tmpfs non-MD-on-SSD config",
"config generate -a foo --use-tmpfs-scm",
"config generate -r foo --use-tmpfs-scm",
printCommand(t, func() *configGenCmd {
cmd := &configGenCmd{}
cmd.AccessPoints = "foo"
cmd.MgmtSvcReplicas = "foo"
cmd.NetClass = "infiniband"
cmd.UseTmpfsSCM = true
return cmd
@@ -138,10 +138,10 @@ func TestDaosServer_Auto_Commands(t *testing.T) {
},
{
"Generate MD-on-SSD config",
"config generate -a foo --use-tmpfs-scm --control-metadata-path /opt/daos_md",
"config generate -r foo --use-tmpfs-scm --control-metadata-path /opt/daos_md",
printCommand(t, func() *configGenCmd {
cmd := &configGenCmd{}
cmd.AccessPoints = "foo"
cmd.MgmtSvcReplicas = "foo"
cmd.NetClass = "infiniband"
cmd.UseTmpfsSCM = true
cmd.ExtMetadataPath = "/opt/daos_md"
@@ -169,7 +169,7 @@ func TestDaosServer_Auto_confGenCmd_Convert(t *testing.T) {
cmd.NrEngines = 1
cmd.NetProvider = "ofi+tcp"
cmd.SCMOnly = true
cmd.AccessPoints = "foo,bar"
cmd.MgmtSvcReplicas = "foo,bar"
cmd.NetClass = "infiniband"
cmd.UseTmpfsSCM = true
cmd.ExtMetadataPath = "/opt/daos_md"
@@ -184,7 +184,7 @@ func TestDaosServer_Auto_confGenCmd_Convert(t *testing.T) {
NrEngines: 1,
NetProvider: "ofi+tcp",
SCMOnly: true,
AccessPoints: []string{"foo", "bar"},
MgmtSvcReplicas: []string{"foo", "bar"},
NetClass: hardware.Infiniband,
UseTmpfsSCM: true,
ExtMetadataPath: "/opt/daos_md",
@@ -273,7 +273,7 @@ func TestDaosServer_Auto_confGen(t *testing.T) {
}

for name, tc := range map[string]struct {
accessPoints string
msReplicas string
nrEngines int
scmOnly bool
netClass string
@@ -341,10 +341,10 @@ func TestDaosServer_Auto_confGen(t *testing.T) {
WithAccessPoints("localhost:10001").
WithControlLogFile("/tmp/daos_server.log"),
},
"access points set": {
accessPoints: "moon-111,mars-115,jupiter-119",
hf: defHostFabric,
hs: defHostStorage,
"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").
@@ -522,12 +522,12 @@ func TestDaosServer_Auto_confGen(t *testing.T) {
if tc.netClass == "" {
tc.netClass = "infiniband"
}
if tc.accessPoints == "" {
tc.accessPoints = "localhost"
if tc.msReplicas == "" {
tc.msReplicas = "localhost"
}

cmd := &configGenCmd{}
cmd.AccessPoints = tc.accessPoints
cmd.MgmtSvcReplicas = tc.msReplicas
cmd.NrEngines = tc.nrEngines
cmd.SCMOnly = tc.scmOnly
cmd.NetClass = tc.netClass
@@ -573,7 +573,10 @@ func TestDaosServer_Auto_confGen(t *testing.T) {
}
return x.Equals(y)
}),
cmpopts.IgnoreUnexported(security.CertificateConfig{}),
cmpopts.IgnoreUnexported(
security.CertificateConfig{},
config.Server{},
),
}

if diff := cmp.Diff(tc.expCfg, gotCfg, cmpOpts...); diff != "" {
7 changes: 4 additions & 3 deletions src/control/cmd/daos_server/config.go
Original file line number Diff line number Diff line change
@@ -11,11 +11,12 @@ import (
"path"

"github.com/daos-stack/daos/src/control/build"
"github.com/daos-stack/daos/src/control/logging"
"github.com/daos-stack/daos/src/control/server/config"
)

type cfgLoader interface {
loadConfig() error
loadConfig(logging.Logger) error
configPath() string
configOptional() bool
}
@@ -43,7 +44,7 @@ func (c *cfgCmd) configPath() string {
return c.config.Path
}

func (c *cfgCmd) loadConfig() error {
func (c *cfgCmd) loadConfig(log logging.Logger) error {
if c.IgnoreConfig {
c.config = nil
return nil
@@ -75,7 +76,7 @@ func (c *cfgCmd) loadConfig() error {
return err
}

return c.config.Load()
return c.config.Load(log)
}

func (c *cfgCmd) configOptional() bool {
2 changes: 1 addition & 1 deletion src/control/cmd/daos_server/main.go
Original file line number Diff line number Diff line change
@@ -168,7 +168,7 @@ func parseOpts(args []string, opts *mainOpts, log *logging.LeveledLogger) error
optCfgCmd.setOptional()
}

if err := cfgCmd.loadConfig(); err != nil {
if err := cfgCmd.loadConfig(log); err != nil {
return errors.Wrapf(err, "failed to load config from %s",
cfgCmd.configPath())
} else if cfgCmd.configPath() != "" {
1 change: 1 addition & 0 deletions src/control/cmd/daos_server/start_test.go
Original file line number Diff line number Diff line change
@@ -261,6 +261,7 @@ func TestStartOptions(t *testing.T) {
cmpOpts := []cmp.Option{
cmpopts.IgnoreUnexported(
security.CertificateConfig{},
config.Server{},
),
cmpopts.SortSlices(func(a, b string) bool { return a < b }),
}
4 changes: 3 additions & 1 deletion src/control/cmd/dmg/auto.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// (C) Copyright 2020-2023 Intel Corporation.
// (C) Copyright 2020-2024 Intel Corporation.
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
@@ -54,6 +54,8 @@ func (cmd *configGenCmd) confGen(ctx context.Context) (*config.Server, error) {
hl = []string{"localhost"}
}

cmd.CheckDeprecated(cmd.Logger)

req := control.ConfGenerateRemoteReq{
ConfGenerateReq: control.ConfGenerateReq{},
Client: cmd.ctlInvoker,
Loading