mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Enforce guest_numa_id on NUMA nodes
The documentation says guest_numa_id is required to be unique and therefore the parser() giving default value for non-existing guest_numa_id with .unwrap_or(0) is dangerous. Return a validation error if guest_numa_id is not provided instead of silently defaulting to 0. Signed-off-by: Saravanan D <saravanand@crusoe.ai>
This commit is contained in:
committed by
Rob Bradford
parent
9ba9c0819a
commit
231bbe2d5d
@@ -2202,7 +2202,11 @@ impl NumaConfig {
|
||||
let guest_numa_id = parser
|
||||
.convert::<u32>("guest_numa_id")
|
||||
.map_err(Error::ParseNuma)?
|
||||
.unwrap_or(0);
|
||||
.ok_or_else(|| {
|
||||
Error::ParseNuma(OptionParserError::InvalidValue(
|
||||
"guest_numa_id is required for all NUMA nodes".to_string(),
|
||||
))
|
||||
})?;
|
||||
let cpus = parser
|
||||
.convert::<IntegerList>("cpus")
|
||||
.map_err(Error::ParseNuma)?
|
||||
|
||||
Reference in New Issue
Block a user