Merge component 'engine' from git@github.com:moby/moby master
This commit is contained in:
@@ -44,29 +44,29 @@ func (d *Daemon) ExecExists(name string) (bool, error) {
|
||||
// with the exec instance is stopped or paused, it will return an error.
|
||||
func (d *Daemon) getExecConfig(name string) (*exec.Config, error) {
|
||||
ec := d.execCommands.Get(name)
|
||||
if ec == nil {
|
||||
return nil, errExecNotFound(name)
|
||||
}
|
||||
|
||||
// If the exec is found but its container is not in the daemon's list of
|
||||
// containers then it must have been deleted, in which case instead of
|
||||
// saying the container isn't running, we should return a 404 so that
|
||||
// the user sees the same error now that they will after the
|
||||
// 5 minute clean-up loop is run which erases old/dead execs.
|
||||
|
||||
if ec != nil {
|
||||
if container := d.containers.Get(ec.ContainerID); container != nil {
|
||||
if !container.IsRunning() {
|
||||
return nil, fmt.Errorf("Container %s is not running: %s", container.ID, container.State.String())
|
||||
}
|
||||
if container.IsPaused() {
|
||||
return nil, errExecPaused(container.ID)
|
||||
}
|
||||
if container.IsRestarting() {
|
||||
return nil, errContainerIsRestarting(container.ID)
|
||||
}
|
||||
return ec, nil
|
||||
}
|
||||
container := d.containers.Get(ec.ContainerID)
|
||||
if container == nil {
|
||||
return nil, containerNotFound(name)
|
||||
}
|
||||
|
||||
return nil, errExecNotFound(name)
|
||||
if !container.IsRunning() {
|
||||
return nil, fmt.Errorf("Container %s is not running: %s", container.ID, container.State.String())
|
||||
}
|
||||
if container.IsPaused() {
|
||||
return nil, errExecPaused(container.ID)
|
||||
}
|
||||
if container.IsRestarting() {
|
||||
return nil, errContainerIsRestarting(container.ID)
|
||||
}
|
||||
return ec, nil
|
||||
}
|
||||
|
||||
func (d *Daemon) unregisterExecCommand(container *container.Container, execConfig *exec.Config) {
|
||||
|
||||
@@ -163,7 +163,7 @@ func (f *fluentd) Log(msg *logger.Message) error {
|
||||
for k, v := range f.extra {
|
||||
data[k] = v
|
||||
}
|
||||
if msg.Partial {
|
||||
if msg.PLogMetaData != nil {
|
||||
data["partial_message"] = "true"
|
||||
}
|
||||
|
||||
|
||||
@@ -405,13 +405,7 @@ func getSourceMount(source string) (string, string, error) {
|
||||
idx = i
|
||||
}
|
||||
}
|
||||
// and return it unless it's "/"
|
||||
if mi[idx].Mountpoint != "/" {
|
||||
return mi[idx].Mountpoint, mi[idx].Optional, nil
|
||||
}
|
||||
|
||||
// If we are here, we did not find parent mount. Something is wrong.
|
||||
return "", "", fmt.Errorf("Could not find source mount of %s", source)
|
||||
return mi[idx].Mountpoint, mi[idx].Optional, nil
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package daemon // import "github.com/docker/docker/daemon"
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
@@ -86,3 +87,16 @@ func TestIpcPrivateVsReadonly(t *testing.T) {
|
||||
assert.Check(t, is.Equal(false, inSlice(m.Options, "ro")))
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetSourceMount(t *testing.T) {
|
||||
// must be able to find source mount for /
|
||||
mnt, _, err := getSourceMount("/")
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, mnt, "/")
|
||||
|
||||
// must be able to find source mount for current directory
|
||||
cwd, err := os.Getwd()
|
||||
assert.NilError(t, err)
|
||||
_, _, err = getSourceMount(cwd)
|
||||
assert.NilError(t, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user