LCOW: Re-coalesce stores

Signed-off-by: John Howard <jhoward@microsoft.com>

The re-coalesces the daemon stores which were split as part of the
original LCOW implementation.

This is part of the work discussed in https://github.com/moby/moby/issues/34617,
in particular see the document linked to in that issue.
This commit is contained in:
John Howard
2017-08-24 11:48:16 -07:00
parent 6feae06003
commit ce8e529e18
66 changed files with 549 additions and 635 deletions

View File

@@ -180,17 +180,17 @@ func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str
parent = new(image.Image)
parent.RootFS = image.NewRootFS()
} else {
parent, err = daemon.stores[container.OS].imageStore.Get(container.ImageID)
parent, err = daemon.imageStore.Get(container.ImageID)
if err != nil {
return "", err
}
}
l, err := daemon.stores[container.OS].layerStore.Register(rwTar, parent.RootFS.ChainID(), layer.OS(container.OS))
l, err := daemon.layerStore.Register(rwTar, parent.RootFS.ChainID(), container.OS)
if err != nil {
return "", err
}
defer layer.ReleaseAndLog(daemon.stores[container.OS].layerStore, l)
defer layer.ReleaseAndLog(daemon.layerStore, l)
containerConfig := c.ContainerConfig
if containerConfig == nil {
@@ -209,13 +209,13 @@ func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str
return "", err
}
id, err := daemon.stores[container.OS].imageStore.Create(config)
id, err := daemon.imageStore.Create(config)
if err != nil {
return "", err
}
if container.ImageID != "" {
if err := daemon.stores[container.OS].imageStore.SetParent(id, container.ImageID); err != nil {
if err := daemon.imageStore.SetParent(id, container.ImageID); err != nil {
return "", err
}
}
@@ -234,7 +234,7 @@ func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str
return "", err
}
}
if err := daemon.TagImageWithReference(id, container.OS, newTag); err != nil {
if err := daemon.TagImageWithReference(id, newTag); err != nil {
return "", err
}
imageRef = reference.FamiliarString(newTag)