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

Merge pull request #26756 from rhvgoyal/init-rw-layer

layer_store: Use CreateReadWrite() for -init layer instead of Create()
This commit is contained in:
Michael Crosby 2016-09-21 15:45:06 -07:00 committed by GitHub
commit d2bc5d6276
4 changed files with 12 additions and 2 deletions

View file

@ -201,7 +201,9 @@ func (daemon *Daemon) setRWLayer(container *container.Container) error {
}
layerID = img.RootFS.ChainID()
}
rwLayer, err := daemon.layerStore.CreateRWLayer(container.ID, layerID, container.MountLabel, daemon.setupInitLayer, container.HostConfig.StorageOpt)
rwLayer, err := daemon.layerStore.CreateRWLayer(container.ID, layerID, container.MountLabel, daemon.getLayerInit(), container.HostConfig.StorageOpt)
if err != nil {
return err
}

View file

@ -779,6 +779,10 @@ func initBridgeDriver(controller libnetwork.NetworkController, config *Config) e
return nil
}
func (daemon *Daemon) getLayerInit() func(string) error {
return daemon.setupInitLayer
}
// setupInitLayer populates a directory with mountpoints suitable
// for bind-mounting things into the container.
//

View file

@ -61,6 +61,10 @@ func setupInitLayer(initLayer string, rootUID, rootGID int) error {
return nil
}
func (daemon *Daemon) getLayerInit() func(string) error {
return nil
}
func checkKernel() error {
return nil
}

View file

@ -586,7 +586,7 @@ func (ls *layerStore) initMount(graphID, parent, mountLabel string, initFunc Mou
// then the initID should be randomly generated.
initID := fmt.Sprintf("%s-init", graphID)
if err := ls.driver.Create(initID, parent, mountLabel, storageOpt); err != nil {
if err := ls.driver.CreateReadWrite(initID, parent, mountLabel, storageOpt); err != nil {
return "", err
}
p, err := ls.driver.Get(initID, "")