summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/cliconfig/config.go5
-rw-r--r--cmd/podman/commands.go6
-rw-r--r--cmd/podman/commit.go5
-rw-r--r--cmd/podman/container.go3
-rw-r--r--cmd/podman/main.go3
-rw-r--r--cmd/podman/pause.go54
-rw-r--r--cmd/podman/pod.go1
-rw-r--r--cmd/podman/pods_prune.go47
-rw-r--r--cmd/podman/ps.go6
-rw-r--r--cmd/podman/shared/intermediate_varlink.go14
-rw-r--r--cmd/podman/shared/pod.go58
-rw-r--r--cmd/podman/start.go104
-rw-r--r--cmd/podman/system_prune.go19
-rw-r--r--cmd/podman/unpause.go54
-rw-r--r--cmd/podman/varlink/io.podman.varlink5
15 files changed, 157 insertions, 227 deletions
diff --git a/cmd/podman/cliconfig/config.go b/cmd/podman/cliconfig/config.go
index 982c77c17..640a4bff4 100644
--- a/cmd/podman/cliconfig/config.go
+++ b/cmd/podman/cliconfig/config.go
@@ -159,6 +159,11 @@ type PruneContainersValues struct {
Force bool
}
+type PodPruneValues struct {
+ PodmanCommand
+ Force bool
+}
+
type ImportValues struct {
PodmanCommand
Change []string
diff --git a/cmd/podman/commands.go b/cmd/podman/commands.go
index 0e5deb627..c36452cfe 100644
--- a/cmd/podman/commands.go
+++ b/cmd/podman/commands.go
@@ -17,15 +17,12 @@ func getMainCommands() []*cobra.Command {
_loginCommand,
_logoutCommand,
_mountCommand,
- _pauseCommand,
_portCommand,
_refreshCommand,
_restartCommand,
_searchCommand,
- _startCommand,
_statsCommand,
_topCommand,
- _unpauseCommand,
}
if len(_varlinkCommand.Use) > 0 {
@@ -50,19 +47,16 @@ func getContainerSubCommands() []*cobra.Command {
_commitCommand,
_execCommand,
_mountCommand,
- _pauseCommand,
_portCommand,
_pruneContainersCommand,
_refreshCommand,
_restartCommand,
_restoreCommand,
_runlabelCommand,
- _startCommand,
_statsCommand,
_stopCommand,
_topCommand,
_umountCommand,
- _unpauseCommand,
}
}
diff --git a/cmd/podman/commit.go b/cmd/podman/commit.go
index 5963f8686..8d79c1e28 100644
--- a/cmd/podman/commit.go
+++ b/cmd/podman/commit.go
@@ -42,7 +42,7 @@ func init() {
commitCommand.SetHelpTemplate(HelpTemplate())
commitCommand.SetUsageTemplate(UsageTemplate())
flags := commitCommand.Flags()
- flags.StringSliceVarP(&commitCommand.Change, "change", "c", []string{}, fmt.Sprintf("Apply the following possible instructions to the created image (default []): %s", strings.Join(libpod.ChangeCmds, " | ")))
+ flags.StringArrayVarP(&commitCommand.Change, "change", "c", []string{}, fmt.Sprintf("Apply the following possible instructions to the created image (default []): %s", strings.Join(libpod.ChangeCmds, " | ")))
flags.StringVarP(&commitCommand.Format, "format", "f", "oci", "`Format` of the image manifest and metadata")
flags.StringVarP(&commitCommand.Message, "message", "m", "", "Set commit message for imported image")
flags.StringVarP(&commitCommand.Author, "author", "a", "", "Set the author for the image committed")
@@ -83,6 +83,9 @@ func commitCmd(c *cliconfig.CommitValues) error {
if c.Flag("change").Changed {
for _, change := range c.Change {
splitChange := strings.Split(strings.ToUpper(change), "=")
+ if len(splitChange) == 1 {
+ splitChange = strings.Split(strings.ToUpper(change), " ")
+ }
if !util.StringInSlice(splitChange[0], libpod.ChangeCmds) {
return errors.Errorf("invalid syntax for --change: %s", change)
}
diff --git a/cmd/podman/container.go b/cmd/podman/container.go
index 39c4f0c5d..7733c8eef 100644
--- a/cmd/podman/container.go
+++ b/cmd/podman/container.go
@@ -59,8 +59,11 @@ var (
_killCommand,
_listSubCommand,
_logsCommand,
+ _pauseCommand,
_runCommand,
_rmCommand,
+ _startCommand,
+ _unpauseCommand,
_waitCommand,
}
)
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index e8c3e14ea..15f4a5d71 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -45,6 +45,7 @@ var mainCommands = []*cobra.Command{
_killCommand,
_loadCommand,
_logsCommand,
+ _pauseCommand,
podCommand.Command,
&_psCommand,
_pullCommand,
@@ -56,9 +57,11 @@ var mainCommands = []*cobra.Command{
_stopCommand,
_tagCommand,
_umountCommand,
+ _unpauseCommand,
_versionCommand,
_waitCommand,
imageCommand.Command,
+ _startCommand,
systemCommand.Command,
}
diff --git a/cmd/podman/pause.go b/cmd/podman/pause.go
index 3e6d36571..ca137150a 100644
--- a/cmd/podman/pause.go
+++ b/cmd/podman/pause.go
@@ -4,11 +4,9 @@ import (
"os"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/cmd/podman/libpodruntime"
- "github.com/containers/libpod/cmd/podman/shared"
"github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
- "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@@ -41,15 +39,11 @@ func init() {
}
func pauseCmd(c *cliconfig.PauseValues) error {
- var (
- pauseContainers []*libpod.Container
- pauseFuncs []shared.ParallelWorkerInput
- )
if os.Geteuid() != 0 {
return errors.New("pause is not supported for rootless containers")
}
- runtime, err := libpodruntime.GetRuntime(&c.PodmanCommand)
+ runtime, err := adapter.GetRuntime(&c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "could not get runtime")
}
@@ -59,41 +53,19 @@ func pauseCmd(c *cliconfig.PauseValues) error {
if len(args) < 1 && !c.All {
return errors.Errorf("you must provide at least one container name or id")
}
- if c.All {
- containers, err := getAllOrLatestContainers(&c.PodmanCommand, runtime, libpod.ContainerStateRunning, "running")
- if err != nil {
- return err
- }
- pauseContainers = append(pauseContainers, containers...)
- } else {
- for _, arg := range args {
- ctr, err := runtime.LookupContainer(arg)
- if err != nil {
- return err
+ ok, failures, err := runtime.PauseContainers(getContext(), c)
+ if err != nil {
+ if errors.Cause(err) == libpod.ErrNoSuchCtr {
+ if len(c.InputArgs) > 1 {
+ exitCode = 125
+ } else {
+ exitCode = 1
}
- pauseContainers = append(pauseContainers, ctr)
- }
- }
-
- // Now assemble the slice of pauseFuncs
- for _, ctr := range pauseContainers {
- con := ctr
-
- f := func() error {
- return con.Pause()
}
- pauseFuncs = append(pauseFuncs, shared.ParallelWorkerInput{
- ContainerID: con.ID(),
- ParallelFunc: f,
- })
+ return err
}
-
- maxWorkers := shared.Parallelize("pause")
- if c.GlobalIsSet("max-workers") {
- maxWorkers = c.GlobalFlags.MaxWorks
+ if len(failures) > 0 {
+ exitCode = 125
}
- logrus.Debugf("Setting maximum workers to %d", maxWorkers)
-
- pauseErrors, errCount := shared.ParallelExecuteWorkerPool(maxWorkers, pauseFuncs)
- return printParallelOutput(pauseErrors, errCount)
+ return printCmdResults(ok, failures)
}
diff --git a/cmd/podman/pod.go b/cmd/podman/pod.go
index 2d9bca21d..ed331965e 100644
--- a/cmd/podman/pod.go
+++ b/cmd/podman/pod.go
@@ -24,6 +24,7 @@ var podSubCommands = []*cobra.Command{
_podInspectCommand,
_podKillCommand,
_podPauseCommand,
+ _prunePodsCommand,
_podPsCommand,
_podRestartCommand,
_podRmCommand,
diff --git a/cmd/podman/pods_prune.go b/cmd/podman/pods_prune.go
new file mode 100644
index 000000000..e6946f068
--- /dev/null
+++ b/cmd/podman/pods_prune.go
@@ -0,0 +1,47 @@
+package main
+
+import (
+ "github.com/containers/libpod/cmd/podman/cliconfig"
+ "github.com/containers/libpod/pkg/adapter"
+ "github.com/pkg/errors"
+ "github.com/spf13/cobra"
+)
+
+var (
+ podPruneCommand cliconfig.PodPruneValues
+ podPruneDescription = `
+ podman pod prune
+
+ Removes all exited pods
+`
+ _prunePodsCommand = &cobra.Command{
+ Use: "prune",
+ Args: noSubArgs,
+ Short: "Remove all stopped pods",
+ Long: podPruneDescription,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ podPruneCommand.InputArgs = args
+ podPruneCommand.GlobalFlags = MainGlobalOpts
+ return podPruneCmd(&podPruneCommand)
+ },
+ }
+)
+
+func init() {
+ podPruneCommand.Command = _prunePodsCommand
+ podPruneCommand.SetHelpTemplate(HelpTemplate())
+ podPruneCommand.SetUsageTemplate(UsageTemplate())
+ flags := podPruneCommand.Flags()
+ flags.BoolVarP(&podPruneCommand.Force, "force", "f", false, "Force removal of a running pods. The default is false")
+}
+
+func podPruneCmd(c *cliconfig.PodPruneValues) error {
+ runtime, err := adapter.GetRuntime(&c.PodmanCommand)
+ if err != nil {
+ return errors.Wrapf(err, "could not get runtime")
+ }
+ defer runtime.Shutdown(false)
+
+ ok, failures, err := runtime.PrunePods(getContext(), c)
+ return printCmdResults(ok, failures)
+}
diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go
index a9e46d6b9..df1ea2765 100644
--- a/cmd/podman/ps.go
+++ b/cmd/podman/ps.go
@@ -17,7 +17,6 @@ import (
"github.com/containers/libpod/pkg/adapter"
"github.com/cri-o/ocicni/pkg/ocicni"
"github.com/docker/go-units"
- "github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/fields"
@@ -198,11 +197,6 @@ func init() {
}
func psCmd(c *cliconfig.PsValues) error {
- if c.Bool("trace") {
- span, _ := opentracing.StartSpanFromContext(Ctx, "psCmd")
- defer span.Finish()
- }
-
var watch bool
if c.Watch > 0 {
diff --git a/cmd/podman/shared/intermediate_varlink.go b/cmd/podman/shared/intermediate_varlink.go
index 95a0d6287..d62a65955 100644
--- a/cmd/podman/shared/intermediate_varlink.go
+++ b/cmd/podman/shared/intermediate_varlink.go
@@ -4,8 +4,10 @@ package shared
import (
"fmt"
+
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/varlink"
+ "github.com/containers/libpod/pkg/rootless"
"github.com/pkg/errors"
)
@@ -318,6 +320,12 @@ func VarlinkCreateToGeneric(opts iopodman.Create) GenericCLIResults {
// We do not get a default network over varlink. Unlike the other default values for some cli
// elements, it seems it gets set to the default anyway.
+ var memSwapDefault int64 = -1
+ netModeDefault := "bridge"
+ if rootless.IsRootless() {
+ netModeDefault = "slirp4netns"
+ }
+
m := make(map[string]GenericCLIResult)
m["add-host"] = stringSliceFromVarlink(opts.AddHost, "add-host", nil)
m["annotation"] = stringSliceFromVarlink(opts.Annotation, "annotation", nil)
@@ -374,10 +382,10 @@ func VarlinkCreateToGeneric(opts iopodman.Create) GenericCLIResults {
m["memory"] = stringFromVarlink(opts.Memory, "memory", nil)
m["memory-reservation"] = stringFromVarlink(opts.MemoryReservation, "memory-reservation", nil)
m["memory-swap"] = stringFromVarlink(opts.MemorySwap, "memory-swap", nil)
- m["memory-swappiness"] = int64FromVarlink(opts.MemorySwappiness, "memory-swappiness", nil)
+ m["memory-swappiness"] = int64FromVarlink(opts.MemorySwappiness, "memory-swappiness", &memSwapDefault)
m["name"] = stringFromVarlink(opts.Name, "name", nil)
- m["net"] = stringFromVarlink(opts.Net, "net", nil)
- m["network"] = stringFromVarlink(opts.Network, "network", nil)
+ m["net"] = stringFromVarlink(opts.Net, "net", &netModeDefault)
+ m["network"] = stringFromVarlink(opts.Network, "network", &netModeDefault)
m["no-hosts"] = boolFromVarlink(opts.NoHosts, "no-hosts", false)
m["oom-kill-disable"] = boolFromVarlink(opts.OomKillDisable, "oon-kill-disable", false)
m["oom-score-adj"] = intFromVarlink(opts.OomScoreAdj, "oom-score-adj", nil)
diff --git a/cmd/podman/shared/pod.go b/cmd/podman/shared/pod.go
index 4d936d61c..3f4cb0312 100644
--- a/cmd/podman/shared/pod.go
+++ b/cmd/podman/shared/pod.go
@@ -10,12 +10,12 @@ import (
)
const (
- stopped = "Stopped"
- running = "Running"
- paused = "Paused"
- exited = "Exited"
- errored = "Error"
- created = "Created"
+ PodStateStopped = "Stopped"
+ PodStateRunning = "Running"
+ PodStatePaused = "Paused"
+ PodStateExited = "Exited"
+ PodStateErrored = "Error"
+ PodStateCreated = "Created"
)
// GetPodStatus determines the status of the pod based on the
@@ -24,7 +24,7 @@ const (
func GetPodStatus(pod *libpod.Pod) (string, error) {
ctrStatuses, err := pod.Status()
if err != nil {
- return errored, err
+ return PodStateErrored, err
}
return CreatePodStatusResults(ctrStatuses)
}
@@ -32,44 +32,44 @@ func GetPodStatus(pod *libpod.Pod) (string, error) {
func CreatePodStatusResults(ctrStatuses map[string]libpod.ContainerStatus) (string, error) {
ctrNum := len(ctrStatuses)
if ctrNum == 0 {
- return created, nil
+ return PodStateCreated, nil
}
statuses := map[string]int{
- stopped: 0,
- running: 0,
- paused: 0,
- created: 0,
- errored: 0,
+ PodStateStopped: 0,
+ PodStateRunning: 0,
+ PodStatePaused: 0,
+ PodStateCreated: 0,
+ PodStateErrored: 0,
}
for _, ctrStatus := range ctrStatuses {
switch ctrStatus {
case libpod.ContainerStateExited:
fallthrough
case libpod.ContainerStateStopped:
- statuses[stopped]++
+ statuses[PodStateStopped]++
case libpod.ContainerStateRunning:
- statuses[running]++
+ statuses[PodStateRunning]++
case libpod.ContainerStatePaused:
- statuses[paused]++
+ statuses[PodStatePaused]++
case libpod.ContainerStateCreated, libpod.ContainerStateConfigured:
- statuses[created]++
+ statuses[PodStateCreated]++
default:
- statuses[errored]++
+ statuses[PodStateErrored]++
}
}
- if statuses[running] > 0 {
- return running, nil
- } else if statuses[paused] == ctrNum {
- return paused, nil
- } else if statuses[stopped] == ctrNum {
- return exited, nil
- } else if statuses[stopped] > 0 {
- return stopped, nil
- } else if statuses[errored] > 0 {
- return errored, nil
+ if statuses[PodStateRunning] > 0 {
+ return PodStateRunning, nil
+ } else if statuses[PodStatePaused] == ctrNum {
+ return PodStatePaused, nil
+ } else if statuses[PodStateStopped] == ctrNum {
+ return PodStateExited, nil
+ } else if statuses[PodStateStopped] > 0 {
+ return PodStateStopped, nil
+ } else if statuses[PodStateErrored] > 0 {
+ return PodStateErrored, nil
}
- return created, nil
+ return PodStateCreated, nil
}
// GetNamespaceOptions transforms a slice of kernel namespaces
diff --git a/cmd/podman/start.go b/cmd/podman/start.go
index ec05ce90e..9f93061f9 100644
--- a/cmd/podman/start.go
+++ b/cmd/podman/start.go
@@ -1,16 +1,11 @@
package main
import (
- "fmt"
- "os"
-
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/adapter"
- opentracing "github.com/opentracing/opentracing-go"
+ "github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
- "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@@ -48,7 +43,7 @@ func init() {
}
func startCmd(c *cliconfig.StartValues) error {
- if c.Bool("trace") {
+ if !remoteclient && c.Bool("trace") {
span, _ := opentracing.StartSpanFromContext(Ctx, "startCmd")
defer span.Finish()
}
@@ -70,100 +65,11 @@ func startCmd(c *cliconfig.StartValues) error {
return errors.Wrapf(libpod.ErrInvalidArg, "you cannot use sig-proxy without --attach")
}
- runtime, err := libpodruntime.GetRuntime(&c.PodmanCommand)
+ runtime, err := adapter.GetRuntime(&c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "error creating libpod runtime")
}
defer runtime.Shutdown(false)
- if c.Latest {
- lastCtr, err := runtime.GetLatestContainer()
- if err != nil {
- return errors.Wrapf(err, "unable to get latest container")
- }
- args = append(args, lastCtr.ID())
- }
-
- ctx := getContext()
-
- var lastError error
- for _, container := range args {
- ctr, err := runtime.LookupContainer(container)
- if err != nil {
- if lastError != nil {
- fmt.Fprintln(os.Stderr, lastError)
- }
- lastError = errors.Wrapf(err, "unable to find container %s", container)
- continue
- }
-
- ctrState, err := ctr.State()
- if err != nil {
- return errors.Wrapf(err, "unable to get container state")
- }
-
- ctrRunning := ctrState == libpod.ContainerStateRunning
-
- if attach {
- inputStream := os.Stdin
- if !c.Interactive {
- inputStream = nil
- }
-
- // attach to the container and also start it not already running
- // If the container is in a pod, also set to recursively start dependencies
- err = adapter.StartAttachCtr(ctx, ctr, os.Stdout, os.Stderr, inputStream, c.DetachKeys, sigProxy, !ctrRunning, ctr.PodID() != "")
- if errors.Cause(err) == libpod.ErrDetach {
- // User manually detached
- // Exit cleanly immediately
- exitCode = 0
- return nil
- }
-
- if ctrRunning {
- return err
- }
-
- if err != nil {
- return errors.Wrapf(err, "unable to start container %s", ctr.ID())
- }
-
- if ecode, err := ctr.Wait(); err != nil {
- if errors.Cause(err) == libpod.ErrNoSuchCtr {
- // The container may have been removed
- // Go looking for an exit file
- rtc, err := runtime.GetConfig()
- if err != nil {
- return err
- }
- ctrExitCode, err := adapter.ReadExitFile(rtc.TmpDir, ctr.ID())
- if err != nil {
- logrus.Errorf("Cannot get exit code: %v", err)
- exitCode = 127
- } else {
- exitCode = ctrExitCode
- }
- }
- } else {
- exitCode = int(ecode)
- }
-
- return nil
- }
- if ctrRunning {
- fmt.Println(ctr.ID())
- continue
- }
- // Handle non-attach start
- // If the container is in a pod, also set to recursively start dependencies
- if err := ctr.Start(ctx, ctr.PodID() != ""); err != nil {
- if lastError != nil {
- fmt.Fprintln(os.Stderr, lastError)
- }
- lastError = errors.Wrapf(err, "unable to start container %q", container)
- continue
- }
- fmt.Println(container)
- }
-
- return lastError
+ exitCode, err = runtime.Start(getContext(), c, sigProxy)
+ return err
}
diff --git a/cmd/podman/system_prune.go b/cmd/podman/system_prune.go
index 436d54823..8900e2644 100644
--- a/cmd/podman/system_prune.go
+++ b/cmd/podman/system_prune.go
@@ -59,6 +59,7 @@ func pruneSystemCmd(c *cliconfig.SystemPruneValues) error {
fmt.Printf(`
WARNING! This will remove:
- all stopped containers%s
+ - all stopped pods
- all dangling images
- all build cache
Are you sure you want to continue? [y/N] `, volumeString)
@@ -77,9 +78,25 @@ Are you sure you want to continue? [y/N] `, volumeString)
}
defer runtime.Shutdown(false)
+ rmWorkers := shared.Parallelize("rm")
ctx := getContext()
fmt.Println("Deleted Containers")
- lasterr := pruneContainers(runtime, ctx, shared.Parallelize("rm"), false, false)
+ lasterr := pruneContainers(runtime, ctx, rmWorkers, false, false)
+
+ fmt.Println("Deleted Pods")
+ pruneValues := cliconfig.PodPruneValues{
+ PodmanCommand: c.PodmanCommand,
+ Force: c.Force,
+ }
+ ok, failures, err := runtime.PrunePods(ctx, &pruneValues)
+ if err != nil {
+ if lasterr != nil {
+ logrus.Errorf("%q", lasterr)
+ }
+ lasterr = err
+ }
+ printCmdResults(ok, failures)
+
if c.Bool("volumes") {
fmt.Println("Deleted Volumes")
err := volumePrune(runtime, getContext())
diff --git a/cmd/podman/unpause.go b/cmd/podman/unpause.go
index 65e841b36..fa946bfd7 100644
--- a/cmd/podman/unpause.go
+++ b/cmd/podman/unpause.go
@@ -4,11 +4,9 @@ import (
"os"
"github.com/containers/libpod/cmd/podman/cliconfig"
- "github.com/containers/libpod/cmd/podman/libpodruntime"
- "github.com/containers/libpod/cmd/podman/shared"
"github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
- "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@@ -40,15 +38,11 @@ func init() {
}
func unpauseCmd(c *cliconfig.UnpauseValues) error {
- var (
- unpauseContainers []*libpod.Container
- unpauseFuncs []shared.ParallelWorkerInput
- )
if os.Geteuid() != 0 {
return errors.New("unpause is not supported for rootless containers")
}
- runtime, err := libpodruntime.GetRuntime(&c.PodmanCommand)
+ runtime, err := adapter.GetRuntime(&c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "could not get runtime")
}
@@ -58,41 +52,19 @@ func unpauseCmd(c *cliconfig.UnpauseValues) error {
if len(args) < 1 && !c.All {
return errors.Errorf("you must provide at least one container name or id")
}
- if c.All {
- cs, err := getAllOrLatestContainers(&c.PodmanCommand, runtime, libpod.ContainerStatePaused, "paused")
- if err != nil {
- return err
- }
- unpauseContainers = append(unpauseContainers, cs...)
- } else {
- for _, arg := range args {
- ctr, err := runtime.LookupContainer(arg)
- if err != nil {
- return err
+ ok, failures, err := runtime.UnpauseContainers(getContext(), c)
+ if err != nil {
+ if errors.Cause(err) == libpod.ErrNoSuchCtr {
+ if len(c.InputArgs) > 1 {
+ exitCode = 125
+ } else {
+ exitCode = 1
}
- unpauseContainers = append(unpauseContainers, ctr)
- }
- }
-
- // Assemble the unpause funcs
- for _, ctr := range unpauseContainers {
- con := ctr
- f := func() error {
- return con.Unpause()
}
-
- unpauseFuncs = append(unpauseFuncs, shared.ParallelWorkerInput{
- ContainerID: con.ID(),
- ParallelFunc: f,
- })
+ return err
}
-
- maxWorkers := shared.Parallelize("unpause")
- if c.GlobalIsSet("max-workers") {
- maxWorkers = c.GlobalFlags.MaxWorks
+ if len(failures) > 0 {
+ exitCode = 125
}
- logrus.Debugf("Setting maximum workers to %d", maxWorkers)
-
- unpauseErrors, errCount := shared.ParallelExecuteWorkerPool(maxWorkers, unpauseFuncs)
- return printParallelOutput(unpauseErrors, errCount)
+ return printCmdResults(ok, failures)
}
diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink
index b5295273a..1fde72164 100644
--- a/cmd/podman/varlink/io.podman.varlink
+++ b/cmd/podman/varlink/io.podman.varlink
@@ -522,6 +522,8 @@ method ListContainers() -> (containers: []Container)
method Ps(opts: PsOpts) -> (containers: []PsContainer)
+method GetContainersByStatus(status: []string) -> (containerS: []Container)
+
# GetContainer returns information about a single container. If a container
# with the given id doesn't exist, a [ContainerNotFound](#ContainerNotFound)
# error will be returned. See also [ListContainers](ListContainers) and
@@ -1053,6 +1055,9 @@ method TopPod(pod: string, latest: bool, descriptors: []string) -> (stats: []str
# ~~~
method GetPodStats(name: string) -> (pod: string, containers: []ContainerStats)
+# GetPodsByStatus searches for pods whose status is included in statuses
+method GetPodsByStatus(statuses: []string) -> (pods: []string)
+
# ImageExists talks a full or partial image ID or name and returns an int as to whether
# the image exists in local storage. An int result of 0 means the image does exist in
# local storage; whereas 1 indicates the image does not exists in local storage.