Skip to content

Commit 985c6e2

Browse files
committed
DAOS-17113 control: Enable hotplug in config by default (#16264)
Deprecate enable_hotplug and add disable_hotplug (defaults to false). Setting enable_hotplug and disable_hotplug will fail config validation. enable_hotplug: true|false will still be accepted if disable_hotplug is unset. Features: control Signed-off-by: Tom Nabarro <[email protected]>
1 parent 78e7f30 commit 985c6e2

File tree

10 files changed

+106
-24
lines changed

10 files changed

+106
-24
lines changed

src/control/cmd/daos_server/auto_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//
22
// (C) Copyright 2022-2024 Intel Corporation.
3+
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP
34
//
45
// SPDX-License-Identifier: BSD-2-Clause-Patent
56
//
@@ -573,7 +574,7 @@ func TestDaosServer_Auto_confGen(t *testing.T) {
573574
}
574575
return x.Equals(y)
575576
}),
576-
cmpopts.IgnoreUnexported(security.CertificateConfig{}),
577+
cmpopts.IgnoreUnexported(security.CertificateConfig{}, config.Server{}),
577578
}
578579

579580
if diff := cmp.Diff(tc.expCfg, gotCfg, cmpOpts...); diff != "" {

src/control/cmd/daos_server/start_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//
22
// (C) Copyright 2019-2024 Intel Corporation.
3+
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP
34
//
45
// SPDX-License-Identifier: BSD-2-Clause-Patent
56
//
@@ -261,6 +262,7 @@ func TestStartOptions(t *testing.T) {
261262
cmpOpts := []cmp.Option{
262263
cmpopts.IgnoreUnexported(
263264
security.CertificateConfig{},
265+
config.Server{},
264266
),
265267
cmpopts.SortSlices(func(a, b string) bool { return a < b }),
266268
}

src/control/cmd/dmg/auto_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//
22
// (C) Copyright 2020-2024 Intel Corporation.
3+
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP
34
//
45
// SPDX-License-Identifier: BSD-2-Clause-Patent
56
//
@@ -520,7 +521,8 @@ func TestAuto_confGen(t *testing.T) {
520521
}
521522
return x.Equals(y)
522523
}),
523-
cmpopts.IgnoreUnexported(security.CertificateConfig{}),
524+
cmpopts.IgnoreUnexported(security.CertificateConfig{},
525+
config.Server{}),
524526
}
525527

526528
if diff := cmp.Diff(tc.expCfg, gotCfg, cmpOpts...); diff != "" {
@@ -586,7 +588,7 @@ engines:
586588
pinned_numa_node: 1
587589
disable_vfio: false
588590
disable_vmd: false
589-
enable_hotplug: false
591+
disable_hotplug: false
590592
nr_hugepages: 0
591593
system_ram_reserved: 16
592594
disable_hugepages: false
@@ -608,6 +610,7 @@ hyperthreads: false
608610
WithFabricProvider("ofi+verbs").
609611
WithAccessPoints("hostX:10002").
610612
WithDisableVMD(false).
613+
WithDisableHotplug(false).
611614
WithEngines(
612615
engine.MockConfig().
613616
WithTargetCount(defaultTargetCount).

src/control/fault/code/codes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ const (
197197
ServerConfigScmDiffClass
198198
ServerConfigEngineBdevRolesMismatch
199199
ServerConfigSysRsvdZero
200+
ServerConfigEnableHotplugDeprecated
200201
)
201202

202203
// SPDK library bindings codes

src/control/lib/control/auto_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//
22
// (C) Copyright 2020-2024 Intel Corporation.
3+
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP
34
//
45
// SPDX-License-Identifier: BSD-2-Clause-Patent
56
//
@@ -1772,7 +1773,8 @@ func TestControl_AutoConfig_genServerConfig(t *testing.T) {
17721773
}
17731774
return x.Equals(y)
17741775
}),
1775-
cmpopts.IgnoreUnexported(security.CertificateConfig{}),
1776+
cmpopts.IgnoreUnexported(security.CertificateConfig{},
1777+
config.Server{}),
17761778
}
17771779
cmpOpts = append(cmpOpts, defResCmpOpts()...)
17781780

