diff --git a/option_parser/src/lib.rs b/option_parser/src/lib.rs index fb2dbfc83..ac3dd3885 100644 --- a/option_parser/src/lib.rs +++ b/option_parser/src/lib.rs @@ -290,6 +290,17 @@ impl TupleValue for Vec { } } +impl TupleValue for Vec { + fn parse_value(input: &str) -> Result { + Ok(IntegerList::from_str(input) + .map_err(TupleError::InvalidIntegerList)? + .0 + .iter() + .map(|v| *v as usize) + .collect()) + } +} + pub struct Tuple(pub Vec<(S, T)>); pub enum TupleError { diff --git a/vmm/src/config.rs b/vmm/src/config.rs index 1cc8f4225..76af2a0a6 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -590,7 +590,7 @@ impl CpusConfig { .map_err(Error::ParseCpus)? .unwrap_or(DEFAULT_MAX_PHYS_BITS); let affinity = parser - .convert::>>("affinity") + .convert::>>("affinity") .map_err(Error::ParseCpus)? .map(|v| { v.0.iter() diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 226b495b3..e79ec275a 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -479,7 +479,7 @@ pub struct CpuManager { #[cfg_attr(target_arch = "aarch64", allow(dead_code))] acpi_address: Option, proximity_domain_per_cpu: BTreeMap, - affinity: BTreeMap>, + affinity: BTreeMap>, dynamic: bool, hypervisor: Arc, } @@ -921,7 +921,7 @@ impl CpuManager { unsafe { libc::CPU_ZERO(&mut cpuset) }; for host_cpu in host_cpus { // SAFETY: FFI call, trivially safe - unsafe { libc::CPU_SET(*host_cpu as usize, &mut cpuset) }; + unsafe { libc::CPU_SET(*host_cpu, &mut cpuset) }; } cpuset }); diff --git a/vmm/src/vm_config.rs b/vmm/src/vm_config.rs index 1b286845e..58b397c0b 100644 --- a/vmm/src/vm_config.rs +++ b/vmm/src/vm_config.rs @@ -10,7 +10,7 @@ use virtio_devices::RateLimiterConfig; #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] pub struct CpuAffinity { pub vcpu: u8, - pub host_cpus: Vec, + pub host_cpus: Vec, } #[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize)]