mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Rename NUMA option 'id' into 'guest_numa_id'
The goal of this commit is to rename the existing NUMA option 'id' with 'guest_numa_id'. This is done without any modification to the way this option behaves. The reason for the rename is caused by the observation that all other parameters with an option called 'id' expect a string to be provided. Because in this particular case we expect a u32 representing a proximity domain from the ACPI specification, it's better to name it with a more explicit name. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -736,10 +736,10 @@ components:
|
||||
|
||||
NumaConfig:
|
||||
required:
|
||||
- id
|
||||
- guest_numa_id
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
guest_numa_id:
|
||||
type: integer
|
||||
format: uint32
|
||||
cpus:
|
||||
|
||||
@@ -1223,7 +1223,7 @@ pub struct NumaDistance {
|
||||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, Default)]
|
||||
pub struct NumaConfig {
|
||||
#[serde(default)]
|
||||
pub id: u32,
|
||||
pub guest_numa_id: u32,
|
||||
#[serde(default)]
|
||||
pub cpus: Option<Vec<u8>>,
|
||||
#[serde(default)]
|
||||
@@ -1234,19 +1234,19 @@ pub struct NumaConfig {
|
||||
|
||||
impl NumaConfig {
|
||||
pub const SYNTAX: &'static str = "Settings related to a given NUMA node \
|
||||
\"id=<node_id>,cpus=<cpus_id>,distances=<list_of_distances_to_destination_nodes>,\
|
||||
\"guest_numa_id=<node_id>,cpus=<cpus_id>,distances=<list_of_distances_to_destination_nodes>,\
|
||||
memory_zones=<list_of_memory_zones>\"";
|
||||
pub fn parse(numa: &str) -> Result<Self> {
|
||||
let mut parser = OptionParser::new();
|
||||
parser
|
||||
.add("id")
|
||||
.add("guest_numa_id")
|
||||
.add("cpus")
|
||||
.add("distances")
|
||||
.add("memory_zones");
|
||||
parser.parse(numa).map_err(Error::ParseNuma)?;
|
||||
|
||||
let id = parser
|
||||
.convert::<u32>("id")
|
||||
let guest_numa_id = parser
|
||||
.convert::<u32>("guest_numa_id")
|
||||
.map_err(Error::ParseNuma)?
|
||||
.unwrap_or(0);
|
||||
let cpus = parser
|
||||
@@ -1270,7 +1270,7 @@ impl NumaConfig {
|
||||
.map(|v| v.0);
|
||||
|
||||
Ok(NumaConfig {
|
||||
id,
|
||||
guest_numa_id,
|
||||
cpus,
|
||||
distances,
|
||||
memory_zones,
|
||||
|
||||
@@ -377,10 +377,10 @@ impl Vm {
|
||||
let mut numa_nodes = BTreeMap::new();
|
||||
|
||||
if let Some(configs) = &configs {
|
||||
let node_id_list: Vec<u32> = configs.iter().map(|cfg| cfg.id).collect();
|
||||
let node_id_list: Vec<u32> = configs.iter().map(|cfg| cfg.guest_numa_id).collect();
|
||||
|
||||
for config in configs.iter() {
|
||||
if numa_nodes.contains_key(&config.id) {
|
||||
if numa_nodes.contains_key(&config.guest_numa_id) {
|
||||
error!("Can't define twice the same NUMA node");
|
||||
return Err(Error::InvalidNumaConfig);
|
||||
}
|
||||
@@ -425,7 +425,7 @@ impl Vm {
|
||||
}
|
||||
}
|
||||
|
||||
numa_nodes.insert(config.id, node);
|
||||
numa_nodes.insert(config.guest_numa_id, node);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user