mirror of
https://github.com/kata-containers/cgroups-rs.git
synced 2026-08-05 02:13:23 +00:00
Use Option as resource fields, remove the update switch: update_values
Use idiomatic Option::None to represent optional fields. This enables updates where not all fields need to be specified. Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit is contained in:
+5
-6
@@ -54,14 +54,13 @@ impl ControllerInternal for HugeTlbController {
|
||||
// get the resources that apply to this controller
|
||||
let res: &HugePageResources = &res.hugepages;
|
||||
|
||||
if res.update_values {
|
||||
for i in &res.limits {
|
||||
let _ = self.set_limit_in_bytes(&i.size, i.limit);
|
||||
if self.limit_in_bytes(&i.size)? != i.limit {
|
||||
return Err(Error::new(Other));
|
||||
}
|
||||
for i in &res.limits {
|
||||
let _ = self.set_limit_in_bytes(&i.size, i.limit);
|
||||
if self.limit_in_bytes(&i.size)? != i.limit {
|
||||
return Err(Error::new(Other));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user