mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-28 19:54:35 +00:00
virtcontainers: tests fix, nit fix
[ port from runtime commit b4833a48c81132e5a6b1c25a764cd0ebbdc6afff ] fix tests and nit Signed-off-by: Alex Price <aprice@atlassian.com> Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
parent
d3b3e8bee6
commit
9f8d1baa57
@ -38,7 +38,7 @@ func startContainer(ctx context.Context, s *service, c *container) error {
|
||||
go watchSandbox(s)
|
||||
|
||||
// Start watching for oom events
|
||||
go watchOOMEvents(s)
|
||||
go watchOOMEvents(ctx, s)
|
||||
} else {
|
||||
_, err := s.sandbox.StartContainer(c.id)
|
||||
if err != nil {
|
||||
|
@ -6,6 +6,7 @@
|
||||
package containerdshim
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
@ -128,14 +129,14 @@ func watchSandbox(s *service) {
|
||||
// No need to send async events here.
|
||||
}
|
||||
|
||||
func watchOOMEvents(s *service) {
|
||||
func watchOOMEvents(ctx context.Context, s *service) {
|
||||
if s.sandbox == nil {
|
||||
return
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-s.ctx.Done():
|
||||
case <-ctx.Done():
|
||||
return
|
||||
default:
|
||||
containerID, err := s.sandbox.GetOOMEvent()
|
||||
|
@ -2389,9 +2389,8 @@ func (k *kataAgent) getOOMEvent() (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
oomEvent, ok := result.(*grpc.OOMEvent)
|
||||
if ok {
|
||||
return oomEvent.ContainerId, err
|
||||
if oomEvent, ok := result.(*grpc.OOMEvent); ok {
|
||||
return oomEvent.ContainerId, nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user