summaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-03-19 22:09:40 +0100
committerGitHub <noreply@github.com>2020-03-19 22:09:40 +0100
commitaa6c8c2e55a7de14fb22f89af14d5c0636eecee0 (patch)
tree20bb10c738de05c0e323c9ac737d8a7bd5c184f2 /libpod/container.go
parentc1ff17acfa647c62fcb8ca6b8f3d15ff45100fb0 (diff)
parente89c6382ae26b6d611106360fdba4f3f304e5616 (diff)
downloadpodman-aa6c8c2e55a7de14fb22f89af14d5c0636eecee0.tar.gz
podman-aa6c8c2e55a7de14fb22f89af14d5c0636eecee0.tar.bz2
podman-aa6c8c2e55a7de14fb22f89af14d5c0636eecee0.zip
Merge pull request #5088 from mheon/begin_exec_rework
Begin exec rework
Diffstat (limited to 'libpod/container.go')
-rw-r--r--libpod/container.go25
1 files changed, 11 insertions, 14 deletions
diff --git a/libpod/container.go b/libpod/container.go
index d83de93bb..e59fb9fe8 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -181,9 +181,13 @@ type ContainerState struct {
PID int `json:"pid,omitempty"`
// ConmonPID is the PID of the container's conmon
ConmonPID int `json:"conmonPid,omitempty"`
- // ExecSessions contains active exec sessions for container
- // Exec session ID is mapped to PID of exec process
- ExecSessions map[string]*ExecSession `json:"execSessions,omitempty"`
+ // ExecSessions contains all exec sessions that are associated with this
+ // container.
+ ExecSessions map[string]*ExecSession `json:"newExecSessions,omitempty"`
+ // LegacyExecSessions are legacy exec sessions from older versions of
+ // Podman.
+ // These are DEPRECATED and will be removed in a future release.
+ LegacyExecSessions map[string]*legacyExecSession `json:"execSessions,omitempty"`
// NetworkStatus contains the configuration results for all networks
// the pod is attached to. Only populated if we created a network
// namespace for the container, and the network namespace is currently
@@ -214,13 +218,6 @@ type ContainerState struct {
containerPlatformState
}
-// ExecSession contains information on an active exec session
-type ExecSession struct {
- ID string `json:"id"`
- Command []string `json:"command"`
- PID int `json:"pid"`
-}
-
// ContainerConfig contains all information that was used to create the
// container. It may not be changed once created.
// It is stored, read-only, on disk
@@ -944,13 +941,13 @@ func (c *Container) ExecSession(id string) (*ExecSession, error) {
session, ok := c.state.ExecSessions[id]
if !ok {
- return nil, errors.Wrapf(define.ErrNoSuchCtr, "no exec session with ID %s found in container %s", id, c.ID())
+ return nil, errors.Wrapf(define.ErrNoSuchExecSession, "no exec session with ID %s found in container %s", id, c.ID())
}
returnSession := new(ExecSession)
- returnSession.ID = session.ID
- returnSession.Command = session.Command
- returnSession.PID = session.PID
+ if err := JSONDeepCopy(session, returnSession); err != nil {
+ return nil, errors.Wrapf(err, "error copying contents of container %s exec session %s", c.ID(), session.ID())
+ }
return returnSession, nil
}