mirror of
https://github.com/containers/podman.git
synced 2025-07-04 10:10:32 +08:00
oci: use --full-path
option for conmon
and stop relying on socket path Signed-off-by: Peter Hunt <pehunt@redhat.com>
This commit is contained in:
@ -284,14 +284,8 @@ func (r *ConmonOCIRuntime) ExecUpdateStatus(ctr *Container, sessionID string) (b
|
|||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecContainerCleanup cleans up files created when a command is run via
|
// ExecContainerCleanup cleans up files created when a command is run via ExecContainer.
|
||||||
// ExecContainer. This includes the attach socket for the exec session.
|
|
||||||
func (r *ConmonOCIRuntime) ExecContainerCleanup(ctr *Container, sessionID string) error {
|
func (r *ConmonOCIRuntime) ExecContainerCleanup(ctr *Container, sessionID string) error {
|
||||||
// Clean up the sockets dir. Issue #3962
|
|
||||||
// Also ignore if it doesn't exist for some reason; hence the conditional return below
|
|
||||||
if err := os.RemoveAll(filepath.Join(r.socketsDir, sessionID)); err != nil && !os.IsNotExist(err) {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,7 +296,7 @@ func (r *ConmonOCIRuntime) ExecAttachSocketPath(ctr *Container, sessionID string
|
|||||||
return "", errors.Wrapf(define.ErrInvalidArg, "must provide a valid session ID to get attach socket path")
|
return "", errors.Wrapf(define.ErrInvalidArg, "must provide a valid session ID to get attach socket path")
|
||||||
}
|
}
|
||||||
|
|
||||||
return filepath.Join(r.socketsDir, sessionID, "attach"), nil
|
return filepath.Join(ctr.execBundlePath(sessionID), "attach"), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// This contains pipes used by the exec API.
|
// This contains pipes used by the exec API.
|
||||||
|
@ -59,7 +59,6 @@ type ConmonOCIRuntime struct {
|
|||||||
conmonEnv []string
|
conmonEnv []string
|
||||||
tmpDir string
|
tmpDir string
|
||||||
exitsDir string
|
exitsDir string
|
||||||
socketsDir string
|
|
||||||
logSizeMax int64
|
logSizeMax int64
|
||||||
noPivot bool
|
noPivot bool
|
||||||
reservePorts bool
|
reservePorts bool
|
||||||
@ -149,7 +148,6 @@ func newConmonOCIRuntime(name string, paths []string, conmonPath string, runtime
|
|||||||
}
|
}
|
||||||
|
|
||||||
runtime.exitsDir = filepath.Join(runtime.tmpDir, "exits")
|
runtime.exitsDir = filepath.Join(runtime.tmpDir, "exits")
|
||||||
runtime.socketsDir = filepath.Join(runtime.tmpDir, "socket")
|
|
||||||
|
|
||||||
// Create the exit files and attach sockets directories
|
// Create the exit files and attach sockets directories
|
||||||
if err := os.MkdirAll(runtime.exitsDir, 0750); err != nil {
|
if err := os.MkdirAll(runtime.exitsDir, 0750); err != nil {
|
||||||
@ -158,13 +156,6 @@ func newConmonOCIRuntime(name string, paths []string, conmonPath string, runtime
|
|||||||
return nil, errors.Wrapf(err, "error creating OCI runtime exit files directory")
|
return nil, errors.Wrapf(err, "error creating OCI runtime exit files directory")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := os.MkdirAll(runtime.socketsDir, 0750); err != nil {
|
|
||||||
// The directory is allowed to exist
|
|
||||||
if !os.IsExist(err) {
|
|
||||||
return nil, errors.Wrap(err, "error creating OCI runtime attach sockets directory")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return runtime, nil
|
return runtime, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -865,7 +856,7 @@ func (r *ConmonOCIRuntime) AttachSocketPath(ctr *Container) (string, error) {
|
|||||||
return "", errors.Wrapf(define.ErrInvalidArg, "must provide a valid container to get attach socket path")
|
return "", errors.Wrapf(define.ErrInvalidArg, "must provide a valid container to get attach socket path")
|
||||||
}
|
}
|
||||||
|
|
||||||
return filepath.Join(r.socketsDir, ctr.ID(), "attach"), nil
|
return filepath.Join(ctr.bundlePath(), "attach"), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExitFilePath is the path to a container's exit file.
|
// ExitFilePath is the path to a container's exit file.
|
||||||
@ -1240,7 +1231,7 @@ func (r *ConmonOCIRuntime) sharedConmonArgs(ctr *Container, cuuid, bundlePath, p
|
|||||||
"-p", pidPath,
|
"-p", pidPath,
|
||||||
"-n", ctr.Name(),
|
"-n", ctr.Name(),
|
||||||
"--exit-dir", exitDir,
|
"--exit-dir", exitDir,
|
||||||
"--socket-dir-path", r.socketsDir,
|
"--full-attach",
|
||||||
}
|
}
|
||||||
if len(r.runtimeFlags) > 0 {
|
if len(r.runtimeFlags) > 0 {
|
||||||
rFlags := []string{}
|
rFlags := []string{}
|
||||||
|
Reference in New Issue
Block a user