mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #36303 from dnephin/cleanup-in-daemon-unix
Cleanup unnecessary and duplicate functions in `daemon_unix.go`
This commit is contained in:
commit
747c163a65
5 changed files with 19 additions and 35 deletions
|
@ -266,7 +266,7 @@ func (daemon *Daemon) setRWLayer(container *container.Container) error {
|
|||
|
||||
rwLayerOpts := &layer.CreateRWLayerOpts{
|
||||
MountLabel: container.MountLabel,
|
||||
InitFunc: daemon.getLayerInit(),
|
||||
InitFunc: setupInitLayer(daemon.idMappings),
|
||||
StorageOpt: container.HostConfig.StorageOpt,
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ import (
|
|||
"github.com/sirupsen/logrus"
|
||||
// register graph drivers
|
||||
_ "github.com/docker/docker/daemon/graphdriver/register"
|
||||
"github.com/docker/docker/daemon/initlayer"
|
||||
"github.com/docker/docker/daemon/stats"
|
||||
dmetadata "github.com/docker/docker/distribution/metadata"
|
||||
"github.com/docker/docker/distribution/xfer"
|
||||
|
@ -41,7 +40,6 @@ import (
|
|||
"github.com/docker/docker/layer"
|
||||
"github.com/docker/docker/libcontainerd"
|
||||
"github.com/docker/docker/migrate/v1"
|
||||
"github.com/docker/docker/pkg/containerfs"
|
||||
"github.com/docker/docker/pkg/idtools"
|
||||
"github.com/docker/docker/pkg/locker"
|
||||
"github.com/docker/docker/pkg/plugingetter"
|
||||
|
@ -1141,11 +1139,6 @@ func prepareTempDir(rootDir string, rootIDs idtools.IDPair) (string, error) {
|
|||
return tmpDir, idtools.MkdirAllAndChown(tmpDir, 0700, rootIDs)
|
||||
}
|
||||
|
||||
func (daemon *Daemon) setupInitLayer(initPath containerfs.ContainerFS) error {
|
||||
rootIDs := daemon.idMappings.RootPair()
|
||||
return initlayer.Setup(initPath, rootIDs)
|
||||
}
|
||||
|
||||
func (daemon *Daemon) setGenericResources(conf *config.Config) error {
|
||||
genericResources, err := config.ParseGenericResources(conf.NodeGenericResources)
|
||||
if err != nil {
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/daemon/config"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/daemon/initlayer"
|
||||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/docker/pkg/containerfs"
|
||||
"github.com/docker/docker/pkg/idtools"
|
||||
|
@ -1000,8 +1000,10 @@ func removeDefaultBridgeInterface() {
|
|||
}
|
||||
}
|
||||
|
||||
func (daemon *Daemon) getLayerInit() func(containerfs.ContainerFS) error {
|
||||
return daemon.setupInitLayer
|
||||
func setupInitLayer(idMappings *idtools.IDMappings) func(containerfs.ContainerFS) error {
|
||||
return func(initPath containerfs.ContainerFS) error {
|
||||
return initlayer.Setup(initPath, idMappings.RootPair())
|
||||
}
|
||||
}
|
||||
|
||||
// Parse the remapped root (user namespace) option, which can be one of:
|
||||
|
@ -1357,17 +1359,6 @@ func (daemon *Daemon) setDefaultIsolation() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func rootFSToAPIType(rootfs *image.RootFS) types.RootFS {
|
||||
var layers []string
|
||||
for _, l := range rootfs.DiffIDs {
|
||||
layers = append(layers, l.String())
|
||||
}
|
||||
return types.RootFS{
|
||||
Type: rootfs.Type,
|
||||
Layers: layers,
|
||||
}
|
||||
}
|
||||
|
||||
// setupDaemonProcess sets various settings for the daemon's process
|
||||
func setupDaemonProcess(config *config.Config) error {
|
||||
// setup the daemons oom_score_adj
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/daemon/config"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/pkg/containerfs"
|
||||
"github.com/docker/docker/pkg/fileutils"
|
||||
"github.com/docker/docker/pkg/idtools"
|
||||
|
@ -54,7 +53,7 @@ func parseSecurityOpt(container *container.Container, config *containertypes.Hos
|
|||
return nil
|
||||
}
|
||||
|
||||
func (daemon *Daemon) getLayerInit() func(containerfs.ContainerFS) error {
|
||||
func setupInitLayer(idMappings *idtools.IDMappings) func(containerfs.ContainerFS) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -629,17 +628,6 @@ func (daemon *Daemon) setDefaultIsolation() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func rootFSToAPIType(rootfs *image.RootFS) types.RootFS {
|
||||
var layers []string
|
||||
for _, l := range rootfs.DiffIDs {
|
||||
layers = append(layers, l.String())
|
||||
}
|
||||
return types.RootFS{
|
||||
Type: rootfs.Type,
|
||||
Layers: layers,
|
||||
}
|
||||
}
|
||||
|
||||
func setupDaemonProcess(config *config.Config) error {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
|
||||
"github.com/docker/distribution/reference"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/layer"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -90,3 +91,14 @@ func (daemon *Daemon) LookupImage(name string) (*types.ImageInspect, error) {
|
|||
|
||||
return imageInspect, nil
|
||||
}
|
||||
|
||||
func rootFSToAPIType(rootfs *image.RootFS) types.RootFS {
|
||||
var layers []string
|
||||
for _, l := range rootfs.DiffIDs {
|
||||
layers = append(layers, l.String())
|
||||
}
|
||||
return types.RootFS{
|
||||
Type: rootfs.Type,
|
||||
Layers: layers,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue