summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/runtime_abi.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-05 20:49:17 +0200
committerGitHub <noreply@github.com>2020-05-05 20:49:17 +0200
commit864aec8bb011a7a42cf0a2faca39f6e27118b805 (patch)
tree788d16fa62d44244150cab2105ac5fe937cd3c09 /pkg/domain/infra/runtime_abi.go
parentfb6eca50ba9e2dc652da0c33c72db70ab9da85e9 (diff)
parent25312bb5b4e2bd4e122703006fc85bbf080e5e7c (diff)
downloadpodman-864aec8bb011a7a42cf0a2faca39f6e27118b805.tar.gz
podman-864aec8bb011a7a42cf0a2faca39f6e27118b805.tar.bz2
podman-864aec8bb011a7a42cf0a2faca39f6e27118b805.zip
Merge pull request #6081 from baude/v2system
v2 system subcommand
Diffstat (limited to 'pkg/domain/infra/runtime_abi.go')
-rw-r--r--pkg/domain/infra/runtime_abi.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/pkg/domain/infra/runtime_abi.go b/pkg/domain/infra/runtime_abi.go
index 7aa6986a7..67c1cd534 100644
--- a/pkg/domain/infra/runtime_abi.go
+++ b/pkg/domain/infra/runtime_abi.go
@@ -6,8 +6,10 @@ import (
"context"
"fmt"
+ "github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/bindings"
"github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/libpod/pkg/domain/infra/abi"
"github.com/containers/libpod/pkg/domain/infra/tunnel"
)
@@ -36,3 +38,32 @@ func NewImageEngine(facts *entities.PodmanConfig) (entities.ImageEngine, error)
}
return nil, fmt.Errorf("runtime mode '%v' is not supported", facts.EngineMode)
}
+
+// NewSystemEngine factory provides a libpod runtime for specialized system operations
+func NewSystemEngine(setup entities.EngineSetup, facts *entities.PodmanConfig) (entities.SystemEngine, error) {
+ switch facts.EngineMode {
+ case entities.ABIMode:
+ var r *libpod.Runtime
+ var err error
+ switch setup {
+ case entities.NormalMode:
+ r, err = GetRuntime(context.Background(), facts.FlagSet, facts)
+ case entities.RenumberMode:
+ r, err = GetRuntimeRenumber(context.Background(), facts.FlagSet, facts)
+ case entities.ResetMode:
+ r, err = GetRuntimeRenumber(context.Background(), facts.FlagSet, facts)
+ case entities.MigrateMode:
+ name, flagErr := facts.FlagSet.GetString("new-runtime")
+ if flagErr != nil {
+ return nil, flagErr
+ }
+ r, err = GetRuntimeMigrate(context.Background(), facts.FlagSet, facts, name)
+ case entities.NoFDsMode:
+ r, err = GetRuntimeDisableFDs(context.Background(), facts.FlagSet, facts)
+ }
+ return &abi.SystemEngine{Libpod: r}, err
+ case entities.TunnelMode:
+ return nil, fmt.Errorf("tunnel system runtime not supported")
+ }
+ return nil, fmt.Errorf("runtime mode '%v' is not supported", facts.EngineMode)
+}