Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Kenfe-Mickael Laventure authored on 2016/07/28 00:30:15... | ... |
@@ -72,7 +72,7 @@ func (cli *DaemonCli) getPlatformRemoteOptions() []libcontainerd.RemoteOption { |
72 | 72 |
args := []string{"--systemd-cgroup=true"} |
73 | 73 |
opts = append(opts, libcontainerd.WithRuntimeArgs(args)) |
74 | 74 |
} |
75 |
- if cli.Config.LiveRestore { |
|
75 |
+ if cli.Config.LiveRestoreEnabled { |
|
76 | 76 |
opts = append(opts, libcontainerd.WithLiveRestore(true)) |
77 | 77 |
} |
78 | 78 |
opts = append(opts, libcontainerd.WithRuntimePath(daemon.DefaultRuntimeBinary)) |
... | ... |
@@ -94,7 +94,10 @@ type CommonConfig struct { |
94 | 94 |
TrustKeyPath string `json:"-"` |
95 | 95 |
CorsHeaders string `json:"api-cors-header,omitempty"` |
96 | 96 |
EnableCors bool `json:"api-enable-cors,omitempty"` |
97 |
- LiveRestore bool `json:"live-restore,omitempty"` |
|
97 |
+ |
|
98 |
+ // LiveRestoreEnabled determines whether we should keep containers |
|
99 |
+ // alive upon daemon shutdown/start |
|
100 |
+ LiveRestoreEnabled bool `json:"live-restore,omitempty"` |
|
98 | 101 |
|
99 | 102 |
// ClusterStore is the storage backend used for the cluster information. It is used by both |
100 | 103 |
// multihost networking (to store networks and endpoints information) and by the node discovery |
... | ... |
@@ -87,7 +87,7 @@ func (config *Config) InstallFlags(cmd *flag.FlagSet, usageFn func(string) strin |
87 | 87 |
cmd.StringVar(&config.CgroupParent, []string{"-cgroup-parent"}, "", usageFn("Set parent cgroup for all containers")) |
88 | 88 |
cmd.StringVar(&config.RemappedRoot, []string{"-userns-remap"}, "", usageFn("User/Group setting for user namespaces")) |
89 | 89 |
cmd.StringVar(&config.ContainerdAddr, []string{"-containerd"}, "", usageFn("Path to containerd socket")) |
90 |
- cmd.BoolVar(&config.LiveRestore, []string{"-live-restore"}, false, usageFn("Enable live restore of docker when containers are still running")) |
|
90 |
+ cmd.BoolVar(&config.LiveRestoreEnabled, []string{"-live-restore"}, false, usageFn("Enable live restore of docker when containers are still running")) |
|
91 | 91 |
config.Runtimes = make(map[string]types.Runtime) |
92 | 92 |
cmd.Var(runconfigopts.NewNamedRuntimeOpt("runtimes", &config.Runtimes, stockRuntimeName), []string{"-add-runtime"}, usageFn("Register an additional OCI compatible runtime")) |
93 | 93 |
cmd.StringVar(&config.DefaultRuntime, []string{"-default-runtime"}, stockRuntimeName, usageFn("Default OCI runtime for containers")) |
... | ... |
@@ -133,7 +133,7 @@ func (config *Config) isSwarmCompatible() error { |
133 | 133 |
if config.ClusterStore != "" || config.ClusterAdvertise != "" { |
134 | 134 |
return fmt.Errorf("--cluster-store and --cluster-advertise daemon configurations are incompatible with swarm mode") |
135 | 135 |
} |
136 |
- if config.LiveRestore { |
|
136 |
+ if config.LiveRestoreEnabled { |
|
137 | 137 |
return fmt.Errorf("--live-restore daemon configuration is incompatible with swarm mode") |
138 | 138 |
} |
139 | 139 |
return nil |
... | ... |
@@ -658,7 +658,7 @@ func (daemon *Daemon) Shutdown() error { |
658 | 658 |
|
659 | 659 |
pluginShutdown() |
660 | 660 |
|
661 |
- if daemon.configStore.LiveRestore && daemon.containers != nil { |
|
661 |
+ if daemon.configStore.LiveRestoreEnabled && daemon.containers != nil { |
|
662 | 662 |
// check if there are any running containers, if none we should do some cleanup |
663 | 663 |
if ls, err := daemon.Containers(&types.ContainerListOptions{}); len(ls) != 0 || err != nil { |
664 | 664 |
return nil |
... | ... |
@@ -916,8 +916,8 @@ func (daemon *Daemon) Reload(config *Config) error { |
916 | 916 |
daemon.configStore.Debug = config.Debug |
917 | 917 |
} |
918 | 918 |
if config.IsValueSet("live-restore") { |
919 |
- daemon.configStore.LiveRestore = config.LiveRestore |
|
920 |
- if err := daemon.containerdRemote.UpdateOptions(libcontainerd.WithLiveRestore(config.LiveRestore)); err != nil { |
|
919 |
+ daemon.configStore.LiveRestoreEnabled = config.LiveRestoreEnabled |
|
920 |
+ if err := daemon.containerdRemote.UpdateOptions(libcontainerd.WithLiveRestore(config.LiveRestoreEnabled)); err != nil { |
|
921 | 921 |
return err |
922 | 922 |
} |
923 | 923 |
|
... | ... |
@@ -1076,7 +1076,7 @@ func (daemon *Daemon) networkOptions(dconfig *Config, activeSandboxes map[string |
1076 | 1076 |
options = append(options, nwconfig.OptionLabels(dconfig.Labels)) |
1077 | 1077 |
options = append(options, driverOptions(dconfig)...) |
1078 | 1078 |
|
1079 |
- if daemon.configStore != nil && daemon.configStore.LiveRestore && len(activeSandboxes) != 0 { |
|
1079 |
+ if daemon.configStore != nil && daemon.configStore.LiveRestoreEnabled && len(activeSandboxes) != 0 { |
|
1080 | 1080 |
options = append(options, nwconfig.OptionActiveSandboxes(activeSandboxes)) |
1081 | 1081 |
} |
1082 | 1082 |
|
... | ... |
@@ -13,7 +13,7 @@ func (daemon *Daemon) verifyExperimentalContainerSettings(hostConfig *container. |
13 | 13 |
} |
14 | 14 |
|
15 | 15 |
func pluginInit(d *Daemon, cfg *Config, remote libcontainerd.Remote) error { |
16 |
- return plugin.Init(cfg.Root, remote, d.RegistryService, cfg.LiveRestore, d.LogPluginEvent) |
|
16 |
+ return plugin.Init(cfg.Root, remote, d.RegistryService, cfg.LiveRestoreEnabled, d.LogPluginEvent) |
|
17 | 17 |
} |
18 | 18 |
|
19 | 19 |
func pluginShutdown() { |