mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-05 00:15:44 +00:00
libpod: remove LegacyExecSessions
This have been deprecated in podman 1.9, it is safe to assume they are no longer used by anyone one a recent version. If someone would update from the old version to 6+ they would run into much more issues already so this can be safely dropped IMO. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
ae04ee07b1
commit
cd6807c7c0
3 changed files with 14 additions and 46 deletions
|
|
@ -165,10 +165,6 @@ type ContainerState struct {
|
|||
// 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"`
|
||||
// NetNS is the path or name of the NetNS
|
||||
NetNS string `json:"netns,omitempty"`
|
||||
// NetworkStatus contains the network Status for all networks
|
||||
|
|
|
|||
|
|
@ -159,14 +159,6 @@ func (e *ExecSession) Inspect() (*define.InspectExecSession, error) {
|
|||
return output, nil
|
||||
}
|
||||
|
||||
// legacyExecSession contains information on an active exec session. It is a
|
||||
// holdover from a previous Podman version and is DEPRECATED.
|
||||
type legacyExecSession struct {
|
||||
ID string `json:"id"`
|
||||
Command []string `json:"command"`
|
||||
PID int `json:"pid"`
|
||||
}
|
||||
|
||||
func (c *Container) verifyExecConfig(config *ExecConfig) error {
|
||||
if config == nil {
|
||||
return fmt.Errorf("must provide a configuration to ExecCreate: %w", define.ErrInvalidArg)
|
||||
|
|
@ -963,11 +955,6 @@ func (c *Container) getExecSessionPID(sessionID string) (int, string, error) {
|
|||
if ok {
|
||||
return session.PID, session.PIDData, nil
|
||||
}
|
||||
oldSession, ok := c.state.LegacyExecSessions[sessionID]
|
||||
if ok {
|
||||
return oldSession.PID, "", nil
|
||||
}
|
||||
|
||||
return -1, "", fmt.Errorf("no exec session with ID %s found in container %s: %w", sessionID, c.ID(), define.ErrNoSuchExecSession)
|
||||
}
|
||||
|
||||
|
|
@ -977,12 +964,6 @@ func (c *Container) getExecSessionPID(sessionID string) (int, string, error) {
|
|||
// function performs further checks to return an accurate list.
|
||||
func (c *Container) getKnownExecSessions() []string {
|
||||
knownSessions := []string{}
|
||||
// First check legacy sessions.
|
||||
// TODO: This is DEPRECATED and will be removed in a future major
|
||||
// release.
|
||||
for sessionID := range c.state.LegacyExecSessions {
|
||||
knownSessions = append(knownSessions, sessionID)
|
||||
}
|
||||
// Next check new exec sessions, but only if in running state
|
||||
for sessionID, session := range c.state.ExecSessions {
|
||||
if session.State == define.ExecStateRunning {
|
||||
|
|
@ -996,7 +977,6 @@ func (c *Container) getKnownExecSessions() []string {
|
|||
// getActiveExecSessions checks if there are any active exec sessions in the
|
||||
// current container. Returns an array of active exec sessions.
|
||||
// Will continue through errors where possible.
|
||||
// Currently handles both new and legacy, deprecated exec sessions.
|
||||
func (c *Container) getActiveExecSessions() ([]string, error) {
|
||||
activeSessions := []string{}
|
||||
knownSessions := c.getKnownExecSessions()
|
||||
|
|
@ -1014,11 +994,6 @@ func (c *Container) getActiveExecSessions() ([]string, error) {
|
|||
continue
|
||||
}
|
||||
if !alive {
|
||||
_, isLegacy := c.state.LegacyExecSessions[id]
|
||||
if isLegacy {
|
||||
delete(c.state.LegacyExecSessions, id)
|
||||
needSave = true
|
||||
} else {
|
||||
session := c.state.ExecSessions[id]
|
||||
exitCode, err := c.readExecExitCode(session.ID())
|
||||
if err != nil {
|
||||
|
|
@ -1033,9 +1008,8 @@ func (c *Container) getActiveExecSessions() ([]string, error) {
|
|||
session.State = define.ExecStateStopped
|
||||
|
||||
c.newExecDiedEvent(session.ID(), exitCode)
|
||||
|
||||
needSave = true
|
||||
}
|
||||
|
||||
if err := c.cleanupExecBundle(id); err != nil {
|
||||
if lastErr != nil {
|
||||
logrus.Errorf("Checking container %s exec sessions: %v", c.ID(), lastErr)
|
||||
|
|
@ -1091,7 +1065,6 @@ func (c *Container) removeAllExecSessions() error {
|
|||
}
|
||||
}
|
||||
c.state.ExecSessions = nil
|
||||
c.state.LegacyExecSessions = nil
|
||||
|
||||
return lastErr
|
||||
}
|
||||
|
|
|
|||
|
|
@ -636,7 +636,6 @@ func resetContainerState(state *ContainerState) {
|
|||
state.State = define.ContainerStateConfigured
|
||||
}
|
||||
state.ExecSessions = make(map[string]*ExecSession)
|
||||
state.LegacyExecSessions = nil
|
||||
state.BindMounts = make(map[string]string)
|
||||
state.RestartPolicyMatch = false
|
||||
state.RestartCount = 0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue