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 )
0 commit comments