src/control/lib/control/mocks.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ func MockServerCfg(provider string, ecs []*engine.Config) *config.Server {
829829
WithControlLogFile(defaultControlLogFile).
830830
WithFabricProvider(provider).
831831
WithDisableVMD(false).
832+
WithDisableHotplug(false).
832833
WithEngines(ecs...)
833834
}
834835

src/control/server/config/faults.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//
22
// (C) Copyright 2020-2024 Intel Corporation.
3+
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP
34
//
45
// SPDX-License-Identifier: BSD-2-Clause-Patent
56
//
@@ -111,6 +112,11 @@ var (
111112
"`system_ram_reserved` is set to zero in server config",
112113
"set `system_ram_reserved` to a positive integer value in config",
113114
)
115+
FaultConfigEnableHotplugDeprecated = serverConfigFault(
116+
code.ServerConfigEnableHotplugDeprecated,
117+
"'enable_hotplug' setting is deprecated and no longer supported",
118+
"set 'disable_hotplug: true' in server config file to disable hotplug",
119+
)
114120
)
115121

116122
func FaultConfigDuplicateFabric(curIdx, seenIdx int) *fault.Fault {

src/control/server/config/server.go

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//
22
// (C) Copyright 2020-2024 Intel Corporation.
3+
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP
34
//
45
// SPDX-License-Identifier: BSD-2-Clause-Patent
56
//
@@ -36,6 +37,10 @@ const (
3637
relConfExamplesPath = "../utils/config/examples/"
3738
)
3839

40+
type deprecatedParams struct {
41+
EnableHotplug *bool `yaml:"enable_hotplug,omitempty"` // deprecated in 2.6.5
42+
}
43+
3944
// Server describes configuration options for DAOS control plane.
4045
// See utils/config/daos_server.yml for parameter descriptions.
4146
type Server struct {
@@ -46,7 +51,7 @@ type Server struct {
4651
BdevExclude []string `yaml:"bdev_exclude,omitempty"`
4752
DisableVFIO bool `yaml:"disable_vfio"`
4853
DisableVMD *bool `yaml:"disable_vmd"`
49-
EnableHotplug bool `yaml:"enable_hotplug"`
54+
DisableHotplug *bool `yaml:"disable_hotplug"`
5055
NrHugepages int `yaml:"nr_hugepages"` // total for all engines
5156
SystemRamReserved int `yaml:"system_ram_reserved"` // total for all engines
5257
DisableHugepages bool `yaml:"disable_hugepages"`
@@ -78,6 +83,8 @@ type Server struct {
7883

7984
// Behavior flags
8085
AutoFormat bool `yaml:"-"`
86+
87+
deprecatedParams `yaml:",inline"`
8188
}
8289

8390
// WithCoreDumpFilter sets the core dump filter written to /proc/self/coredump_filter.
@@ -182,7 +189,10 @@ func (cfg *Server) updateServerConfig(cfgPtr **engine.Config) {
182189
engineCfg.SystemName = cfg.SystemName
183190
engineCfg.SocketDir = cfg.SocketDir
184191
engineCfg.Modules = cfg.Modules
185-
engineCfg.Storage.EnableHotplug = cfg.EnableHotplug
192+
engineCfg.Storage.EnableHotplug = true
193+
if cfg.DisableHotplug != nil && *cfg.DisableHotplug {
194+
engineCfg.Storage.EnableHotplug = false
195+
}
186196
}
187197

188198
// WithEngines sets the list of engine configurations.
@@ -245,9 +255,9 @@ func (cfg *Server) WithDisableVMD(disabled bool) *Server {
245255
return cfg
246256
}
247257

248-
// WithEnableHotplug can be used to enable hotplug
249-
func (cfg *Server) WithEnableHotplug(enabled bool) *Server {
250-
cfg.EnableHotplug = enabled
258+
// WithDisableHotplug can be used to disable hotplug.
259+
func (cfg *Server) WithDisableHotplug(disabled bool) *Server {
260+
cfg.DisableHotplug = &disabled
251261
return cfg
252262
}
253263

@@ -325,7 +335,6 @@ func DefaultServer() *Server {
325335
SystemRamReserved: storage.DefaultSysMemRsvd / humanize.GiByte,
326336
Path: defaultConfigPath,
327337
ControlLogMask: common.ControlLogLevel(logging.LogLevelInfo),
328-
EnableHotplug: false, // disabled by default
329338
// https://man7.org/linux/man-pages/man5/core.5.html
330339
CoreDumpFilter: 0b00010011, // private, shared, ELF
331340
}
@@ -639,13 +648,36 @@ func (cfg *Server) Validate(log logging.Logger) (err error) {
639648
}
640649
}()
641650

651+
if cfg.deprecatedParams.EnableHotplug != nil {
652+
// Fail if conflicting EnableHotplug and DisableHotplug both set.
653+
if cfg.DisableHotplug != nil {
654+
return FaultConfigEnableHotplugDeprecated
655+
}
656+
log.Notice("enable_hotplug is deprecated; please use disable_hotplug instead " +
657+
"(false by default)")
658+
659+
// Apply deprecated parameter updates.
660+
eh := !*cfg.deprecatedParams.EnableHotplug
661+
cfg.DisableHotplug = &eh
662+
log.Debugf("deprecated param update: enable_hotplug: %v -> disable_hotplug: %v",
663+
*cfg.deprecatedParams.EnableHotplug, *cfg.DisableHotplug)
664+
}
665+
// Set DisableHotplug reference if unset in config file.
666+
if cfg.DisableHotplug == nil {
667+
cfg.WithDisableHotplug(false)
668+
}
669+
642670
// Set DisableVMD reference if unset in config file.
643671
if cfg.DisableVMD == nil {
644672
cfg.WithDisableVMD(false)
645673
}
646674

675+
for i := range cfg.Engines {
676+
cfg.updateServerConfig(&cfg.Engines[i])
677+
}
678+
647679
log.Debugf("vfio=%v hotplug=%v vmd=%v requested in config", !cfg.DisableVFIO,
648-
cfg.EnableHotplug, !(*cfg.DisableVMD))
680+
!(*cfg.DisableHotplug), !(*cfg.DisableVMD))
649681

650682
// Update access point addresses with control port if port is not supplied.
651683
newAPs := make([]string, 0, len(cfg.AccessPoints))

src/control/server/config/server_test.go

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//
22
// (C) Copyright 2020-2024 Intel Corporation.
3+
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP
34
//
45
// SPDX-License-Identifier: BSD-2-Clause-Patent
56
//
@@ -23,6 +24,7 @@ import (
2324
"github.com/google/go-cmp/cmp/cmpopts"
2425
"github.com/pkg/errors"
2526

27+
"github.com/daos-stack/daos/src/control/build"
2628
"github.com/daos-stack/daos/src/control/common"
2729
"github.com/daos-stack/daos/src/control/common/test"
2830
"github.com/daos-stack/daos/src/control/logging"
@@ -239,9 +241,9 @@ func TestServerConfig_Constructed(t *testing.T) {
239241
DevicePath: "/dev/sdb1",
240242
}).
241243
WithBdevExclude("0000:81:00.1").
242-
WithDisableVFIO(true). // vfio enabled by default
243-
WithDisableVMD(true). // vmd enabled by default
244-
WithEnableHotplug(true). // hotplug disabled by default
244+
WithDisableVFIO(true). // vfio enabled by default
245+
WithDisableVMD(true). // vmd enabled by default
246+
WithDisableHotplug(true). // hotplug enabled by default
245247
WithControlLogMask(common.ControlLogLevelError).
246248
WithControlLogFile("/tmp/daos_server.log").
247249
WithHelperLogFile("/tmp/daos_server_helper.log").
@@ -288,7 +290,7 @@ func TestServerConfig_Constructed(t *testing.T) {
288290
WithEnvVars("CRT_TIMEOUT=30").
289291
WithLogFile("/tmp/daos_engine.0.log").
290292
WithLogMask("INFO").
291-
WithStorageEnableHotplug(true).
293+
WithStorageEnableHotplug(false).
292294
WithStorageAutoFaultyCriteria(true, 100, 200),
293295
engine.MockConfig().
294296
WithSystemName("daos_server").
@@ -315,7 +317,7 @@ func TestServerConfig_Constructed(t *testing.T) {
315317
WithEnvVars("CRT_TIMEOUT=100").
316318
WithLogFile("/tmp/daos_engine.1.log").
317319
WithLogMask("INFO").
318-
WithStorageEnableHotplug(true).
320+
WithStorageEnableHotplug(false).
319321
WithStorageAutoFaultyCriteria(false, 0, 0),
320322
}
321323
constructed.Path = testFile // just to avoid failing the cmp
@@ -345,10 +347,9 @@ func TestServerConfig_updateServerConfig(t *testing.T) {
345347
},
346348
"basic": {
347349
cfg: &Server{
348-
SystemName: "name",
349-
SocketDir: "socketdir",
350-
Modules: "modules",
351-
EnableHotplug: true,
350+
SystemName: "name",
351+
SocketDir: "socketdir",
352+
Modules: "modules",
352353
Fabric: engine.FabricConfig{
353354
Provider: "provider",
354355
Interface: "iface",
@@ -381,6 +382,9 @@ func TestServerConfig_updateServerConfig(t *testing.T) {
381382
},
382383
expEngCfg: &engine.Config{
383384
SystemName: "name",
385+
Storage: storage.Config{
386+
EnableHotplug: true,
387+
},
384388
Fabric: engine.FabricConfig{
385389
Provider: "p1 p2 p3",
386390
NumSecondaryEndpoints: []int{2, 3, 4},
@@ -444,6 +448,7 @@ func TestServerConfig_MDonSSD_Constructed(t *testing.T) {
444448
WithBdevDeviceList("0000:83:00.0").
445449
WithBdevDeviceRoles(storage.BdevRoleData),
446450
).
451+
WithStorageEnableHotplug(true).
447452
WithFabricInterface("ib0").
448453
WithFabricInterfacePort(31316).
449454
WithFabricProvider("ofi+tcp").
@@ -1566,6 +1571,31 @@ func TestServerConfig_Parsing(t *testing.T) {
15661571
return nil
15671572
},
15681573
},
1574+
"enable_hotplug and disable_hotplug both set": {
1575+
inTxt: "disable_hugepages: false",
1576+
outTxt: "enable_hotplug: true",
1577+
expValidateErr: FaultConfigEnableHotplugDeprecated,
1578+
},
1579+
"enable_hotplug false setting allowed": {
1580+
inTxt: "disable_hotplug: true",
1581+
outTxt: "enable_hotplug: false",
1582+
expCheck: func(c *Server) error {
1583+
if c.Engines[0].Storage.EnableHotplug {
1584+
return errors.New("expecting hotplug to be disabled")
1585+
}
1586+
return nil
1587+
},
1588+
},
1589+
"enable_hotplug true setting allowed": {
1590+
inTxt: "disable_hotplug: true",
1591+
outTxt: "enable_hotplug: true",
1592+
expCheck: func(c *Server) error {
1593+
if !c.Engines[0].Storage.EnableHotplug {
1594+
return errors.New("expecting hotplug to be enabled")
1595+
}
1596+
return nil
1597+
},
1598+
},
15691599
} {
15701600
t.Run(name, func(t *testing.T) {
15711601
log, buf := logging.NewTestLogger(t.Name())
@@ -1671,7 +1701,8 @@ func TestServerConfig_WithEnginesInheritsMain(t *testing.T) {
16711701
WithFabricProvider(testFabric).
16721702
WithModules(testModules).
16731703
WithSocketDir(testSocketDir).
1674-
WithSystemName(testSystemName)
1704+
WithSystemName(testSystemName).
1705+
WithStorageEnableHotplug(true)
16751706

16761707
config := DefaultServer().
16771708
WithFabricProvider(testFabric).
@@ -1830,6 +1861,8 @@ func TestServerConfig_validateMultiEngineConfig(t *testing.T) {
18301861

18311862
conf := DefaultServer().
18321863
WithFabricProvider("test").
1864+
WithAccessPoints(
1865+
fmt.Sprintf("localhost:%d", build.DefaultControlPort)).
18331866
WithEngines(tc.configA, tc.configB)
18341867

18351868
gotErr := conf.Validate(log)

utils/config/daos_server.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,14 @@
158158
#disable_vmd: true
159159
#
160160
#
161-
## Enable NVMe SSD Hotplug
161+
## Disable NVMe SSD Hotplug
162162
#
163-
## When hotplug is enabled, io engine will periodically check device hot
163+
## NVMe SSD hotplug is enabled by default but can be optionally disabled.
164+
## When enabled io engine will periodically check device hot
164165
## plug/remove event, and setup/teardown the device automatically.
165166
#
166167
## default: false
167-
#enable_hotplug: true
168+
#disable_hotplug: true
168169
#
169170
#
170171
## Use Hyperthreads

0 commit comments

Comments
 (0)