Browse code

libnetwork: drop (*Controller).ReloadConfiguration

...as it is unused.

Signed-off-by: Cory Snider <csnider@mirantis.com>

Cory Snider authored on 2023/01/14 08:36:00
Showing 1 changed files
... ...
@@ -368,79 +368,6 @@ func (c *Controller) makeDriverConfig(ntype string) map[string]interface{} {
368 368
 	return cfg
369 369
 }
370 370
 
371
-var procReloadConfig = make(chan (bool), 1)
372
-
373
-// ReloadConfiguration updates the controller configuration.
374
-func (c *Controller) ReloadConfiguration(cfgOptions ...config.Option) error {
375
-	procReloadConfig <- true
376
-	defer func() { <-procReloadConfig }()
377
-
378
-	// For now we accept the configuration reload only as a mean to provide a global store config after boot.
379
-	// Refuse the configuration if it alters an existing datastore client configuration.
380
-	update := false
381
-	cfg := config.New(cfgOptions...)
382
-
383
-	for s := range c.cfg.Scopes {
384
-		if _, ok := cfg.Scopes[s]; !ok {
385
-			return types.ForbiddenErrorf("cannot accept new configuration because it removes an existing datastore client")
386
-		}
387
-	}
388
-	for s, nSCfg := range cfg.Scopes {
389
-		if eSCfg, ok := c.cfg.Scopes[s]; ok {
390
-			if eSCfg.Client.Provider != nSCfg.Client.Provider ||
391
-				eSCfg.Client.Address != nSCfg.Client.Address {
392
-				return types.ForbiddenErrorf("cannot accept new configuration because it modifies an existing datastore client")
393
-			}
394
-		} else {
395
-			if err := c.initScopedStore(s, nSCfg); err != nil {
396
-				return err
397
-			}
398
-			update = true
399
-		}
400
-	}
401
-	if !update {
402
-		return nil
403
-	}
404
-
405
-	c.mu.Lock()
406
-	c.cfg = cfg
407
-	c.mu.Unlock()
408
-
409
-	var dsConfig *discoverapi.DatastoreConfigData
410
-	for scope, sCfg := range cfg.Scopes {
411
-		if scope == datastore.LocalScope || !sCfg.IsValid() {
412
-			continue
413
-		}
414
-		dsConfig = &discoverapi.DatastoreConfigData{
415
-			Scope:    scope,
416
-			Provider: sCfg.Client.Provider,
417
-			Address:  sCfg.Client.Address,
418
-			Config:   sCfg.Client.Config,
419
-		}
420
-		break
421
-	}
422
-	if dsConfig == nil {
423
-		return nil
424
-	}
425
-
426
-	c.drvRegistry.WalkIPAMs(func(name string, driver ipamapi.Ipam, cap *ipamapi.Capability) bool {
427
-		err := driver.DiscoverNew(discoverapi.DatastoreConfig, *dsConfig)
428
-		if err != nil {
429
-			logrus.Errorf("Failed to set datastore in driver %s: %v", name, err)
430
-		}
431
-		return false
432
-	})
433
-
434
-	c.drvRegistry.WalkDrivers(func(name string, driver driverapi.Driver, capability driverapi.Capability) bool {
435
-		err := driver.DiscoverNew(discoverapi.DatastoreConfig, *dsConfig)
436
-		if err != nil {
437
-			logrus.Errorf("Failed to set datastore in driver %s: %v", name, err)
438
-		}
439
-		return false
440
-	})
441
-	return nil
442
-}
443
-
444 371
 // ID returns the controller's unique identity.
445 372
 func (c *Controller) ID() string {
446 373
 	return c.id