diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2022-01-06 08:32:33 -0500 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2022-01-06 16:21:02 -0500 |
commit | 1941d45e327c54eb054d6f63d852dfebfe19c18b (patch) | |
tree | 1f79cde5f519715ac5b151f5e16cfb76b7b08ba1 /libpod/oci_conmon_linux.go | |
parent | d62752819214ee7f910e25d368d427fbcac74b17 (diff) | |
download | podman-1941d45e327c54eb054d6f63d852dfebfe19c18b.tar.gz podman-1941d45e327c54eb054d6f63d852dfebfe19c18b.tar.bz2 podman-1941d45e327c54eb054d6f63d852dfebfe19c18b.zip |
add OCI Runtime name to errors
It would be easier to diagnose OCI runtime errors if the error actually
had the name of the OCI runtime that produced the error.
[NO NEW TESTS NEEDED]
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/oci_conmon_linux.go')
-rw-r--r-- | libpod/oci_conmon_linux.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go index 5446a8f8a..3440507ed 100644 --- a/libpod/oci_conmon_linux.go +++ b/libpod/oci_conmon_linux.go @@ -1262,7 +1262,7 @@ func (r *ConmonOCIRuntime) createOCIContainer(ctr *Container, restoreOptions *Co return 0, err } - pid, err := readConmonPipeData(parentSyncPipe, ociLog) + pid, err := readConmonPipeData(r.name, parentSyncPipe, ociLog) if err != nil { if err2 := r.DeleteContainer(ctr); err2 != nil { logrus.Errorf("Removing container %s from runtime after creation failed", ctr.ID()) @@ -1564,7 +1564,7 @@ func readConmonPidFile(pidFile string) (int, error) { } // readConmonPipeData attempts to read a syncInfo struct from the pipe -func readConmonPipeData(pipe *os.File, ociLog string) (int, error) { +func readConmonPipeData(runtimeName string, pipe *os.File, ociLog string) (int, error) { // syncInfo is used to return data from monitor process to daemon type syncInfo struct { Data int `json:"data"` @@ -1600,7 +1600,7 @@ func readConmonPipeData(pipe *os.File, ociLog string) (int, error) { if err == nil { var ociErr ociError if err := json.Unmarshal(ociLogData, &ociErr); err == nil { - return -1, getOCIRuntimeError(ociErr.Msg) + return -1, getOCIRuntimeError(runtimeName, ociErr.Msg) } } } @@ -1613,13 +1613,13 @@ func readConmonPipeData(pipe *os.File, ociLog string) (int, error) { if err == nil { var ociErr ociError if err := json.Unmarshal(ociLogData, &ociErr); err == nil { - return ss.si.Data, getOCIRuntimeError(ociErr.Msg) + return ss.si.Data, getOCIRuntimeError(runtimeName, ociErr.Msg) } } } // If we failed to parse the JSON errors, then print the output as it is if ss.si.Message != "" { - return ss.si.Data, getOCIRuntimeError(ss.si.Message) + return ss.si.Data, getOCIRuntimeError(runtimeName, ss.si.Message) } return ss.si.Data, errors.Wrapf(define.ErrInternal, "container create failed") } |