summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/runtime_abi.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2020-05-01 12:57:41 -0500
committerbaude <bbaude@redhat.com>2020-05-05 12:24:33 -0500
commit25312bb5b4e2bd4e122703006fc85bbf080e5e7c (patch)
treef2728cef53f71fcf1c04ff76ab928770fc5c9e50 /pkg/domain/infra/runtime_abi.go
parent4a1331d0afd9a21ff9465916d4006ff7297ae07c (diff)
downloadpodman-25312bb5b4e2bd4e122703006fc85bbf080e5e7c.tar.gz
podman-25312bb5b4e2bd4e122703006fc85bbf080e5e7c.tar.bz2
podman-25312bb5b4e2bd4e122703006fc85bbf080e5e7c.zip
v2 system subcommand
add system df, info, load, renumber, and migrate Refactor for specialized libpod engines add the ability to prune images, volumes, containers, and pods Signed-off-by: baude <bbaude@redhat.com>
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)
+}