Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions internal/uvm/cpulimits_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ import (

"github.com/Microsoft/hcsshim/internal/hcs/resourcepaths"
hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2"
"github.com/Microsoft/hcsshim/osversion"
"github.com/containerd/errdefs"
)

// UpdateCPULimits updates the CPU limits of the utility vm
func (uvm *UtilityVM) UpdateCPULimits(ctx context.Context, limits *hcsschema.ProcessorLimits) error {
// Support for updating CPU limits was not added until 20H2 build
if osversion.Get().Build < osversion.V20H2 {
return errdefs.ErrNotImplemented
}
req := &hcsschema.ModifySettingRequest{
ResourcePath: resourcepaths.CPULimitsResourcePath,
Settings: limits,
Expand Down
3 changes: 3 additions & 0 deletions test/cri-containerd/pod_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import (
"testing"

"github.com/Microsoft/hcsshim/internal/memory"
"github.com/Microsoft/hcsshim/osversion"
"github.com/Microsoft/hcsshim/pkg/annotations"
"github.com/Microsoft/hcsshim/test/pkg/definitions/cpugroup"
"github.com/Microsoft/hcsshim/test/pkg/definitions/processorinfo"
"github.com/Microsoft/hcsshim/test/pkg/require"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
)

Expand Down Expand Up @@ -132,6 +134,7 @@ func Test_Pod_UpdateResources_Memory_PA(t *testing.T) {

func Test_Pod_UpdateResources_CPUShares(t *testing.T) {
requireAnyFeature(t, featureWCOWHypervisor)
require.Build(t, osversion.V20H2)

type config struct {
name string
Expand Down