-
Notifications
You must be signed in to change notification settings - Fork 43
pkg: oci: support OCI spec cpu quota/period #344
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment but the change looks fine :)
pkg/oci/utils.go
Outdated
quota := *ocispec.Linux.Resources.CPU.Quota | ||
period := *ocispec.Linux.Resources.CPU.Period | ||
|
||
if quota < 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to test:
if quota <= 0 {
as we did for the memory. Otherwise, in case quota == 0
, we are gonna end up with resources.VCPUs = 0
because (period -1) / period
will return 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I also will check period is not zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes good point !
We should run VM(container) regarding OCI spec config.json cpu quota and period. The number of VM VCPUs is defined by quota/period (round up to 1). Signed-off-by: WANG Chao <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM |
@jodh-intel @grahamwhaley please give us your opinion before I merge this. |
Mention that although `--cpus` is not supported, `--cpu-quota` and `--cpu-period` are [1]. Fixes clearcontainers#494. [1] - See containers/virtcontainers#344 and clearcontainers#436. Signed-off-by: James O. D. Hunt <[email protected]>
Mention that although `--cpus` is not supported, `--cpu-quota` and `--cpu-period` are [1]. Fixes clearcontainers#494. [1] - See containers/virtcontainers#344 and clearcontainers#436. Signed-off-by: James O. D. Hunt <[email protected]>
We should run VM(container) regarding OCI spec config.json cpu quota and
period.
The number of VM VCPUs is defined by quota/period (round up to 1).
Signed-off-by: WANG Chao [email protected]
--
Original issues is clearcontainers/runtime#393