feature: cli supports --memory-reservation#2860
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2860 +/- ##
==========================================
- Coverage 69.1% 69.07% -0.03%
==========================================
Files 285 286 +1
Lines 17887 17903 +16
==========================================
+ Hits 12360 12366 +6
- Misses 4120 4131 +11
+ Partials 1407 1406 -1
|
b810783 to
268a54a
Compare
|
Is it necessary to validate memory-reservation in fuction validateResource? I'm not sure there is a limitation of kernel that memory-reservation should be less than memory? |
| return cgroupInfo.Memory.MemoryLimit | ||
| } | ||
|
|
||
| // IsMemoryReservationSupport checks if memory reservation cgroup is avaible |
There was a problem hiding this comment.
yes, it's a typo
|
Hi @KevinBetterQ , I was wondering if you could help to develop a new feature |
OK, I think it is a similar call in the code |
268a54a to
6d46cd1
Compare
| if memoryReservation == "" { | ||
| return 0, nil | ||
| } | ||
| result, err := units.RAMInBytes(memoryReservation) |
There was a problem hiding this comment.
how about direct return units.RAMInBytes(memoryReservation)
There was a problem hiding this comment.
if there is an error, the upper function will always return, will not care about the result. and will return directly to the run execution failure, so there is no need to set this value.
Is that right?
55c3bc2 to
ed5b3d3
Compare
| // test run with invalid memory reservation | ||
| cname := "TestRunWithMemoryReservationInvalid" | ||
| res := command.PouchRun("run", "-d", | ||
| "-m", "500m", |
There was a problem hiding this comment.
could we use less memory here? According to the testing machine, I am not sure that it will impact the case.
06e5afc to
41c9d02
Compare
Signed-off-by: KevinBetterQ <1093850932@qq.com>
41c9d02 to
fff42a7
Compare
Signed-off-by: KevinBetterQ 1093850932@qq.com
Ⅰ. Describe what this PR did
pouch command supports --memory-reservation
Ⅱ. Does this pull request fix one issue?
fixes #2701
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
added
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews