*: 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:
		| @@ -36,6 +36,7 @@ import ( | ||||
| 	"github.com/opencontainers/selinux/go-selinux/label" | ||||
| 	runtime "k8s.io/cri-api/pkg/apis/runtime/v1" | ||||
|  | ||||
| 	"github.com/containerd/containerd/pkg/blockio" | ||||
| 	"github.com/containerd/containerd/pkg/cri/annotations" | ||||
| 	"github.com/containerd/containerd/pkg/cri/config" | ||||
| 	customopts "github.com/containerd/containerd/pkg/cri/opts" | ||||
| @@ -270,7 +271,7 @@ func (c *criService) containerSpec( | ||||
| 		return nil, fmt.Errorf("failed to set blockio class: %w", err) | ||||
| 	} | ||||
| 	if blockIOClass != "" { | ||||
| 		if linuxBlockIO, err := blockIOToLinuxOci(blockIOClass); err == nil { | ||||
| 		if linuxBlockIO, err := blockio.ClassNameToLinuxOCI(blockIOClass); err == nil { | ||||
| 			specOpts = append(specOpts, oci.WithBlockIO(linuxBlockIO)) | ||||
| 		} else { | ||||
| 			return nil, err | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Wei Fu
					Wei Fu