2018-02-05 21:05:59 +00:00
|
|
|
package daemon // import "github.com/docker/docker/daemon"
|
2017-01-07 14:30:25 +00:00
|
|
|
|
|
|
|
import (
|
2023-06-23 00:33:17 +00:00
|
|
|
"context"
|
2017-01-07 14:30:25 +00:00
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
2022-04-24 20:59:54 +00:00
|
|
|
"strconv"
|
2017-01-07 14:30:25 +00:00
|
|
|
|
2023-06-23 00:33:17 +00:00
|
|
|
"github.com/containerd/containerd/log"
|
2022-08-17 21:13:49 +00:00
|
|
|
"github.com/hashicorp/go-multierror"
|
|
|
|
"github.com/mitchellh/copystructure"
|
|
|
|
|
|
|
|
"github.com/docker/docker/daemon/config"
|
2017-01-07 14:30:25 +00:00
|
|
|
)
|
|
|
|
|
2022-08-17 21:13:49 +00:00
|
|
|
// reloadTxn is used to defer side effects of a config reload.
|
|
|
|
type reloadTxn struct {
|
|
|
|
onCommit, onRollback []func() error
|
|
|
|
}
|
|
|
|
|
|
|
|
// OnCommit defers a function to be called when a config reload is being finalized.
|
|
|
|
// The error returned from cb is purely informational.
|
|
|
|
func (tx *reloadTxn) OnCommit(cb func() error) {
|
|
|
|
tx.onCommit = append(tx.onCommit, cb)
|
|
|
|
}
|
|
|
|
|
|
|
|
// OnRollback defers a function to be called when a config reload is aborted.
|
|
|
|
// The error returned from cb is purely informational.
|
|
|
|
func (tx *reloadTxn) OnRollback(cb func() error) {
|
|
|
|
tx.onCommit = append(tx.onRollback, cb)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (tx *reloadTxn) run(cbs []func() error) error {
|
|
|
|
tx.onCommit = nil
|
|
|
|
tx.onRollback = nil
|
|
|
|
|
|
|
|
var res *multierror.Error
|
|
|
|
for _, cb := range cbs {
|
|
|
|
res = multierror.Append(res, cb())
|
|
|
|
}
|
|
|
|
return res.ErrorOrNil()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Commit calls all functions registered with OnCommit.
|
|
|
|
// Any errors returned by the functions are collated into a
|
|
|
|
// *github.com/hashicorp/go-multierror.Error value.
|
|
|
|
func (tx *reloadTxn) Commit() error {
|
|
|
|
return tx.run(tx.onCommit)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Rollback calls all functions registered with OnRollback.
|
|
|
|
// Any errors returned by the functions are collated into a
|
|
|
|
// *github.com/hashicorp/go-multierror.Error value.
|
|
|
|
func (tx *reloadTxn) Rollback() error {
|
|
|
|
return tx.run(tx.onRollback)
|
|
|
|
}
|
|
|
|
|
2022-08-17 17:33:21 +00:00
|
|
|
// Reload modifies the live daemon configuration from conf.
|
|
|
|
// conf is assumed to be a validated configuration.
|
|
|
|
//
|
2017-01-07 14:30:25 +00:00
|
|
|
// These are the settings that Reload changes:
|
|
|
|
// - Platform runtime
|
|
|
|
// - Daemon debug log level
|
|
|
|
// - Daemon max concurrent downloads
|
|
|
|
// - Daemon max concurrent uploads
|
2019-06-25 13:26:36 +00:00
|
|
|
// - Daemon max download attempts
|
2017-01-07 14:30:25 +00:00
|
|
|
// - Daemon shutdown timeout (in seconds)
|
|
|
|
// - Cluster discovery (reconfigure and restart)
|
|
|
|
// - Daemon labels
|
|
|
|
// - Insecure registries
|
|
|
|
// - Registry mirrors
|
|
|
|
// - Daemon live restore
|
2022-08-17 21:13:49 +00:00
|
|
|
func (daemon *Daemon) Reload(conf *config.Config) error {
|
|
|
|
daemon.configReload.Lock()
|
|
|
|
defer daemon.configReload.Unlock()
|
2022-08-31 20:12:30 +00:00
|
|
|
copied, err := copystructure.Copy(daemon.config().Config)
|
2022-08-17 21:13:49 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-08-31 20:12:30 +00:00
|
|
|
newCfg := &configStore{
|
|
|
|
Config: copied.(config.Config),
|
|
|
|
}
|
2017-01-07 14:30:25 +00:00
|
|
|
|
2022-08-17 21:13:49 +00:00
|
|
|
attributes := map[string]string{}
|
2017-01-07 14:30:25 +00:00
|
|
|
|
2022-08-17 17:33:21 +00:00
|
|
|
// Ideally reloading should be transactional: the reload either completes
|
|
|
|
// successfully, or the daemon config and state are left untouched. We use a
|
2022-08-17 21:13:49 +00:00
|
|
|
// two-phase commit protocol to achieve this. Any fallible reload operation is
|
|
|
|
// split into two phases. The first phase performs all the fallible operations
|
|
|
|
// and mutates the newCfg copy. The second phase atomically swaps newCfg into
|
|
|
|
// the live daemon configuration and executes any commit functions the first
|
|
|
|
// phase registered to apply the side effects. If any first-phase returns an
|
|
|
|
// error, the reload transaction is rolled back by discarding newCfg and
|
|
|
|
// executing any registered rollback functions.
|
|
|
|
|
|
|
|
var txn reloadTxn
|
2022-08-31 20:12:30 +00:00
|
|
|
for _, reload := range []func(txn *reloadTxn, newCfg *configStore, conf *config.Config, attributes map[string]string) error{
|
2022-08-17 17:33:21 +00:00
|
|
|
daemon.reloadPlatform,
|
2022-08-17 21:13:49 +00:00
|
|
|
daemon.reloadDebug,
|
|
|
|
daemon.reloadMaxConcurrentDownloadsAndUploads,
|
|
|
|
daemon.reloadMaxDownloadAttempts,
|
|
|
|
daemon.reloadShutdownTimeout,
|
|
|
|
daemon.reloadFeatures,
|
|
|
|
daemon.reloadLabels,
|
2022-08-17 17:33:21 +00:00
|
|
|
daemon.reloadRegistryConfig,
|
2022-08-17 21:13:49 +00:00
|
|
|
daemon.reloadLiveRestore,
|
|
|
|
daemon.reloadNetworkDiagnosticPort,
|
2022-08-17 17:33:21 +00:00
|
|
|
} {
|
2022-08-17 21:13:49 +00:00
|
|
|
if err := reload(&txn, newCfg, conf, attributes); err != nil {
|
|
|
|
if rollbackErr := txn.Rollback(); rollbackErr != nil {
|
|
|
|
return multierror.Append(nil, err, rollbackErr)
|
|
|
|
}
|
2022-08-17 17:33:21 +00:00
|
|
|
return err
|
|
|
|
}
|
Implement none, private, and shareable ipc modes
Since the commit d88fe447df0e8 ("Add support for sharing /dev/shm/ and
/dev/mqueue between containers") container's /dev/shm is mounted on the
host first, then bind-mounted inside the container. This is done that
way in order to be able to share this container's IPC namespace
(and the /dev/shm mount point) with another container.
Unfortunately, this functionality breaks container checkpoint/restore
(even if IPC is not shared). Since /dev/shm is an external mount, its
contents is not saved by `criu checkpoint`, and so upon restore any
application that tries to access data under /dev/shm is severily
disappointed (which usually results in a fatal crash).
This commit solves the issue by introducing new IPC modes for containers
(in addition to 'host' and 'container:ID'). The new modes are:
- 'shareable': enables sharing this container's IPC with others
(this used to be the implicit default);
- 'private': disables sharing this container's IPC.
In 'private' mode, container's /dev/shm is truly mounted inside the
container, without any bind-mounting from the host, which solves the
issue.
While at it, let's also implement 'none' mode. The motivation, as
eloquently put by Justin Cormack, is:
> I wondered a while back about having a none shm mode, as currently it is
> not possible to have a totally unwriteable container as there is always
> a /dev/shm writeable mount. It is a bit of a niche case (and clearly
> should never be allowed to be daemon default) but it would be trivial to
> add now so maybe we should...
...so here's yet yet another mode:
- 'none': no /dev/shm mount inside the container (though it still
has its own private IPC namespace).
Now, to ultimately solve the abovementioned checkpoint/restore issue, we'd
need to make 'private' the default mode, but unfortunately it breaks the
backward compatibility. So, let's make the default container IPC mode
per-daemon configurable (with the built-in default set to 'shareable'
for now). The default can be changed either via a daemon CLI option
(--default-shm-mode) or a daemon.json configuration file parameter
of the same name.
Note one can only set either 'shareable' or 'private' IPC modes as a
daemon default (i.e. in this context 'host', 'container', or 'none'
do not make much sense).
Some other changes this patch introduces are:
1. A mount for /dev/shm is added to default OCI Linux spec.
2. IpcMode.Valid() is simplified to remove duplicated code that parsed
'container:ID' form. Note the old version used to check that ID does
not contain a semicolon -- this is no longer the case (tests are
modified accordingly). The motivation is we should either do a
proper check for container ID validity, or don't check it at all
(since it is checked in other places anyway). I chose the latter.
3. IpcMode.Container() is modified to not return container ID if the
mode value does not start with "container:", unifying the check to
be the same as in IpcMode.IsContainer().
3. IPC mode unit tests (runconfig/hostconfig_test.go) are modified
to add checks for newly added values.
[v2: addressed review at https://github.com/moby/moby/pull/34087#pullrequestreview-51345997]
[v3: addressed review at https://github.com/moby/moby/pull/34087#pullrequestreview-53902833]
[v4: addressed the case of upgrading from older daemon, in this case
container.HostConfig.IpcMode is unset and this is valid]
[v5: document old and new IpcMode values in api/swagger.yaml]
[v6: add the 'none' mode, changelog entry to docs/api/version-history.md]
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2017-06-27 21:58:50 +00:00
|
|
|
}
|
2022-08-17 17:33:21 +00:00
|
|
|
|
2022-08-17 21:13:49 +00:00
|
|
|
jsonString, _ := json.Marshal(&struct {
|
|
|
|
*config.Config
|
|
|
|
config.Proxies `json:"proxies"`
|
|
|
|
}{
|
2022-08-31 20:12:30 +00:00
|
|
|
Config: &newCfg.Config,
|
2022-08-17 21:13:49 +00:00
|
|
|
Proxies: config.Proxies{
|
|
|
|
HTTPProxy: config.MaskCredentials(newCfg.HTTPProxy),
|
|
|
|
HTTPSProxy: config.MaskCredentials(newCfg.HTTPSProxy),
|
|
|
|
NoProxy: config.MaskCredentials(newCfg.NoProxy),
|
|
|
|
},
|
|
|
|
})
|
2023-06-23 00:33:17 +00:00
|
|
|
log.G(context.TODO()).Infof("Reloaded configuration: %s", jsonString)
|
2022-08-17 21:13:49 +00:00
|
|
|
daemon.configStore.Store(newCfg)
|
|
|
|
daemon.LogDaemonEventWithAttributes("reload", attributes)
|
|
|
|
return txn.Commit()
|
2022-08-17 17:33:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func marshalAttributeSlice(v []string) string {
|
|
|
|
if v == nil {
|
|
|
|
return "[]"
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
2022-08-17 17:33:21 +00:00
|
|
|
b, err := json.Marshal(v)
|
|
|
|
if err != nil {
|
|
|
|
panic(err) // Should never happen as the input type is fixed.
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
2022-08-17 17:33:21 +00:00
|
|
|
return string(b)
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// reloadDebug updates configuration with Debug option
|
|
|
|
// and updates the passed attributes
|
2022-08-31 20:12:30 +00:00
|
|
|
func (daemon *Daemon) reloadDebug(txn *reloadTxn, newCfg *configStore, conf *config.Config, attributes map[string]string) error {
|
2017-01-07 14:30:25 +00:00
|
|
|
// update corresponding configuration
|
|
|
|
if conf.IsValueSet("debug") {
|
2022-08-17 21:13:49 +00:00
|
|
|
newCfg.Debug = conf.Debug
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
|
|
|
// prepare reload event attributes with updatable configurations
|
2022-08-17 21:13:49 +00:00
|
|
|
attributes["debug"] = strconv.FormatBool(newCfg.Debug)
|
|
|
|
return nil
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
|
|
|
|
2017-05-21 23:24:07 +00:00
|
|
|
// reloadMaxConcurrentDownloadsAndUploads updates configuration with max concurrent
|
2017-01-07 14:30:25 +00:00
|
|
|
// download and upload options and updates the passed attributes
|
2022-08-31 20:12:30 +00:00
|
|
|
func (daemon *Daemon) reloadMaxConcurrentDownloadsAndUploads(txn *reloadTxn, newCfg *configStore, conf *config.Config, attributes map[string]string) error {
|
2017-01-07 14:30:25 +00:00
|
|
|
// We always "reset" as the cost is lightweight and easy to maintain.
|
2022-08-17 21:13:49 +00:00
|
|
|
newCfg.MaxConcurrentDownloads = config.DefaultMaxConcurrentDownloads
|
|
|
|
newCfg.MaxConcurrentUploads = config.DefaultMaxConcurrentUploads
|
2017-01-07 14:30:25 +00:00
|
|
|
|
2022-04-24 20:59:54 +00:00
|
|
|
if conf.IsValueSet("max-concurrent-downloads") && conf.MaxConcurrentDownloads != 0 {
|
2022-08-17 21:13:49 +00:00
|
|
|
newCfg.MaxConcurrentDownloads = conf.MaxConcurrentDownloads
|
2022-04-24 20:59:54 +00:00
|
|
|
}
|
|
|
|
if conf.IsValueSet("max-concurrent-uploads") && conf.MaxConcurrentUploads != 0 {
|
2022-08-17 21:13:49 +00:00
|
|
|
newCfg.MaxConcurrentUploads = conf.MaxConcurrentUploads
|
2019-01-10 14:34:02 +00:00
|
|
|
}
|
2022-08-17 21:13:49 +00:00
|
|
|
txn.OnCommit(func() error {
|
|
|
|
if daemon.imageService != nil {
|
|
|
|
daemon.imageService.UpdateConfig(
|
|
|
|
newCfg.MaxConcurrentDownloads,
|
|
|
|
newCfg.MaxConcurrentUploads,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
})
|
2019-01-10 14:34:02 +00:00
|
|
|
|
2018-02-07 20:52:47 +00:00
|
|
|
// prepare reload event attributes with updatable configurations
|
2022-08-17 21:13:49 +00:00
|
|
|
attributes["max-concurrent-downloads"] = strconv.Itoa(newCfg.MaxConcurrentDownloads)
|
|
|
|
attributes["max-concurrent-uploads"] = strconv.Itoa(newCfg.MaxConcurrentUploads)
|
2023-06-23 00:33:17 +00:00
|
|
|
log.G(context.TODO()).Debug("Reset Max Concurrent Downloads: ", attributes["max-concurrent-downloads"])
|
|
|
|
log.G(context.TODO()).Debug("Reset Max Concurrent Uploads: ", attributes["max-concurrent-uploads"])
|
2022-08-17 21:13:49 +00:00
|
|
|
return nil
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
|
|
|
|
2019-06-25 13:26:36 +00:00
|
|
|
// reloadMaxDownloadAttempts updates configuration with max concurrent
|
|
|
|
// download attempts when a connection is lost and updates the passed attributes
|
2022-08-31 20:12:30 +00:00
|
|
|
func (daemon *Daemon) reloadMaxDownloadAttempts(txn *reloadTxn, newCfg *configStore, conf *config.Config, attributes map[string]string) error {
|
2019-06-25 13:26:36 +00:00
|
|
|
// We always "reset" as the cost is lightweight and easy to maintain.
|
2022-08-17 21:13:49 +00:00
|
|
|
newCfg.MaxDownloadAttempts = config.DefaultDownloadAttempts
|
2022-04-24 20:59:54 +00:00
|
|
|
if conf.IsValueSet("max-download-attempts") && conf.MaxDownloadAttempts != 0 {
|
2022-08-17 21:13:49 +00:00
|
|
|
newCfg.MaxDownloadAttempts = conf.MaxDownloadAttempts
|
2019-06-25 13:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// prepare reload event attributes with updatable configurations
|
2022-08-17 21:13:49 +00:00
|
|
|
attributes["max-download-attempts"] = strconv.Itoa(newCfg.MaxDownloadAttempts)
|
2023-06-23 00:33:17 +00:00
|
|
|
log.G(context.TODO()).Debug("Reset Max Download Attempts: ", attributes["max-download-attempts"])
|
2022-08-17 21:13:49 +00:00
|
|
|
return nil
|
2019-06-25 13:26:36 +00:00
|
|
|
}
|
|
|
|
|
2017-01-07 14:30:25 +00:00
|
|
|
// reloadShutdownTimeout updates configuration with daemon shutdown timeout option
|
|
|
|
// and updates the passed attributes
|
2022-08-31 20:12:30 +00:00
|
|
|
func (daemon *Daemon) reloadShutdownTimeout(txn *reloadTxn, newCfg *configStore, conf *config.Config, attributes map[string]string) error {
|
2017-01-07 14:30:25 +00:00
|
|
|
// update corresponding configuration
|
|
|
|
if conf.IsValueSet("shutdown-timeout") {
|
2022-08-17 21:13:49 +00:00
|
|
|
newCfg.ShutdownTimeout = conf.ShutdownTimeout
|
2023-06-23 00:33:17 +00:00
|
|
|
log.G(context.TODO()).Debugf("Reset Shutdown Timeout: %d", newCfg.ShutdownTimeout)
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// prepare reload event attributes with updatable configurations
|
2022-08-17 21:13:49 +00:00
|
|
|
attributes["shutdown-timeout"] = strconv.Itoa(newCfg.ShutdownTimeout)
|
|
|
|
return nil
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// reloadLabels updates configuration with engine labels
|
|
|
|
// and updates the passed attributes
|
2022-08-31 20:12:30 +00:00
|
|
|
func (daemon *Daemon) reloadLabels(txn *reloadTxn, newCfg *configStore, conf *config.Config, attributes map[string]string) error {
|
2017-01-07 14:30:25 +00:00
|
|
|
// update corresponding configuration
|
|
|
|
if conf.IsValueSet("labels") {
|
2022-08-17 21:13:49 +00:00
|
|
|
newCfg.Labels = conf.Labels
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// prepare reload event attributes with updatable configurations
|
2022-08-17 21:13:49 +00:00
|
|
|
attributes["labels"] = marshalAttributeSlice(newCfg.Labels)
|
|
|
|
return nil
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
|
|
|
|
2022-08-17 17:33:21 +00:00
|
|
|
// reloadRegistryConfig updates the configuration with registry options
|
2017-05-09 21:00:31 +00:00
|
|
|
// and updates the passed attributes.
|
2022-08-31 20:12:30 +00:00
|
|
|
func (daemon *Daemon) reloadRegistryConfig(txn *reloadTxn, newCfg *configStore, conf *config.Config, attributes map[string]string) error {
|
2017-05-09 21:00:31 +00:00
|
|
|
// Update corresponding configuration.
|
2022-08-17 17:33:21 +00:00
|
|
|
if conf.IsValueSet("allow-nondistributable-artifacts") {
|
2022-08-17 21:13:49 +00:00
|
|
|
newCfg.ServiceOptions.AllowNondistributableArtifacts = conf.AllowNondistributableArtifacts
|
2017-05-09 21:00:31 +00:00
|
|
|
}
|
2017-01-07 14:30:25 +00:00
|
|
|
if conf.IsValueSet("insecure-registries") {
|
2022-08-17 21:13:49 +00:00
|
|
|
newCfg.ServiceOptions.InsecureRegistries = conf.InsecureRegistries
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
|
|
|
if conf.IsValueSet("registry-mirrors") {
|
2022-08-17 21:13:49 +00:00
|
|
|
newCfg.ServiceOptions.Mirrors = conf.Mirrors
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
|
|
|
|
2022-08-17 21:13:49 +00:00
|
|
|
commit, err := daemon.registryService.ReplaceConfig(newCfg.ServiceOptions)
|
2022-08-17 17:33:21 +00:00
|
|
|
if err != nil {
|
2022-08-17 21:13:49 +00:00
|
|
|
return err
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
2022-08-17 21:13:49 +00:00
|
|
|
txn.OnCommit(func() error { commit(); return nil })
|
|
|
|
|
|
|
|
attributes["allow-nondistributable-artifacts"] = marshalAttributeSlice(newCfg.ServiceOptions.AllowNondistributableArtifacts)
|
|
|
|
attributes["insecure-registries"] = marshalAttributeSlice(newCfg.ServiceOptions.InsecureRegistries)
|
|
|
|
attributes["registry-mirrors"] = marshalAttributeSlice(newCfg.ServiceOptions.Mirrors)
|
2017-01-07 14:30:25 +00:00
|
|
|
|
2022-08-17 21:13:49 +00:00
|
|
|
return nil
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
|
|
|
|
2018-09-07 05:55:31 +00:00
|
|
|
// reloadLiveRestore updates configuration with live restore option
|
2017-01-07 14:30:25 +00:00
|
|
|
// and updates the passed attributes
|
2022-08-31 20:12:30 +00:00
|
|
|
func (daemon *Daemon) reloadLiveRestore(txn *reloadTxn, newCfg *configStore, conf *config.Config, attributes map[string]string) error {
|
2017-01-07 14:30:25 +00:00
|
|
|
// update corresponding configuration
|
|
|
|
if conf.IsValueSet("live-restore") {
|
2022-08-17 21:13:49 +00:00
|
|
|
newCfg.LiveRestoreEnabled = conf.LiveRestoreEnabled
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// prepare reload event attributes with updatable configurations
|
2022-08-17 21:13:49 +00:00
|
|
|
attributes["live-restore"] = strconv.FormatBool(newCfg.LiveRestoreEnabled)
|
|
|
|
return nil
|
2017-01-07 14:30:25 +00:00
|
|
|
}
|
2017-12-01 19:24:14 +00:00
|
|
|
|
2018-01-29 19:19:37 +00:00
|
|
|
// reloadNetworkDiagnosticPort updates the network controller starting the diagnostic if the config is valid
|
2022-08-31 20:12:30 +00:00
|
|
|
func (daemon *Daemon) reloadNetworkDiagnosticPort(txn *reloadTxn, newCfg *configStore, conf *config.Config, attributes map[string]string) error {
|
2022-08-17 21:13:49 +00:00
|
|
|
txn.OnCommit(func() error {
|
|
|
|
if conf == nil || daemon.netController == nil || !conf.IsValueSet("network-diagnostic-port") ||
|
|
|
|
conf.NetworkDiagnosticPort < 1 || conf.NetworkDiagnosticPort > 65535 {
|
|
|
|
// If there is no config make sure that the diagnostic is off
|
|
|
|
if daemon.netController != nil {
|
|
|
|
daemon.netController.StopDiagnostic()
|
|
|
|
}
|
|
|
|
return nil
|
2018-01-29 19:19:37 +00:00
|
|
|
}
|
2022-08-17 21:13:49 +00:00
|
|
|
// Enable the network diagnostic if the flag is set with a valid port within the range
|
2023-07-30 15:18:56 +00:00
|
|
|
log.G(context.TODO()).WithFields(log.Fields{"port": conf.NetworkDiagnosticPort, "ip": "127.0.0.1"}).Warn("Starting network diagnostic server")
|
2022-08-17 21:13:49 +00:00
|
|
|
daemon.netController.StartDiagnostic(conf.NetworkDiagnosticPort)
|
|
|
|
return nil
|
|
|
|
})
|
|
|
|
return nil
|
2017-12-01 19:24:14 +00:00
|
|
|
}
|
2018-08-22 06:05:26 +00:00
|
|
|
|
|
|
|
// reloadFeatures updates configuration with enabled/disabled features
|
2022-08-31 20:12:30 +00:00
|
|
|
func (daemon *Daemon) reloadFeatures(txn *reloadTxn, newCfg *configStore, conf *config.Config, attributes map[string]string) error {
|
2018-08-22 06:05:26 +00:00
|
|
|
// update corresponding configuration
|
|
|
|
// note that we allow features option to be entirely unset
|
2022-08-17 21:13:49 +00:00
|
|
|
newCfg.Features = conf.Features
|
2018-08-22 06:05:26 +00:00
|
|
|
|
|
|
|
// prepare reload event attributes with updatable configurations
|
2022-08-17 21:13:49 +00:00
|
|
|
attributes["features"] = fmt.Sprintf("%v", newCfg.Features)
|
|
|
|
return nil
|
2018-08-22 06:05:26 +00:00
|
|
|
}
|