Skip to content

add v2 support #1

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

Open
wants to merge 25 commits into
base: base
Choose a base branch
from
Open

add v2 support #1

wants to merge 25 commits into from

Conversation

liubin
Copy link
Owner

@liubin liubin commented Sep 7, 2020

No description provided.

src/blkio.rs Outdated
let mut content = format!("{}:{} {}", major, minor, iops);
if self.v2 {
file = "io.max";
content = format!("{}:{} riops={}", major, minor, iops);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里应该是 wriops

let mut file = "blkio.weight_device";
if self.v2 {
// FIXME why is there no weight for device in runc ?
// https://github.com/opencontainers/runc/blob/46be7b612e2533c494e6a251111de46d8e286ed5/libcontainer/cgroups/fs2/io.go#L30
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好像跟 io 调度算法有关 。https://wiki.ubuntu.com/Kernel/Reference/IOSchedulers

tests/devices.rs Outdated

#[test]
fn test_devices_parsing() {
let hier = cgroups::hierarchies::V1::new();
let cg = Cgroup::new(&hier, String::from("test_devices_parsing"));
// no only v2
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no -> now

tests/hugetlb.rs Outdated

#[test]
fn test_hugetlb_sizes() {
// no only v2
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no -> now

src/blkio.rs Outdated
fn apply(&self, res: &Resources) -> Result<()> {
// get the resources that apply to this controller
let res: &BlkIoResources = &res.blkio;

if res.update_values {
let _ = self.set_weight(res.weight as u64);
let _ = self.set_leaf_weight(res.leaf_weight as u64);
if res.weight.is_some() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方的几个 判断 is_some 的句式 改成下面的样子吧:
if let Some(weight) = res.weight {
let _ = self.set_weight(weight as u64);
}

liubin and others added 11 commits September 9, 2020 13:27
Signed-off-by: bin liu <[email protected]>
cfs_quota can be set to -1 to indicate no limit

Fixes: levex#5

Signed-off-by: bin liu <[email protected]>
Errors cause should be shared to let anyhow to wrap it.

Fixes: levex#7

Signed-off-by: bin liu <[email protected]>
cpu: change cfs_quota from u64 to i64
…-cause

errors: add sync marker to error cause
c_char is equal to i8 on x86, but it is equal to u8 on arm arch,
so we need to use type c_char instead of i8 to avoid compiling error.

Fixes: levex#9

Signed-off-by: zhanghj <[email protected]>
…-aarch64

lib: fix compiling error for type i8 in aarch64 environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants