diff --git a/src/main.rs b/src/main.rs index 0b05c257d..aa40ac9e7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -120,7 +120,8 @@ fn create_app<'a, 'b>( .help( "User defined memory zone parameters \ \"size=,file=,\ - shared=on|off,hugepages=on|off,host_numa_node=\"", + shared=on|off,hugepages=on|off,host_numa_node=,\ + guest_numa_node=\"", ) .takes_value(true) .min_values(1) diff --git a/vmm/src/api/openapi/cloud-hypervisor.yaml b/vmm/src/api/openapi/cloud-hypervisor.yaml index ef4f34c11..07b067a07 100644 --- a/vmm/src/api/openapi/cloud-hypervisor.yaml +++ b/vmm/src/api/openapi/cloud-hypervisor.yaml @@ -470,6 +470,9 @@ components: host_numa_node: type: integer format: uint32 + guest_numa_node: + type: integer + format: uint32 MemoryConfig: required: diff --git a/vmm/src/config.rs b/vmm/src/config.rs index 540a0cdf8..f30f12155 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -354,6 +354,8 @@ pub struct MemoryZoneConfig { pub hugepages: bool, #[serde(default)] pub host_numa_node: Option, + #[serde(default)] + pub guest_numa_node: Option, } #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] @@ -434,7 +436,8 @@ impl MemoryConfig { .add("file") .add("shared") .add("hugepages") - .add("host_numa_node"); + .add("host_numa_node") + .add("guest_numa_node"); parser.parse(memory_zone).map_err(Error::ParseMemoryZone)?; let size = parser @@ -456,6 +459,9 @@ impl MemoryConfig { let host_numa_node = parser .convert::("host_numa_node") .map_err(Error::ParseMemoryZone)?; + let guest_numa_node = parser + .convert::("guest_numa_node") + .map_err(Error::ParseMemoryZone)?; zones.push(MemoryZoneConfig { size, @@ -463,6 +469,7 @@ impl MemoryConfig { shared, hugepages, host_numa_node, + guest_numa_node, }); } Some(zones) diff --git a/vmm/src/memory_manager.rs b/vmm/src/memory_manager.rs index 3c9309314..5010d44f6 100644 --- a/vmm/src/memory_manager.rs +++ b/vmm/src/memory_manager.rs @@ -379,6 +379,7 @@ impl MemoryManager { shared: config.shared, hugepages: config.hugepages, host_numa_node: None, + guest_numa_node: None, }]; (config.size, zones)