summaryrefslogtreecommitdiff
path: root/pkg/adapter/pods_remote.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-26 10:14:35 +0100
committerGitHub <noreply@github.com>2019-02-26 10:14:35 +0100
commit993b3a17c58826365136f49d7760f8ac88e320b2 (patch)
tree3bb0ba69a66ae2665ca50a153593cb6fe4768ec3 /pkg/adapter/pods_remote.go
parentcf521449e5d11813571c5e9b86668fbefdd5aa99 (diff)
parent0416b3afc42fb9471c1fdb4555931dba86900e97 (diff)
downloadpodman-993b3a17c58826365136f49d7760f8ac88e320b2.tar.gz
podman-993b3a17c58826365136f49d7760f8ac88e320b2.tar.bz2
podman-993b3a17c58826365136f49d7760f8ac88e320b2.zip
Merge pull request #2436 from baude/remotepodpause
podman-remote pod pause|unpause|restart
Diffstat (limited to 'pkg/adapter/pods_remote.go')
-rw-r--r--pkg/adapter/pods_remote.go72
1 files changed, 72 insertions, 0 deletions
diff --git a/pkg/adapter/pods_remote.go b/pkg/adapter/pods_remote.go
index 767043a5f..220f7163f 100644
--- a/pkg/adapter/pods_remote.go
+++ b/pkg/adapter/pods_remote.go
@@ -327,3 +327,75 @@ func (p *Pod) SharesCgroup() bool {
func (p *Pod) CgroupParent() string {
return p.config.CgroupParent
}
+
+// PausePods pauses a pod using varlink and the remote client
+func (r *LocalRuntime) PausePods(c *cliconfig.PodPauseValues) ([]string, map[string]error, []error) {
+ var (
+ pauseIDs []string
+ pauseErrors []error
+ )
+ containerErrors := make(map[string]error)
+
+ pods, err := iopodman.GetPodsByContext().Call(r.Conn, c.All, c.Latest, c.InputArgs)
+ if err != nil {
+ pauseErrors = append(pauseErrors, err)
+ return nil, containerErrors, pauseErrors
+ }
+ for _, pod := range pods {
+ reply, err := iopodman.PausePod().Call(r.Conn, pod)
+ if err != nil {
+ pauseErrors = append(pauseErrors, err)
+ continue
+ }
+ pauseIDs = append(pauseIDs, reply)
+ }
+ return pauseIDs, nil, pauseErrors
+}
+
+// UnpausePods unpauses a pod using varlink and the remote client
+func (r *LocalRuntime) UnpausePods(c *cliconfig.PodUnpauseValues) ([]string, map[string]error, []error) {
+ var (
+ unpauseIDs []string
+ unpauseErrors []error
+ )
+ containerErrors := make(map[string]error)
+
+ pods, err := iopodman.GetPodsByContext().Call(r.Conn, c.All, c.Latest, c.InputArgs)
+ if err != nil {
+ unpauseErrors = append(unpauseErrors, err)
+ return nil, containerErrors, unpauseErrors
+ }
+ for _, pod := range pods {
+ reply, err := iopodman.UnpausePod().Call(r.Conn, pod)
+ if err != nil {
+ unpauseErrors = append(unpauseErrors, err)
+ continue
+ }
+ unpauseIDs = append(unpauseIDs, reply)
+ }
+ return unpauseIDs, nil, unpauseErrors
+}
+
+// RestartPods restarts pods using varlink and the remote client
+func (r *LocalRuntime) RestartPods(ctx context.Context, c *cliconfig.PodRestartValues) ([]string, map[string]error, []error) {
+ var (
+ restartIDs []string
+ restartErrors []error
+ )
+ containerErrors := make(map[string]error)
+
+ pods, err := iopodman.GetPodsByContext().Call(r.Conn, c.All, c.Latest, c.InputArgs)
+ if err != nil {
+ restartErrors = append(restartErrors, err)
+ return nil, containerErrors, restartErrors
+ }
+ for _, pod := range pods {
+ reply, err := iopodman.RestartPod().Call(r.Conn, pod)
+ if err != nil {
+ restartErrors = append(restartErrors, err)
+ continue
+ }
+ restartIDs = append(restartIDs, reply)
+ }
+ return restartIDs, nil, restartErrors
+}