-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #906 from katiewasnothere/uvm_update_cpu_limits
Add uvm call for updating cpu limits
- Loading branch information
Showing
3 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* HCS API | ||
* | ||
* No description provided (generated by Swagger Codegen https:/swagger-api/swagger-codegen) | ||
* | ||
* API version: 2.4 | ||
* Generated by: Swagger Codegen (https:/swagger-api/swagger-codegen.git) | ||
*/ | ||
|
||
package hcsschema | ||
|
||
// ProcessorLimits is used when modifying processor scheduling limits of a virtual machine. | ||
type ProcessorLimits struct { | ||
// Maximum amount of host CPU resources that the virtual machine can use. | ||
Limit uint64 `json:"Limit,omitempty"` | ||
// Value describing the relative priority of this virtual machine compared to other virtual machines. | ||
Weight uint64 `json:"Weight,omitempty"` | ||
// Minimum amount of host CPU resources that the virtual machine is guaranteed. | ||
Reservation uint64 `json:"Reservation,omitempty"` | ||
// Provides the target maximum CPU frequency, in MHz, for a virtual machine. | ||
MaximumFrequencyMHz uint32 `json:"MaximumFrequencyMHz,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package uvm | ||
|
||
import ( | ||
"context" | ||
|
||
hcsschema "github.com/Microsoft/hcsshim/internal/schema2" | ||
) | ||
|
||
// UpdateCPULimits updates the CPU limits of the utility vm | ||
func (uvm *UtilityVM) UpdateCPULimits(ctx context.Context, limits *hcsschema.ProcessorLimits) error { | ||
req := &hcsschema.ModifySettingRequest{ | ||
ResourcePath: cpuLimitsResourcePath, | ||
Settings: limits, | ||
} | ||
|
||
return uvm.modify(ctx, req) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters