-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a relative_network_cgroups test as one of the integration tests #2986
base: main
Are you sure you want to change the base?
Conversation
4696ba0
to
b332eb0
Compare
Hey, thanks for the PR :) |
test_outside_container(spec, &|data| { | ||
test_result!(check_container_created(&data)); | ||
TestResult::Passed | ||
}) |
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.
Hey, here along with checking if the container is created, we also need validation for the created network cgroup resources - In the original test we call this function which does the validation, so need that here as well.
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.
Thank you.
Added validation for the created network cgroup resources.
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.
Hey, I don't think it is fixed yet. Let me clarify in case there is any confusion -
- In the original go test, at line https://github.com/opencontainers/runtime-tools/blob/master/validation/linux_cgroups_relative_network/linux_cgroups_relative_network.go#L24C1-L24C77, in the
test_outside_container
, they are passingutil.ValidateLinuxResourcesNetwork
function, which will do the validation that ok, the runtime has actually setup the relative network correctly. - The
util.ValidateLinuxResourcesNetwork
function defined at https://github.com/opencontainers/runtime-tools/blob/master/validation/util/linux_resources_network.go#L12 does the checking and validation of relative network cgroup. - The change you did in the last commit you pushed is actually almost a no-op. The original way of just calling the
test_outside_container
was correct, but also needs the cgroup checking logic as mentioned above.
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.
I added a new validate_network()
and changed the program to validate net_cls.classid and net_prio.ifpriomap.
However, network.rs only verifies check_container_created(&data)
.
Am I understanding this wrong?
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.
- validation of this test using runc is failing, can you check?
- If I'm correct, this is applicable only to cgroups v1, right?
let test_result = test_outside_container(spec.clone(), &|data| { | ||
test_result!(check_container_created(&data)); | ||
test_result!(validate_network(cgroup_name, &spec)); | ||
TestResult::Passed | ||
}); | ||
if let TestResult::Failed(_) = test_result { | ||
return test_result; | ||
} | ||
|
||
TestResult::Passed |
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.
You can just return the test_outside_container value like this -
let test_result = test_outside_container(spec.clone(), &|data| { | |
test_result!(check_container_created(&data)); | |
test_result!(validate_network(cgroup_name, &spec)); | |
TestResult::Passed | |
}); | |
if let TestResult::Failed(_) = test_result { | |
return test_result; | |
} | |
TestResult::Passed | |
test_outside_container(spec.clone(), &|data| { | |
test_result!(check_container_created(&data)); | |
test_result!(validate_network(cgroup_name, &spec)); | |
TestResult::Passed | |
}) |
The if let
part here is basically a no-op
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.
Unnecessary programs have been removed.
ca7ab449
let cgroup_path = PathBuf::from(CGROUP_ROOT) | ||
.join("net_cls,net_prio/runtime-test") | ||
.join(cgroup_name); |
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.
Is it ok to hard-code this here? I think in the can_run
below you mention the cgroup can be at a couple of different points.
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.
Address multiple network cgroup mount points.
Changed where to get paths for net_cls.classid
and net_prio.ifpriomap
.
ca7ab449
Signed-off-by: moz-sec <[email protected]>
Signed-off-by: moz-sec <[email protected]>
….ifpriomap Signed-off-by: moz-sec <[email protected]>
Signed-off-by: moz-sec <[email protected]>
2a8b217
to
ca7ab44
Compare
@YJDoc2 |
@YJDoc2 |
Hey @moz-sec , that makes sense. I have been busy for some time, and wasn't able to take more detailed look after your changes, apologies. Please go ahead with the implementation as discussed with utam0k. Do you plan to do it in this PR only, or a separate PR (I'm fine with either). Thanks :) |
@YJDoc2 |
This implements the relative_network_cgroups validation in #361 .
I wrote it based on linux_cgroups_relative_network.go from
opencontainers/runtime-tools
and tests/cgroups/network.rs fromyouki-dev/youki
.