summaryrefslogtreecommitdiff
path: root/libpod/boltdb_state_internal.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-06-21 14:46:54 +0200
committerGitHub <noreply@github.com>2019-06-21 14:46:54 +0200
commit7d8aba924820447a9f07b78dbaf795f94c4e906d (patch)
treed54d886bbea33a0b15dbbf64e7f21d438cbe0919 /libpod/boltdb_state_internal.go
parent54920601ae69ca9b22bda75882425b88cd99efea (diff)
parent2ee24046838087c335af7c8bf8ae39ba129cd799 (diff)
downloadpodman-7d8aba924820447a9f07b78dbaf795f94c4e906d.tar.gz
podman-7d8aba924820447a9f07b78dbaf795f94c4e906d.tar.bz2
podman-7d8aba924820447a9f07b78dbaf795f94c4e906d.zip
Merge pull request #3378 from mheon/multiple_runtimes
Begin adding support for multiple OCI runtimes
Diffstat (limited to 'libpod/boltdb_state_internal.go')
-rw-r--r--libpod/boltdb_state_internal.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/libpod/boltdb_state_internal.go b/libpod/boltdb_state_internal.go
index e06de631d..b7930e158 100644
--- a/libpod/boltdb_state_internal.go
+++ b/libpod/boltdb_state_internal.go
@@ -2,6 +2,7 @@ package libpod
import (
"bytes"
+ "path/filepath"
"runtime"
"strings"
@@ -366,6 +367,23 @@ func (s *BoltState) getContainerFromDB(id []byte, ctr *Container, ctrsBkt *bolt.
}
ctr.lock = lock
+ if ctr.config.OCIRuntime == "" {
+ ctr.ociRuntime = s.runtime.defaultOCIRuntime
+ } else {
+ // Handle legacy containers which might use a literal path for
+ // their OCI runtime name.
+ runtimeName := ctr.config.OCIRuntime
+ if strings.HasPrefix(runtimeName, "/") {
+ runtimeName = filepath.Base(runtimeName)
+ }
+
+ ociRuntime, ok := s.runtime.ociRuntimes[runtimeName]
+ if !ok {
+ return errors.Wrapf(ErrInternal, "container %s was created with OCI runtime %s, but that runtime is not available in the current configuration", ctr.ID(), ctr.config.OCIRuntime)
+ }
+ ctr.ociRuntime = ociRuntime
+ }
+
ctr.runtime = s.runtime
ctr.valid = valid