From 2a7449362f2884d9ae6a783c0ce38979d882e2cf Mon Sep 17 00:00:00 2001
From: haircommander <pehunt@redhat.com>
Date: Fri, 17 Aug 2018 10:36:51 -0400
Subject: Change pause container to infra container

Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1187
Approved by: mheon
---
 cmd/podman/libpodruntime/runtime.go  |  8 ++++----
 cmd/podman/pod_create.go             | 32 ++++++++++++++++----------------
 cmd/podman/pod_ps.go                 | 16 ++++++++--------
 cmd/podman/ps.go                     | 18 +++++++++---------
 cmd/podman/varlink/io.podman.varlink |  4 ++--
 5 files changed, 39 insertions(+), 39 deletions(-)

(limited to 'cmd')

diff --git a/cmd/podman/libpodruntime/runtime.go b/cmd/podman/libpodruntime/runtime.go
index af6be0602..ec105719f 100644
--- a/cmd/podman/libpodruntime/runtime.go
+++ b/cmd/podman/libpodruntime/runtime.go
@@ -125,12 +125,12 @@ func GetRuntimeWithStorageOpts(c *cli.Context, storageOpts *storage.StoreOptions
 	// TODO flag to set CNI plugins dir?
 
 	// Pod create options
-	if c.IsSet("pause-image") {
-		options = append(options, libpod.WithDefaultPauseImage(c.String("pause-image")))
+	if c.IsSet("infra-image") {
+		options = append(options, libpod.WithDefaultInfraImage(c.String("infra-image")))
 	}
 
-	if c.IsSet("pause-command") {
-		options = append(options, libpod.WithDefaultPauseCommand(c.String("pause-command")))
+	if c.IsSet("infra-command") {
+		options = append(options, libpod.WithDefaultInfraCommand(c.String("infra-command")))
 	}
 
 	return libpod.NewRuntime(options...)
diff --git a/cmd/podman/pod_create.go b/cmd/podman/pod_create.go
index f5bb29c35..eb07e7d50 100644
--- a/cmd/podman/pod_create.go
+++ b/cmd/podman/pod_create.go
@@ -28,6 +28,18 @@ var podCreateFlags = []cli.Flag{
 		Name:  "cgroup-parent",
 		Usage: "Set parent cgroup for the pod",
 	},
+	cli.BoolTFlag{
+		Name:  "infra",
+		Usage: "Create an infra container associated with the pod to share namespaces with",
+	},
+	cli.StringFlag{
+		Name:  "infra-image",
+		Usage: "The image of the infra container to associate with the pod",
+	},
+	cli.StringFlag{
+		Name:  "infra-command",
+		Usage: "The command to run on the infra container when the pod is started",
+	},
 	cli.StringSliceFlag{
 		Name:  "label-file",
 		Usage: "Read in a line delimited file of labels (default [])",
@@ -40,18 +52,6 @@ var podCreateFlags = []cli.Flag{
 		Name:  "name, n",
 		Usage: "Assign a name to the pod",
 	},
-	cli.BoolTFlag{
-		Name:  "pause",
-		Usage: "Create a pause container associated with the pod to share namespaces with",
-	},
-	cli.StringFlag{
-		Name:  "pause-image",
-		Usage: "The image of the pause container to associate with the pod",
-	},
-	cli.StringFlag{
-		Name:  "pause-command",
-		Usage: "The command to run on the pause container when the pod is started",
-	},
 	cli.StringFlag{
 		Name:  "pod-id-file",
 		Usage: "Write the pod ID to the file",
@@ -95,8 +95,8 @@ func podCreateCmd(c *cli.Context) error {
 			return errors.Wrapf(err, "unable to write pod id file %s", c.String("pod-id-file"))
 		}
 	}
-	if !c.BoolT("pause") && c.IsSet("share") && c.String("share") != "none" && c.String("share") != "" {
-		return errors.Errorf("You cannot share kernel namespaces on the pod level without a pause container")
+	if !c.BoolT("infra") && c.IsSet("share") && c.String("share") != "none" && c.String("share") != "" {
+		return errors.Errorf("You cannot share kernel namespaces on the pod level without an infra container")
 	}
 
 	if c.IsSet("cgroup-parent") {
@@ -115,8 +115,8 @@ func podCreateCmd(c *cli.Context) error {
 		options = append(options, libpod.WithPodName(c.String("name")))
 	}
 
-	if c.BoolT("pause") {
-		options = append(options, libpod.WithPauseContainer())
+	if c.BoolT("infra") {
+		options = append(options, libpod.WithInfraContainer())
 		nsOptions, err := shared.GetNamespaceOptions(strings.Split(c.String("share"), ","))
 		if err != nil {
 			return err
diff --git a/cmd/podman/pod_ps.go b/cmd/podman/pod_ps.go
index 20cda1276..58f404e7a 100644
--- a/cmd/podman/pod_ps.go
+++ b/cmd/podman/pod_ps.go
@@ -57,7 +57,7 @@ type podPsTemplateParams struct {
 	Status             string
 	Cgroup             string
 	ContainerInfo      string
-	PauseContainerID   string
+	InfraContainerID   string
 	SharedNamespaces   string
 }
 
@@ -74,7 +74,7 @@ type podPsJSONParams struct {
 	Status             string         `json:"status"`
 	CtrsInfo           []podPsCtrInfo `json:"containerinfo,omitempty"`
 	Cgroup             string         `json:"cgroup,omitempty"`
-	PauseContainerID   string         `json:"pausecontainerid,omitempty"`
+	InfraContainerID   string         `json:"infracontainerid,omitempty"`
 	SharedNamespaces   []string       `json:"sharednamespaces,omitempty"`
 }
 
@@ -358,7 +358,7 @@ func genPodPsFormat(c *cli.Context) string {
 		} else {
 			format += "\t{{.NumberOfContainers}}"
 		}
-		format += "\t{{.PauseContainerID}}"
+		format += "\t{{.InfraContainerID}}"
 	}
 	return format
 }
@@ -418,7 +418,7 @@ func getPodTemplateOutput(psParams []podPsJSONParams, opts podPsOptions) ([]podP
 
 	for _, psParam := range psParams {
 		podID := psParam.ID
-		pauseID := psParam.PauseContainerID
+		infraID := psParam.InfraContainerID
 		var ctrStr string
 
 		truncated := ""
@@ -428,7 +428,7 @@ func getPodTemplateOutput(psParams []podPsJSONParams, opts podPsOptions) ([]podP
 				psParam.CtrsInfo = psParam.CtrsInfo[:NUM_CTR_INFO]
 				truncated = "..."
 			}
-			pauseID = shortID(pauseID)
+			infraID = shortID(infraID)
 		}
 		for _, ctrInfo := range psParam.CtrsInfo {
 			ctrStr += "[ "
@@ -456,7 +456,7 @@ func getPodTemplateOutput(psParams []podPsJSONParams, opts podPsOptions) ([]podP
 			NumberOfContainers: psParam.NumberOfContainers,
 			Cgroup:             psParam.Cgroup,
 			ContainerInfo:      ctrStr,
-			PauseContainerID:   pauseID,
+			InfraContainerID:   infraID,
 			SharedNamespaces:   strings.Join(psParam.SharedNamespaces, ","),
 		}
 
@@ -510,7 +510,7 @@ func getAndSortPodJSONParams(pods []*libpod.Pod, opts podPsOptions, runtime *lib
 			return nil, err
 		}
 
-		pauseContainerID, err := pod.PauseContainerID()
+		infraContainerID, err := pod.InfraContainerID()
 		if err != nil {
 			return nil, err
 		}
@@ -547,7 +547,7 @@ func getAndSortPodJSONParams(pods []*libpod.Pod, opts podPsOptions, runtime *lib
 			NumberOfContainers: ctrNum,
 			CtrsInfo:           ctrsInfo,
 			SharedNamespaces:   getSharedNamespaces(pod),
-			PauseContainerID:   pauseContainerID,
+			InfraContainerID:   infraContainerID,
 		}
 
 		psOutput = append(psOutput, params)
diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go
index 332416d14..82309c2ef 100644
--- a/cmd/podman/ps.go
+++ b/cmd/podman/ps.go
@@ -44,7 +44,7 @@ type psTemplateParams struct {
 	User          string
 	UTS           string
 	Pod           string
-	IsPause       bool
+	IsInfra       bool
 }
 
 // psJSONParams is used as a base structure for the psParams
@@ -72,7 +72,7 @@ type psJSONParams struct {
 	ContainerRunning bool                  `json:"ctrRunning"`
 	Namespaces       *shared.Namespace     `json:"namespace,omitempty"`
 	Pod              string                `json:"pod,omitempty"`
-	IsPause          bool                  `json:"pause"`
+	IsInfra          bool                  `json:"infra"`
 }
 
 // Type declaration and functions for sorting the PS output
@@ -241,8 +241,8 @@ func psCmd(c *cli.Context) error {
 		// only get running containers
 		filterFuncs = append(filterFuncs, func(c *libpod.Container) bool {
 			state, _ := c.State()
-			// Don't return pause containers
-			return state == libpod.ContainerStateRunning && !c.IsPause()
+			// Don't return infra containers
+			return state == libpod.ContainerStateRunning && !c.IsInfra()
 		})
 	}
 
@@ -420,7 +420,7 @@ func generateContainerFilterFuncs(filter, filterValue string, runtime *libpod.Ru
 }
 
 // generate the template based on conditions given
-func genPsFormat(format string, quiet, size, namespace, pod, pause bool) string {
+func genPsFormat(format string, quiet, size, namespace, pod, infra bool) string {
 	if format != "" {
 		// "\t" from the command line is not being recognized as a tab
 		// replacing the string "\t" to a tab character if the user passes in "\t"
@@ -441,8 +441,8 @@ func genPsFormat(format string, quiet, size, namespace, pod, pause bool) string
 	if size {
 		format += "{{.Size}}\t"
 	}
-	if pause {
-		format += "{{.IsPause}}\t"
+	if infra {
+		format += "{{.IsInfra}}\t"
 	}
 	return format
 }
@@ -578,7 +578,7 @@ func getTemplateOutput(psParams []psJSONParams, opts shared.PsOptions) ([]psTemp
 			Mounts:        getMounts(psParam.Mounts, opts.NoTrunc),
 			PID:           psParam.PID,
 			Pod:           pod,
-			IsPause:       psParam.IsPause,
+			IsInfra:       psParam.IsInfra,
 		}
 
 		if opts.Namespace {
@@ -635,7 +635,7 @@ func getAndSortJSONParams(containers []*libpod.Container, opts shared.PsOptions)
 			ContainerRunning: batchInfo.ConState == libpod.ContainerStateRunning,
 			Namespaces:       ns,
 			Pod:              ctr.PodID(),
-			IsPause:          ctr.IsPause(),
+			IsInfra:          ctr.IsInfra(),
 		}
 
 		psOutput = append(psOutput, params)
diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink
index 5c122d86f..18b705bb8 100644
--- a/cmd/podman/varlink/io.podman.varlink
+++ b/cmd/podman/varlink/io.podman.varlink
@@ -343,7 +343,7 @@ type PodCreate (
     cgroupParent: string,
     labels: [string]string,
     share: []string,
-    pause: bool
+    infra: bool
 )
 
 # ListPodData is the returned struct for an individual pod
@@ -656,7 +656,7 @@ method PullImage(name: string) -> (id: string)
 #   "pod": "b05dee7bd4ccfee688099fe1588a7a898d6ddd6897de9251d4671c9b0feacb2a"
 # }
 #
-# $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"create": {"pause": true, "share": ["ipc", "net", "uts"]}}'
+# $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"create": {"infra": true, "share": ["ipc", "net", "uts"]}}'
 # {
 #   "pod": "d7697449a8035f613c1a8891286502aca68fff7d5d49a85279b3bda229af3b28"
 # }
-- 
cgit v1.2.3-54-g00ecf