*: introduce wrapper pkgs for blockio and rdt

Before this patch, both the RdtEnabled and BlockIOEnabled are provided
by services/tasks pkg. Since the services/tasks can be pkg plugin which
can be initialized multiple times or concurrently. It will fire data-race
issue as there is no mutex to protect `enable`.

This patch is aimed to provide wrapper pkgs to use intel/{blockio,rdt}
safely.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
Wei Fu
2023-02-08 22:33:07 +08:00
parent 26509fa765
commit 62df35df66
16 changed files with 183 additions and 135 deletions

View File

@@ -27,6 +27,7 @@ import (
"github.com/containerd/containerd/containers"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/pkg/blockio"
"github.com/containerd/containerd/pkg/cri/annotations"
cstore "github.com/containerd/containerd/pkg/cri/store/container"
sstore "github.com/containerd/containerd/pkg/cri/store/sandbox"
@@ -247,7 +248,7 @@ func (a *nriAPI) WithContainerAdjustment() containerd.NewContainerOpts {
if className == "" {
return nil, nil
}
blockIO, err := blockIOToLinuxOci(className)
blockIO, err := blockio.ClassNameToLinuxOCI(className)
if err != nil {
return nil, err
}