Move Config and HostConfig from runconfig to types/container.
- Make the API client library completely standalone. - Move windows partition isolation detection to the client, so the driver doesn't use external types. Signed-off-by: David Calavera <david.calavera@gmail.com> Upstream-commit: 7ac4232e70fe7cf7318333cd0890db7f95663079 Component: engine
This commit is contained in:
@ -11,6 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/daemon/exec"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/daemon/logger"
|
||||
@ -43,7 +44,7 @@ type CommonContainer struct {
|
||||
Created time.Time
|
||||
Path string
|
||||
Args []string
|
||||
Config *runconfig.Config
|
||||
Config *containertypes.Config
|
||||
ImageID image.ID `json:"Image"`
|
||||
NetworkSettings *network.Settings
|
||||
LogPath string
|
||||
@ -56,8 +57,8 @@ type CommonContainer struct {
|
||||
HasBeenStartedBefore bool
|
||||
HasBeenManuallyStopped bool // used for unless-stopped restart policy
|
||||
MountPoints map[string]*volume.MountPoint
|
||||
HostConfig *runconfig.HostConfig `json:"-"` // do not serialize the host config in the json, otherwise we'll make the container unportable
|
||||
Command *execdriver.Command `json:"-"`
|
||||
HostConfig *containertypes.HostConfig `json:"-"` // do not serialize the host config in the json, otherwise we'll make the container unportable
|
||||
Command *execdriver.Command `json:"-"`
|
||||
monitor *containerMonitor
|
||||
ExecCommands *exec.Store `json:"-"`
|
||||
// logDriver for closing
|
||||
@ -139,7 +140,7 @@ func (container *Container) ToDiskLocking() error {
|
||||
|
||||
// readHostConfig reads the host configuration from disk for the container.
|
||||
func (container *Container) readHostConfig() error {
|
||||
container.HostConfig = &runconfig.HostConfig{}
|
||||
container.HostConfig = &containertypes.HostConfig{}
|
||||
// If the hostconfig file does not exist, do not read it.
|
||||
// (We still have to initialize container.HostConfig,
|
||||
// but that's OK, since we just did that above.)
|
||||
@ -261,7 +262,7 @@ func (container *Container) exposes(p nat.Port) bool {
|
||||
}
|
||||
|
||||
// GetLogConfig returns the log configuration for the container.
|
||||
func (container *Container) GetLogConfig(defaultConfig runconfig.LogConfig) runconfig.LogConfig {
|
||||
func (container *Container) GetLogConfig(defaultConfig containertypes.LogConfig) containertypes.LogConfig {
|
||||
cfg := container.HostConfig.LogConfig
|
||||
if cfg.Type != "" || len(cfg.Config) > 0 { // container has log driver configured
|
||||
if cfg.Type == "" {
|
||||
@ -274,7 +275,7 @@ func (container *Container) GetLogConfig(defaultConfig runconfig.LogConfig) runc
|
||||
}
|
||||
|
||||
// StartLogger starts a new logger driver for the container.
|
||||
func (container *Container) StartLogger(cfg runconfig.LogConfig) (logger.Logger, error) {
|
||||
func (container *Container) StartLogger(cfg containertypes.LogConfig) (logger.Logger, error) {
|
||||
c, err := logger.GetLogDriver(cfg.Type)
|
||||
if err != nil {
|
||||
return nil, derr.ErrorCodeLoggingFactory.WithArgs(err)
|
||||
|
||||
@ -3,14 +3,14 @@ package container
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/pkg/signal"
|
||||
"github.com/docker/docker/runconfig"
|
||||
)
|
||||
|
||||
func TestContainerStopSignal(t *testing.T) {
|
||||
c := &Container{
|
||||
CommonContainer: CommonContainer{
|
||||
Config: &runconfig.Config{},
|
||||
Config: &container.Config{},
|
||||
},
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ func TestContainerStopSignal(t *testing.T) {
|
||||
|
||||
c = &Container{
|
||||
CommonContainer: CommonContainer{
|
||||
Config: &runconfig.Config{StopSignal: "SIGKILL"},
|
||||
Config: &container.Config{StopSignal: "SIGKILL"},
|
||||
},
|
||||
}
|
||||
s = c.StopSignal()
|
||||
|
||||
@ -9,11 +9,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/pkg/promise"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/docker/runconfig"
|
||||
"github.com/docker/docker/utils"
|
||||
)
|
||||
|
||||
@ -51,7 +51,7 @@ type containerMonitor struct {
|
||||
container *Container
|
||||
|
||||
// restartPolicy is the current policy being applied to the container monitor
|
||||
restartPolicy runconfig.RestartPolicy
|
||||
restartPolicy container.RestartPolicy
|
||||
|
||||
// failureCount is the number of times the container has failed to
|
||||
// start in a row
|
||||
@ -79,7 +79,7 @@ type containerMonitor struct {
|
||||
|
||||
// StartMonitor initializes a containerMonitor for this container with the provided supervisor and restart policy
|
||||
// and starts the container's process.
|
||||
func (container *Container) StartMonitor(s supervisor, policy runconfig.RestartPolicy) error {
|
||||
func (container *Container) StartMonitor(s supervisor, policy container.RestartPolicy) error {
|
||||
container.monitor = &containerMonitor{
|
||||
supervisor: s,
|
||||
container: container,
|
||||
|
||||
Reference in New Issue
Block a user