mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-19 18:01:01 +00:00
Merge pull request #5101 from liubin/fix/5100-cpu-period-quota-data-type
kata-types: change return type of getting CPU period/quota function
This commit is contained in:
commit
42d4da9b6c
@ -383,17 +383,17 @@ impl Annotation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get the annotation of cpu quota for sandbox
|
/// Get the annotation of cpu quota for sandbox
|
||||||
pub fn get_sandbox_cpu_quota(&self) -> u64 {
|
pub fn get_sandbox_cpu_quota(&self) -> i64 {
|
||||||
let value = self
|
let value = self
|
||||||
.get_value::<u64>(SANDBOX_CPU_QUOTA_KEY)
|
.get_value::<i64>(SANDBOX_CPU_QUOTA_KEY)
|
||||||
.unwrap_or(Some(0));
|
.unwrap_or(Some(0));
|
||||||
value.unwrap_or(0)
|
value.unwrap_or(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the annotation of cpu period for sandbox
|
/// Get the annotation of cpu period for sandbox
|
||||||
pub fn get_sandbox_cpu_period(&self) -> i64 {
|
pub fn get_sandbox_cpu_period(&self) -> u64 {
|
||||||
let value = self
|
let value = self
|
||||||
.get_value::<i64>(SANDBOX_CPU_PERIOD_KEY)
|
.get_value::<u64>(SANDBOX_CPU_PERIOD_KEY)
|
||||||
.unwrap_or(Some(0));
|
.unwrap_or(Some(0));
|
||||||
value.unwrap_or(0)
|
value.unwrap_or(0)
|
||||||
}
|
}
|
||||||
|
@ -128,8 +128,8 @@ fn get_sizing_info(annotation: Annotation) -> Result<(u64, i64, i64)> {
|
|||||||
// since we are *adding* our result to the config, a value of 0 will cause no change
|
// since we are *adding* our result to the config, a value of 0 will cause no change
|
||||||
// and if the annotation is not assigned (but static resource management is), we will
|
// and if the annotation is not assigned (but static resource management is), we will
|
||||||
// log a *warning* to fill that with zero value
|
// log a *warning* to fill that with zero value
|
||||||
let period = annotation.get_sandbox_cpu_quota();
|
let period = annotation.get_sandbox_cpu_period();
|
||||||
let quota = annotation.get_sandbox_cpu_period();
|
let quota = annotation.get_sandbox_cpu_quota();
|
||||||
let memory = annotation.get_sandbox_mem();
|
let memory = annotation.get_sandbox_mem();
|
||||||
Ok((period, quota, memory))
|
Ok((period, quota, memory))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user