mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Add device_id field to NUMA configuration
Add an optional device_id string field to NumaConfig for identifying PCI devices associated with a NUMA node. This is used by the Generic Initiator support to map devices to their proximity domain. Update OpenAPI spec (cloud-hypervisor.yaml) to include the new device_id field in the NumaConfig schema. The device_id is optional and parsed from the --numa parameter: --numa "device_id=<device_id>,distances=[...],..." The optional field is accepted but not used. Signed-off-by: Saravanan D <saravanand@crusoe.ai>
This commit is contained in:
committed by
Rob Bradford
parent
231bbe2d5d
commit
6d4827b5ff
@@ -120,6 +120,7 @@ pub struct NumaNode {
|
||||
pub pci_segments: Vec<u16>,
|
||||
pub distances: BTreeMap<u32, u8>,
|
||||
pub memory_zones: Vec<String>,
|
||||
pub device_id: Option<String>,
|
||||
}
|
||||
|
||||
pub type NumaNodes = BTreeMap<u32, NumaNode>;
|
||||
|
||||
@@ -1203,6 +1203,8 @@ components:
|
||||
items:
|
||||
type: integer
|
||||
format: int32
|
||||
device_id:
|
||||
type: string
|
||||
|
||||
VmResize:
|
||||
type: object
|
||||
|
||||
@@ -2185,6 +2185,7 @@ impl VsockConfig {
|
||||
impl NumaConfig {
|
||||
pub const SYNTAX: &'static str = "Settings related to a given NUMA node \
|
||||
\"guest_numa_id=<node_id>,cpus=<cpus_id>,distances=<list_of_distances_to_destination_nodes>,\
|
||||
device_id=<device_id>,\
|
||||
memory_zones=<list_of_memory_zones>,\
|
||||
pci_segments=<list_of_pci_segments>\"";
|
||||
|
||||
@@ -2194,6 +2195,7 @@ impl NumaConfig {
|
||||
.add("guest_numa_id")
|
||||
.add("cpus")
|
||||
.add("distances")
|
||||
.add("device_id")
|
||||
.add("memory_zones")
|
||||
.add("pci_segments");
|
||||
|
||||
@@ -2222,6 +2224,7 @@ impl NumaConfig {
|
||||
})
|
||||
.collect()
|
||||
});
|
||||
let device_id = parser.get("device_id");
|
||||
let memory_zones = parser
|
||||
.convert::<StringList>("memory_zones")
|
||||
.map_err(Error::ParseNuma)?
|
||||
@@ -2234,6 +2237,7 @@ impl NumaConfig {
|
||||
guest_numa_id,
|
||||
cpus,
|
||||
distances,
|
||||
device_id,
|
||||
memory_zones,
|
||||
pci_segments,
|
||||
})
|
||||
@@ -4118,6 +4122,7 @@ mod unit_tests {
|
||||
guest_numa_id: 0,
|
||||
cpus: None,
|
||||
distances: None,
|
||||
device_id: None,
|
||||
memory_zones: None,
|
||||
pci_segments: None,
|
||||
}
|
||||
|
||||
@@ -685,6 +685,8 @@ pub struct NumaConfig {
|
||||
pub memory_zones: Option<Vec<String>>,
|
||||
#[serde(default)]
|
||||
pub pci_segments: Option<Vec<u16>>,
|
||||
#[serde(default)]
|
||||
pub device_id: Option<String>,
|
||||
}
|
||||
|
||||
/// Errors describing a misconfigured payload, i.e., a configuration that
|
||||
|
||||
Reference in New Issue
Block a user