Return NotFound error for kill and delete in deleted state.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
3a3f0aac88
commit
dff7456804
@ -22,6 +22,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/containerd/console"
|
"github.com/containerd/console"
|
||||||
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/runtime/proc"
|
"github.com/containerd/containerd/runtime/proc"
|
||||||
google_protobuf "github.com/gogo/protobuf/types"
|
google_protobuf "github.com/gogo/protobuf/types"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@ -55,11 +56,11 @@ func (s *deletedState) Start(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *deletedState) Delete(ctx context.Context) error {
|
func (s *deletedState) Delete(ctx context.Context) error {
|
||||||
return errors.Errorf("cannot delete a deleted process")
|
return errors.Wrap(errdefs.ErrNotFound, "cannot delete a deleted process")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *deletedState) Kill(ctx context.Context, sig uint32, all bool) error {
|
func (s *deletedState) Kill(ctx context.Context, sig uint32, all bool) error {
|
||||||
return errors.Errorf("cannot kill a deleted process")
|
return errors.Wrap(errdefs.ErrNotFound, "cannot kill a deleted process")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *deletedState) SetExited(status int) {
|
func (s *deletedState) SetExited(status int) {
|
||||||
|
@ -87,7 +87,7 @@ func (t *Task) Namespace() string {
|
|||||||
// Delete the task and return the exit status
|
// Delete the task and return the exit status
|
||||||
func (t *Task) Delete(ctx context.Context) (*runtime.Exit, error) {
|
func (t *Task) Delete(ctx context.Context) (*runtime.Exit, error) {
|
||||||
rsp, err := t.shim.Delete(ctx, empty)
|
rsp, err := t.shim.Delete(ctx, empty)
|
||||||
if err != nil {
|
if err != nil && !errdefs.IsNotFound(err) {
|
||||||
return nil, errdefs.FromGRPC(err)
|
return nil, errdefs.FromGRPC(err)
|
||||||
}
|
}
|
||||||
t.tasks.Delete(ctx, t.id)
|
t.tasks.Delete(ctx, t.id)
|
||||||
|
@ -152,7 +152,7 @@ func (s *shim) Delete(ctx context.Context) (*runtime.Exit, error) {
|
|||||||
response, err := s.task.Delete(ctx, &task.DeleteRequest{
|
response, err := s.task.Delete(ctx, &task.DeleteRequest{
|
||||||
ID: s.ID(),
|
ID: s.ID(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil && errdefs.IsNotFound(err) {
|
||||||
return nil, errdefs.FromGRPC(err)
|
return nil, errdefs.FromGRPC(err)
|
||||||
}
|
}
|
||||||
if err := s.waitShutdown(ctx); err != nil {
|
if err := s.waitShutdown(ctx); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user