-
Notifications
You must be signed in to change notification settings - Fork 43
Conversation
@jodh-intel @sameo please merge if you're fine with that. |
Good catch. The code looks good, but we clearly need some tests for this. Could you add some to |
@jodh-intel yes, I'm going to add a test in https://github.com/clearcontainers/tests |
@devimc - thanks. I think we do need a unit test too though as |
@jodh-intel sure, working on that |
the number of vCPUs must be calculated using CPU period and quota doesn't matter if a memory limit was specified or not fixes containers#540 Signed-off-by: Julio Montes <[email protected]>
@jodh-intel done, thanks |
Thanks @devimc - I've tested this and with your new test and the old code, lgtm |
coveralls shows a 3.5% drop in coverage with this PR. @devimc Could you please look at it? |
Hi @sameo , I can't see coveralls results
|
Hi @devimc - something odd is up with coveralls today. If you look at the 16.04 log file, you can see https://coveralls.io/jobs/32558455, but like #539 I think it's probably lying about the drop in coverage (you could test that locally I guess). |
@jodh-intel yep, I think the same (coverall lied)
|
LGTM then |
|
||
if period == 0 { | ||
return vc.Resources{}, fmt.Errorf("Invalid OCI cpu period %d", period) | ||
// round up to 1 CPU |
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.
Just noting - we discussed in a call that we should ensure we understood what this was doing iirc (in particular when it was written in the original/expanded form with real values - like 10000 + (20000 - 1) / 20000
. I had a stare and think, and yes, this does the expected and works out how many 'whole cpus' the given quota gets us given the period - but the above round up to 1 CPU
comment is slightly misleading - it is really rounding up to ensure we have at least 1 CPU
aiui. Just for the record.
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.
Thanks for the analysis @grahamwhaley. I think you should submit a PR to fix the comment and maybe be more verbose about the reason why this is the right way to compute the number of CPUs.
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.
the number of vCPUs must be calculated using CPU period and quota
doesn't matter if a memory limit was specified or not
fixes #540
Signed-off-by: Julio Montes [email protected]