diff options
-rw-r--r-- | libpod/boltdb_state_internal.go | 18 | ||||
-rw-r--r-- | libpod/container.go | 8 | ||||
-rw-r--r-- | libpod/container_darwin.go | 14 | ||||
-rw-r--r-- | libpod/container_linux.go | 10 | ||||
-rw-r--r-- | libpod/container_unsupported.go | 5 | ||||
-rw-r--r-- | libpod/container_windows.go | 14 |
6 files changed, 20 insertions, 49 deletions
diff --git a/libpod/boltdb_state_internal.go b/libpod/boltdb_state_internal.go index 44f764be1..e8aa6860b 100644 --- a/libpod/boltdb_state_internal.go +++ b/libpod/boltdb_state_internal.go @@ -3,6 +3,7 @@ package libpod import ( "encoding/json" "path/filepath" + "runtime" "strings" "github.com/boltdb/bolt" @@ -48,13 +49,14 @@ var ( // Check if the configuration of the database is compatible with the // configuration of the runtime opening it // If there is no runtime configuration loaded, load our own -func checkRuntimeConfig(db *bolt.DB, runtime *Runtime) error { +func checkRuntimeConfig(db *bolt.DB, rt *Runtime) error { var ( staticDir = []byte("static-dir") tmpDir = []byte("tmp-dir") runRoot = []byte("run-root") graphRoot = []byte("graph-root") graphDriverName = []byte("graph-driver-name") + osKey = []byte("os") ) err := db.Update(func(tx *bolt.Tx) error { @@ -63,30 +65,34 @@ func checkRuntimeConfig(db *bolt.DB, runtime *Runtime) error { return err } + if err := validateDBAgainstConfig(configBkt, "OS", runtime.GOOS, osKey, runtime.GOOS); err != nil { + return err + } + if err := validateDBAgainstConfig(configBkt, "static dir", - runtime.config.StaticDir, staticDir, ""); err != nil { + rt.config.StaticDir, staticDir, ""); err != nil { return err } if err := validateDBAgainstConfig(configBkt, "tmp dir", - runtime.config.TmpDir, tmpDir, ""); err != nil { + rt.config.TmpDir, tmpDir, ""); err != nil { return err } if err := validateDBAgainstConfig(configBkt, "run root", - runtime.config.StorageConfig.RunRoot, runRoot, + rt.config.StorageConfig.RunRoot, runRoot, storage.DefaultStoreOptions.RunRoot); err != nil { return err } if err := validateDBAgainstConfig(configBkt, "graph root", - runtime.config.StorageConfig.GraphRoot, graphRoot, + rt.config.StorageConfig.GraphRoot, graphRoot, storage.DefaultStoreOptions.GraphRoot); err != nil { return err } return validateDBAgainstConfig(configBkt, "graph driver name", - runtime.config.StorageConfig.GraphDriverName, + rt.config.StorageConfig.GraphDriverName, graphDriverName, storage.DefaultStoreOptions.GraphDriverName) }) diff --git a/libpod/container.go b/libpod/container.go index 2931aee30..3708ee287 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -173,12 +173,8 @@ type containerState struct { // and not delegated to the OCI runtime. ExtensionStageHooks map[string][]spec.Hook `json:"extensionStageHooks,omitempty"` - // Special container state attributes for Linux - containerStateLinux - // Special container state attributes for Windows - containerStateWindows - // Special container state attributes for Darwin - containerStateDarwin + // containerPlatformState holds platform-specific container state. + containerPlatformState } // ExecSession contains information on an active exec session diff --git a/libpod/container_darwin.go b/libpod/container_darwin.go deleted file mode 100644 index 948ed9f2a..000000000 --- a/libpod/container_darwin.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build darwin - -package libpod - -type containerStateDarwin struct { -} - -// containerStateLinux is intentionally left as a blank stub -type containerStateLinux struct { -} - -// containerStateWindows is intentionally left as a blank stub -type containerStateWindows struct { -} diff --git a/libpod/container_linux.go b/libpod/container_linux.go index b271a3089..823a590dd 100644 --- a/libpod/container_linux.go +++ b/libpod/container_linux.go @@ -6,18 +6,10 @@ import ( "github.com/containernetworking/plugins/pkg/ns" ) -type containerStateLinux struct { +type containerPlatformState struct { // NetNSPath is the path of the container's network namespace // Will only be set if config.CreateNetNS is true, or the container was // told to join another container's network namespace NetNS ns.NetNS `json:"-"` } - -// containerStateWindows is intentionally left as a blank stub -type containerStateWindows struct { -} - -// containerStateDarwin is intentionally left as a blank stub -type containerStateDarwin struct { -} diff --git a/libpod/container_unsupported.go b/libpod/container_unsupported.go new file mode 100644 index 000000000..e214b9465 --- /dev/null +++ b/libpod/container_unsupported.go @@ -0,0 +1,5 @@ +// +build !linux + +package libpod + +type containerPlatformState struct{} diff --git a/libpod/container_windows.go b/libpod/container_windows.go deleted file mode 100644 index db2bf24d7..000000000 --- a/libpod/container_windows.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build windows - -package libpod - -type containerStateWindows struct { -} - -// containerStateLinux is intentionally left as a blank stub -type containerStateLinux struct { -} - -// containerStateDarwin is intentionally left as a blank stub -type containerStateDarwin struct { -} |