mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
runtime: handle unimplemented RPC call by NotFound status code
For now, agent return status of NotFound when calling getOOMEvents, runtime should handle it correctly. Fixes: #393 Signed-off-by: bin liu <bin@hyper.sh>
This commit is contained in:
parent
350831b18b
commit
a0a96db217
@ -35,5 +35,6 @@ func TestIsGRPCErrorCode(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
assert.True(isGRPCErrorCode(codes.Unimplemented, status.New(codes.Unimplemented, "foobar").Err()))
|
||||
assert.True(isGRPCErrorCode(codes.NotFound, status.New(codes.NotFound, "foobar").Err()))
|
||||
assert.False(isGRPCErrorCode(codes.Unimplemented, errors.New("foobar")))
|
||||
}
|
||||
|
@ -145,7 +145,8 @@ func watchOOMEvents(ctx context.Context, s *service) {
|
||||
logrus.WithField("sandbox", s.sandbox.ID()).WithError(err).Warn("failed to get OOM event from sandbox")
|
||||
// If the GetOOMEvent call is not implemented, then the agent is most likely an older version,
|
||||
// stop attempting to get OOM events.
|
||||
if isGRPCErrorCode(codes.Unimplemented, err) {
|
||||
// for rust agent, the response code is not found
|
||||
if isGRPCErrorCode(codes.NotFound, err) {
|
||||
return
|
||||
}
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user