mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
layer: remove OS from layerstore
This was added in commitsfc21bf280b
and0380fbff37
in support of LCOW, but was now always set to runtime.GOOS. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
da277f891a
commit
b36d896fce
6 changed files with 10 additions and 19 deletions
|
@ -948,7 +948,6 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
|
||||||
IDMapping: idMapping,
|
IDMapping: idMapping,
|
||||||
PluginGetter: d.PluginStore,
|
PluginGetter: d.PluginStore,
|
||||||
ExperimentalEnabled: config.Experimental,
|
ExperimentalEnabled: config.Experimental,
|
||||||
OS: runtime.GOOS,
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
@ -53,7 +52,6 @@ func TestRemoveImageGarbageCollector(t *testing.T) {
|
||||||
IDMapping: &idtools.IdentityMapping{},
|
IDMapping: &idtools.IdentityMapping{},
|
||||||
PluginGetter: nil,
|
PluginGetter: nil,
|
||||||
ExperimentalEnabled: false,
|
ExperimentalEnabled: false,
|
||||||
OS: runtime.GOOS,
|
|
||||||
})
|
})
|
||||||
i := images.NewImageService(images.ImageServiceConfig{
|
i := images.NewImageService(images.ImageServiceConfig{
|
||||||
LayerStore: layerStore,
|
LayerStore: layerStore,
|
||||||
|
|
|
@ -41,8 +41,6 @@ type layerStore struct {
|
||||||
|
|
||||||
// protect *RWLayer() methods from operating on the same name/id
|
// protect *RWLayer() methods from operating on the same name/id
|
||||||
locker *locker.Locker
|
locker *locker.Locker
|
||||||
|
|
||||||
os string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// StoreOptions are the options used to create a new Store instance
|
// StoreOptions are the options used to create a new Store instance
|
||||||
|
@ -54,7 +52,6 @@ type StoreOptions struct {
|
||||||
IDMapping *idtools.IdentityMapping
|
IDMapping *idtools.IdentityMapping
|
||||||
PluginGetter plugingetter.PluginGetter
|
PluginGetter plugingetter.PluginGetter
|
||||||
ExperimentalEnabled bool
|
ExperimentalEnabled bool
|
||||||
OS string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewStoreFromOptions creates a new Store instance
|
// NewStoreFromOptions creates a new Store instance
|
||||||
|
@ -73,16 +70,13 @@ func NewStoreFromOptions(options StoreOptions) (Store, error) {
|
||||||
|
|
||||||
root := fmt.Sprintf(options.MetadataStorePathTemplate, driver)
|
root := fmt.Sprintf(options.MetadataStorePathTemplate, driver)
|
||||||
|
|
||||||
return newStoreFromGraphDriver(root, driver, options.OS)
|
return newStoreFromGraphDriver(root, driver)
|
||||||
}
|
}
|
||||||
|
|
||||||
// newStoreFromGraphDriver creates a new Store instance using the provided
|
// newStoreFromGraphDriver creates a new Store instance using the provided
|
||||||
// metadata store and graph driver. The metadata store will be used to restore
|
// metadata store and graph driver. The metadata store will be used to restore
|
||||||
// the Store.
|
// the Store.
|
||||||
func newStoreFromGraphDriver(root string, driver graphdriver.Driver, os string) (Store, error) {
|
func newStoreFromGraphDriver(root string, driver graphdriver.Driver) (Store, error) {
|
||||||
if !system.IsOSSupported(os) {
|
|
||||||
return nil, fmt.Errorf("failed to initialize layer store as operating system '%s' is not supported", os)
|
|
||||||
}
|
|
||||||
caps := graphdriver.Capabilities{}
|
caps := graphdriver.Capabilities{}
|
||||||
if capDriver, ok := driver.(graphdriver.CapabilityDriver); ok {
|
if capDriver, ok := driver.(graphdriver.CapabilityDriver); ok {
|
||||||
caps = capDriver.Capabilities()
|
caps = capDriver.Capabilities()
|
||||||
|
@ -100,7 +94,6 @@ func newStoreFromGraphDriver(root string, driver graphdriver.Driver, os string)
|
||||||
mounts: map[string]*mountedLayer{},
|
mounts: map[string]*mountedLayer{},
|
||||||
locker: locker.New(),
|
locker: locker.New(),
|
||||||
useTarSplit: !caps.ReproducesExactDiffs,
|
useTarSplit: !caps.ReproducesExactDiffs,
|
||||||
os: os,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ids, mounts, err := ms.List()
|
ids, mounts, err := ms.List()
|
||||||
|
@ -168,8 +161,8 @@ func (ls *layerStore) loadLayer(layer ChainID) (*roLayer, error) {
|
||||||
return nil, fmt.Errorf("failed to get operating system for %s: %s", layer, err)
|
return nil, fmt.Errorf("failed to get operating system for %s: %s", layer, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if os != ls.os {
|
if !system.IsOSSupported(os) {
|
||||||
return nil, fmt.Errorf("failed to load layer with os %s into layerstore for %s", os, ls.os)
|
return nil, fmt.Errorf("failed to load layer with os %s into layerstore: %w", os, system.ErrNotSupportedOperatingSystem)
|
||||||
}
|
}
|
||||||
|
|
||||||
cl = &roLayer{
|
cl = &roLayer{
|
||||||
|
|
|
@ -69,7 +69,7 @@ func newTestStore(t *testing.T) (Store, string, func()) {
|
||||||
|
|
||||||
graph, graphcleanup := newTestGraphDriver(t)
|
graph, graphcleanup := newTestGraphDriver(t)
|
||||||
|
|
||||||
ls, err := newStoreFromGraphDriver(td, graph, runtime.GOOS)
|
ls, err := newStoreFromGraphDriver(td, graph)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ func TestStoreRestore(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ls2, err := newStoreFromGraphDriver(ls.(*layerStore).store.root, ls.(*layerStore).driver, runtime.GOOS)
|
ls2, err := newStoreFromGraphDriver(ls.(*layerStore).store.root, ls.(*layerStore).driver)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ func TestLayerMigration(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
root := filepath.Join(td, "layers")
|
root := filepath.Join(td, "layers")
|
||||||
ls, err := newStoreFromGraphDriver(root, graph, runtime.GOOS)
|
ls, err := newStoreFromGraphDriver(root, graph)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ func TestLayerMigrationNoTarsplit(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
root := filepath.Join(td, "layers")
|
root := filepath.Join(td, "layers")
|
||||||
ls, err := newStoreFromGraphDriver(root, graph, runtime.GOOS)
|
ls, err := newStoreFromGraphDriver(root, graph)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package layer // import "github.com/docker/docker/layer"
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"github.com/docker/distribution"
|
"github.com/docker/distribution"
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
|
@ -146,7 +147,7 @@ func storeLayer(tx *fileMetadataTransaction, layer *roLayer) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tx.setOS(layer.layerStore.os)
|
return tx.setOS(runtime.GOOS)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newVerifiedReadCloser(rc io.ReadCloser, dgst digest.Digest) (io.ReadCloser, error) {
|
func newVerifiedReadCloser(rc io.ReadCloser, dgst digest.Digest) (io.ReadCloser, error) {
|
||||||
|
|
Loading…
Reference in a new issue