libnetwork: drop (*Controller).ReloadConfiguration

...as it is unused.

Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
Cory Snider 2023-01-13 18:36:00 -05:00
parent 6c9dd8b650
commit 52d9883812

View file

@ -368,79 +368,6 @@ func (c *Controller) makeDriverConfig(ntype string) map[string]interface{} {
return cfg
}
var procReloadConfig = make(chan (bool), 1)
// ReloadConfiguration updates the controller configuration.
func (c *Controller) ReloadConfiguration(cfgOptions ...config.Option) error {
procReloadConfig <- true
defer func() { <-procReloadConfig }()
// For now we accept the configuration reload only as a mean to provide a global store config after boot.
// Refuse the configuration if it alters an existing datastore client configuration.
update := false
cfg := config.New(cfgOptions...)
for s := range c.cfg.Scopes {
if _, ok := cfg.Scopes[s]; !ok {
return types.ForbiddenErrorf("cannot accept new configuration because it removes an existing datastore client")
}
}
for s, nSCfg := range cfg.Scopes {
if eSCfg, ok := c.cfg.Scopes[s]; ok {
if eSCfg.Client.Provider != nSCfg.Client.Provider ||
eSCfg.Client.Address != nSCfg.Client.Address {
return types.ForbiddenErrorf("cannot accept new configuration because it modifies an existing datastore client")
}
} else {
if err := c.initScopedStore(s, nSCfg); err != nil {
return err
}
update = true
}
}
if !update {
return nil
}
c.mu.Lock()
c.cfg = cfg
c.mu.Unlock()
var dsConfig *discoverapi.DatastoreConfigData
for scope, sCfg := range cfg.Scopes {
if scope == datastore.LocalScope || !sCfg.IsValid() {
continue
}
dsConfig = &discoverapi.DatastoreConfigData{
Scope: scope,
Provider: sCfg.Client.Provider,
Address: sCfg.Client.Address,
Config: sCfg.Client.Config,
}
break
}
if dsConfig == nil {
return nil
}
c.drvRegistry.WalkIPAMs(func(name string, driver ipamapi.Ipam, cap *ipamapi.Capability) bool {
err := driver.DiscoverNew(discoverapi.DatastoreConfig, *dsConfig)
if err != nil {
logrus.Errorf("Failed to set datastore in driver %s: %v", name, err)
}
return false
})
c.drvRegistry.WalkDrivers(func(name string, driver driverapi.Driver, capability driverapi.Capability) bool {
err := driver.DiscoverNew(discoverapi.DatastoreConfig, *dsConfig)
if err != nil {
logrus.Errorf("Failed to set datastore in driver %s: %v", name, err)
}
return false
})
return nil
}
// ID returns the controller's unique identity.
func (c *Controller) ID() string {
return c.id