Merge pull request #14366 from jwhonce/wip/rm_todo

Support remote deadlock errors in rm
This commit is contained in:
OpenShift Merge Robot
2022-05-25 18:23:30 -04:00
committed by GitHub

View File

@ -123,9 +123,7 @@ func rm(cmd *cobra.Command, args []string) error {
// removeContainers will set the exit code according to the `podman-rm` man // removeContainers will set the exit code according to the `podman-rm` man
// page. // page.
func removeContainers(namesOrIDs []string, rmOptions entities.RmOptions, setExit bool) error { func removeContainers(namesOrIDs []string, rmOptions entities.RmOptions, setExit bool) error {
var ( var errs utils.OutputErrors
errs utils.OutputErrors
)
responses, err := registry.ContainerEngine().ContainerRm(context.Background(), namesOrIDs, rmOptions) responses, err := registry.ContainerEngine().ContainerRm(context.Background(), namesOrIDs, rmOptions)
if err != nil { if err != nil {
if setExit { if setExit {
@ -135,8 +133,9 @@ func removeContainers(namesOrIDs []string, rmOptions entities.RmOptions, setExit
} }
for _, r := range responses { for _, r := range responses {
if r.Err != nil { if r.Err != nil {
// TODO this will not work with the remote client // When using the API, errors.Cause(err) will never equal constant define.ErrWillDeadLock
if errors.Cause(err) == define.ErrWillDeadlock { if errors.Cause(r.Err) == define.ErrWillDeadlock ||
errors.Cause(r.Err).Error() == define.ErrWillDeadlock.Error() {
logrus.Errorf("Potential deadlock detected - please run 'podman system renumber' to resolve") logrus.Errorf("Potential deadlock detected - please run 'podman system renumber' to resolve")
} }
if setExit { if setExit {