1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

only Daemon.load needs to call label.ReserveLabel

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
This commit is contained in:
Fabio Kung 2017-04-05 17:37:04 -07:00
parent edad52707c
commit 9134e87afc
3 changed files with 6 additions and 6 deletions

View file

@ -45,7 +45,6 @@ import (
"github.com/docker/libnetwork/options"
"github.com/docker/libnetwork/types"
agentexec "github.com/docker/swarmkit/agent/exec"
"github.com/opencontainers/selinux/go-selinux/label"
)
const configFileName = "config.v2.json"
@ -152,9 +151,6 @@ func (container *Container) FromDisk() error {
container.Platform = runtime.GOOS
}
if err := label.ReserveLabel(container.ProcessLabel); err != nil {
return err
}
return container.readHostConfig()
}

View file

@ -95,7 +95,7 @@ func (db *memDB) Save(c *Container) error {
txn := db.store.Txn(true)
defer txn.Commit()
deepCopy := NewBaseContainer(c.ID, c.Root)
err := deepCopy.FromDisk() // TODO: deal with reserveLabel
err := deepCopy.FromDisk()
if err != nil {
return err
}

View file

@ -18,6 +18,7 @@ import (
"github.com/docker/docker/pkg/truncindex"
"github.com/docker/docker/runconfig"
"github.com/docker/go-connections/nat"
"github.com/opencontainers/selinux/go-selinux/label"
)
// GetContainer looks for a container using the provided information, which could be
@ -90,6 +91,9 @@ func (daemon *Daemon) load(id string) (*container.Container, error) {
if err := container.FromDisk(); err != nil {
return nil, err
}
if err := label.ReserveLabel(container.ProcessLabel); err != nil {
return nil, err
}
if container.ID != id {
return container, fmt.Errorf("Container %s is stored at %s", container.ID, id)
@ -307,7 +311,7 @@ func (daemon *Daemon) verifyContainerSettings(hostConfig *containertypes.HostCon
return nil, fmt.Errorf("maximum retry count cannot be negative")
}
case "":
// do nothing
// do nothing
default:
return nil, fmt.Errorf("invalid restart policy '%s'", p.Name)
}