[PATCH] qemu_domain: Deduplicate targetNode check in qemuDomainDefValidateMemoryHotplugDevice()

Michal Privoznik posted 1 patch 9 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/be20095d237aa5fee096d4b4f763abd1d518422f.1689238083.git.mprivozn@redhat.com
src/qemu/qemu_domain.c | 9 ---------
1 file changed, 9 deletions(-)
[PATCH] qemu_domain: Deduplicate targetNode check in qemuDomainDefValidateMemoryHotplugDevice()
Posted by Michal Privoznik 9 months, 3 weeks ago
If a domain has NUMA configured, then all <memory/> devices
(except for 'virtio-pmem') need to have targetNode set. There are
two checks inside of qemuDomainDefValidateMemoryHotplugDevice()
for this: one inside of big switch() statement, which only checks
'dimm' and 'nvdimm' cases, and the other at the end of the
function that checks all models (except for 'virtio-pmem'). Let's
keep the latter and remove the former as the latter covers the
former too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_domain.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 94587638c3..3700b3e711 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9189,15 +9189,6 @@ qemuDomainDefValidateMemoryHotplugDevice(const virDomainMemoryDef *mem,
             return -1;
         }
 
-        if (virDomainNumaGetNodeCount(def->numa) != 0) {
-            if (mem->targetNode == -1) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("target NUMA node needs to be specified for "
-                                 "memory device"));
-                return -1;
-            }
-        }
-
         if (mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
             if (mem->info.addr.dimm.slot >= def->mem.memory_slots) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-- 
2.41.0
Re: [PATCH] qemu_domain: Deduplicate targetNode check in qemuDomainDefValidateMemoryHotplugDevice()
Posted by Kristina Hanicova 9 months, 3 weeks ago
On Thu, Jul 13, 2023 at 4:05 PM Michal Privoznik <mprivozn@redhat.com>
wrote:

> If a domain has NUMA configured, then all <memory/> devices
> (except for 'virtio-pmem') need to have targetNode set. There are
> two checks inside of qemuDomainDefValidateMemoryHotplugDevice()
> for this: one inside of big switch() statement, which only checks
> 'dimm' and 'nvdimm' cases, and the other at the end of the
> function that checks all models (except for 'virtio-pmem'). Let's
> keep the latter and remove the former as the latter covers the
> former too.
>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_domain.c | 9 ---------
>  1 file changed, 9 deletions(-)


Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Kristina