Browse code

Move reload-related functions to reload.go

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2018/01/16 00:18:22
Showing 4 changed files
... ...
@@ -4,7 +4,6 @@ package daemon
4 4
 
5 5
 import (
6 6
 	"bufio"
7
-	"bytes"
8 7
 	"context"
9 8
 	"fmt"
10 9
 	"io/ioutil"
... ...
@@ -680,51 +679,6 @@ func (daemon *Daemon) initRuntimes(runtimes map[string]types.Runtime) (err error
680 680
 	return nil
681 681
 }
682 682
 
683
-// reloadPlatform updates configuration with platform specific options
684
-// and updates the passed attributes
685
-func (daemon *Daemon) reloadPlatform(conf *config.Config, attributes map[string]string) error {
686
-	if err := conf.ValidatePlatformConfig(); err != nil {
687
-		return err
688
-	}
689
-
690
-	if conf.IsValueSet("runtimes") {
691
-		// Always set the default one
692
-		conf.Runtimes[config.StockRuntimeName] = types.Runtime{Path: DefaultRuntimeBinary}
693
-		if err := daemon.initRuntimes(conf.Runtimes); err != nil {
694
-			return err
695
-		}
696
-		daemon.configStore.Runtimes = conf.Runtimes
697
-	}
698
-
699
-	if conf.DefaultRuntime != "" {
700
-		daemon.configStore.DefaultRuntime = conf.DefaultRuntime
701
-	}
702
-
703
-	if conf.IsValueSet("default-shm-size") {
704
-		daemon.configStore.ShmSize = conf.ShmSize
705
-	}
706
-
707
-	if conf.IpcMode != "" {
708
-		daemon.configStore.IpcMode = conf.IpcMode
709
-	}
710
-
711
-	// Update attributes
712
-	var runtimeList bytes.Buffer
713
-	for name, rt := range daemon.configStore.Runtimes {
714
-		if runtimeList.Len() > 0 {
715
-			runtimeList.WriteRune(' ')
716
-		}
717
-		runtimeList.WriteString(fmt.Sprintf("%s:%s", name, rt))
718
-	}
719
-
720
-	attributes["runtimes"] = runtimeList.String()
721
-	attributes["default-runtime"] = daemon.configStore.DefaultRuntime
722
-	attributes["default-shm-size"] = fmt.Sprintf("%d", daemon.configStore.ShmSize)
723
-	attributes["default-ipc-mode"] = daemon.configStore.IpcMode
724
-
725
-	return nil
726
-}
727
-
728 683
 // verifyDaemonSettings performs validation of daemon config struct
729 684
 func verifyDaemonSettings(conf *config.Config) error {
730 685
 	// Check for mutually incompatible config options
... ...
@@ -207,12 +207,6 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes.
207 207
 	return warnings, err
208 208
 }
209 209
 
210
-// reloadPlatform updates configuration with platform specific options
211
-// and updates the passed attributes
212
-func (daemon *Daemon) reloadPlatform(config *config.Config, attributes map[string]string) error {
213
-	return nil
214
-}
215
-
216 210
 // verifyDaemonSettings performs validation of daemon config struct
217 211
 func verifyDaemonSettings(config *config.Config) error {
218 212
 	return nil
219 213
new file mode 100644
... ...
@@ -0,0 +1,56 @@
0
+// +build linux freebsd
1
+
2
+package daemon
3
+
4
+import (
5
+	"bytes"
6
+	"fmt"
7
+
8
+	"github.com/docker/docker/api/types"
9
+	"github.com/docker/docker/daemon/config"
10
+)
11
+
12
+// reloadPlatform updates configuration with platform specific options
13
+// and updates the passed attributes
14
+func (daemon *Daemon) reloadPlatform(conf *config.Config, attributes map[string]string) error {
15
+	if err := conf.ValidatePlatformConfig(); err != nil {
16
+		return err
17
+	}
18
+
19
+	if conf.IsValueSet("runtimes") {
20
+		// Always set the default one
21
+		conf.Runtimes[config.StockRuntimeName] = types.Runtime{Path: DefaultRuntimeBinary}
22
+		if err := daemon.initRuntimes(conf.Runtimes); err != nil {
23
+			return err
24
+		}
25
+		daemon.configStore.Runtimes = conf.Runtimes
26
+	}
27
+
28
+	if conf.DefaultRuntime != "" {
29
+		daemon.configStore.DefaultRuntime = conf.DefaultRuntime
30
+	}
31
+
32
+	if conf.IsValueSet("default-shm-size") {
33
+		daemon.configStore.ShmSize = conf.ShmSize
34
+	}
35
+
36
+	if conf.IpcMode != "" {
37
+		daemon.configStore.IpcMode = conf.IpcMode
38
+	}
39
+
40
+	// Update attributes
41
+	var runtimeList bytes.Buffer
42
+	for name, rt := range daemon.configStore.Runtimes {
43
+		if runtimeList.Len() > 0 {
44
+			runtimeList.WriteRune(' ')
45
+		}
46
+		runtimeList.WriteString(fmt.Sprintf("%s:%s", name, rt))
47
+	}
48
+
49
+	attributes["runtimes"] = runtimeList.String()
50
+	attributes["default-runtime"] = daemon.configStore.DefaultRuntime
51
+	attributes["default-shm-size"] = fmt.Sprintf("%d", daemon.configStore.ShmSize)
52
+	attributes["default-ipc-mode"] = daemon.configStore.IpcMode
53
+
54
+	return nil
55
+}
0 56
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+package daemon
1
+
2
+import "github.com/docker/docker/daemon/config"
3
+
4
+// reloadPlatform updates configuration with platform specific options
5
+// and updates the passed attributes
6
+func (daemon *Daemon) reloadPlatform(config *config.Config, attributes map[string]string) error {
7
+	return nil
8
+}