summaryrefslogtreecommitdiff
path: root/libpod/runtime.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-10-11 20:55:37 +0200
committerGitHub <noreply@github.com>2019-10-11 20:55:37 +0200
commit79d05b99cfee2f7841c0568fbe4def4fbc095c5c (patch)
treedce255b558c740c7f22b931e6258089c7a525a68 /libpod/runtime.go
parentcee6478f9e5e5cdbfe3df8f4894e416e4c5926e4 (diff)
parentb6a7d88397c95a9f3a462274a890b65faafd4d7a (diff)
downloadpodman-79d05b99cfee2f7841c0568fbe4def4fbc095c5c.tar.gz
podman-79d05b99cfee2f7841c0568fbe4def4fbc095c5c.tar.bz2
podman-79d05b99cfee2f7841c0568fbe4def4fbc095c5c.zip
Merge pull request #4220 from mheon/null_runtime
Move OCI runtime implementation behind an interface
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r--libpod/runtime.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 53165b830..a0cf0ad7c 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -99,8 +99,8 @@ type Runtime struct {
store storage.Store
storageService *storageService
imageContext *types.SystemContext
- defaultOCIRuntime *OCIRuntime
- ociRuntimes map[string]*OCIRuntime
+ defaultOCIRuntime OCIRuntime
+ ociRuntimes map[string]OCIRuntime
netPlugin ocicni.CNIPlugin
conmonPath string
imageRuntime *image.Runtime
@@ -1057,7 +1057,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) {
}
// Get us at least one working OCI runtime.
- runtime.ociRuntimes = make(map[string]*OCIRuntime)
+ runtime.ociRuntimes = make(map[string]OCIRuntime)
// Is the old runtime_path defined?
if runtime.config.RuntimePath != nil {
@@ -1076,7 +1076,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) {
json := supportsJSON[name]
nocgroups := supportsNoCgroups[name]
- ociRuntime, err := newOCIRuntime(name, runtime.config.RuntimePath, runtime.conmonPath, runtime.config, json, nocgroups)
+ ociRuntime, err := newConmonOCIRuntime(name, runtime.config.RuntimePath, runtime.conmonPath, runtime.config, json, nocgroups)
if err != nil {
return err
}
@@ -1090,7 +1090,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) {
json := supportsJSON[name]
nocgroups := supportsNoCgroups[name]
- ociRuntime, err := newOCIRuntime(name, paths, runtime.conmonPath, runtime.config, json, nocgroups)
+ ociRuntime, err := newConmonOCIRuntime(name, paths, runtime.conmonPath, runtime.config, json, nocgroups)
if err != nil {
// Don't fatally error.
// This will allow us to ship configs including optional
@@ -1113,7 +1113,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) {
json := supportsJSON[name]
nocgroups := supportsNoCgroups[name]
- ociRuntime, err := newOCIRuntime(name, []string{runtime.config.OCIRuntime}, runtime.conmonPath, runtime.config, json, nocgroups)
+ ociRuntime, err := newConmonOCIRuntime(name, []string{runtime.config.OCIRuntime}, runtime.conmonPath, runtime.config, json, nocgroups)
if err != nil {
return err
}
@@ -1478,6 +1478,11 @@ func (r *Runtime) SystemContext() *types.SystemContext {
return r.imageContext
}
+// GetOCIRuntimePath retrieves the path of the default OCI runtime.
+func (r *Runtime) GetOCIRuntimePath() string {
+ return r.defaultOCIRuntime.Path()
+}
+
// Since runc does not currently support cgroupV2
// Change to default crun on first running of libpod.conf
// TODO Once runc has support for cgroups, this function should be removed.