This follows the host NUMA policy. This is the default policy in QEMU,
see
https://www.qemu.org/docs/master/interop/qemu-qmp-ref.html#object-QMP-qom.MemoryBackendProperties.

Signed-off-by: Maximiliano Sandoval <[email protected]>
---
 src/PVE/QemuServer/Memory.pm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/PVE/QemuServer/Memory.pm b/src/PVE/QemuServer/Memory.pm
index bcf6f9c5..f21b0b8d 100644
--- a/src/PVE/QemuServer/Memory.pm
+++ b/src/PVE/QemuServer/Memory.pm
@@ -40,11 +40,12 @@ my $numa_fmt = {
     },
     policy => {
         type => 'string',
-        enum => [qw(preferred bind interleave)],
+        enum => [qw(default preferred bind interleave)],
         description => "NUMA allocation policy.",
         verbose_description => <<EODESC,
 NUMA allocation policy. Possible values are:
 
+ - default: default host policy
  - preferred: prefer the given host node list for allocation
  - bind: restrict memory allocation to the given host node list
  - interleave: interleave memory allocations across the given host node list
@@ -53,6 +54,7 @@ The models are explained in more details at the kernel's 
documentation
 
https://docs.kernel.org/admin-guide/mm/numa_memory_policy.html#components-of-memory-policies.
 EODESC
         optional => 1,
+        default => 'default',
     },
 };
 PVE::JSONSchema::register_format('pve-qm-numanode', $numa_fmt);
@@ -450,8 +452,7 @@ sub config {
                 my $hostnodes = print_numa_hostnodes($hostnodelists);
 
                 # policy
-                my $policy = $numa->{policy};
-                die "you need to define a policy for hostnode $hostnodes\n" if 
!$policy;
+                my $policy = $numa->{policy} // $numa_fmt->{policy}->{default};
                 $mem_object .= ",host-nodes=$hostnodes,policy=$policy";
             } else {
                 die "numa hostnodes need to be defined to use hugepages" if 
$conf->{hugepages};
-- 
2.47.3




Reply via email to