Blob Blame History Raw
From 9271efe525e9cfaf1aad931ffccf61d6d17e5273 Mon Sep 17 00:00:00 2001
Message-Id: <9271efe525e9cfaf1aad931ffccf61d6d17e5273@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 19 Jan 2023 15:16:58 +0100
Subject: [PATCH] qemu: alias: Remove 'oldAlias' argument of
 qemuAssignDeviceMemoryAlias

All callers pass 'false' so we no longer need it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 6d3f0b11b2b056313b123510c96f2924689341f9)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2158701
---
 src/qemu/qemu_alias.c   | 13 ++++---------
 src/qemu/qemu_alias.h   |  3 +--
 src/qemu/qemu_hotplug.c |  2 +-
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index ef8e87ab58..0f1310a0e5 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -454,7 +454,6 @@ qemuAssignDeviceRNGAlias(virDomainDef *def,
 static int
 qemuDeviceMemoryGetAliasID(virDomainDef *def,
                            virDomainMemoryDef *mem,
-                           bool oldAlias,
                            const char *prefix)
 {
     size_t i;
@@ -462,8 +461,7 @@ qemuDeviceMemoryGetAliasID(virDomainDef *def,
 
     /* virtio-pmem and virtio-mem go onto PCI bus and thus DIMM address is not
      * valid */
-    if (!oldAlias &&
-        mem->model != VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM &&
+    if (mem->model != VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM &&
         mem->model != VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM &&
         mem->model != VIR_DOMAIN_MEMORY_MODEL_SGX_EPC)
         return mem->info.addr.dimm.slot;
@@ -482,8 +480,6 @@ qemuDeviceMemoryGetAliasID(virDomainDef *def,
  * qemuAssignDeviceMemoryAlias:
  * @def: domain definition. Necessary only if @oldAlias is true.
  * @mem: memory device definition
- * @oldAlias: Generate the alias according to the order of the device in @def
- *            rather than according to the slot number for legacy reasons.
  *
  * Generates alias for a memory device according to slot number if @oldAlias is
  * false or according to order in @def->mems otherwise.
@@ -492,8 +488,7 @@ qemuDeviceMemoryGetAliasID(virDomainDef *def,
  */
 int
 qemuAssignDeviceMemoryAlias(virDomainDef *def,
-                            virDomainMemoryDef *mem,
-                            bool oldAlias)
+                            virDomainMemoryDef *mem)
 {
     const char *prefix = NULL;
     int idx = 0;
@@ -525,7 +520,7 @@ qemuAssignDeviceMemoryAlias(virDomainDef *def,
         break;
     }
 
-    idx = qemuDeviceMemoryGetAliasID(def, mem, oldAlias, prefix);
+    idx = qemuDeviceMemoryGetAliasID(def, mem, prefix);
     mem->info.alias = g_strdup_printf("%s%d", prefix, idx);
 
     return 0;
@@ -685,7 +680,7 @@ qemuAssignDeviceAliases(virDomainDef *def)
         qemuAssignDeviceTPMAlias(def->tpms[i], i);
     }
     for (i = 0; i < def->nmems; i++) {
-        if (qemuAssignDeviceMemoryAlias(def, def->mems[i], false) < 0)
+        if (qemuAssignDeviceMemoryAlias(def, def->mems[i]) < 0)
             return -1;
     }
     if (def->vsock) {
diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h
index 6433ae4cec..af9c3f62d3 100644
--- a/src/qemu/qemu_alias.h
+++ b/src/qemu/qemu_alias.h
@@ -55,8 +55,7 @@ void qemuAssignDeviceRNGAlias(virDomainDef *def,
                               virDomainRNGDef *rng);
 
 int qemuAssignDeviceMemoryAlias(virDomainDef *def,
-                                virDomainMemoryDef *mems,
-                                bool oldAlias);
+                                virDomainMemoryDef *mems);
 
 void qemuAssignDeviceShmemAlias(virDomainDef *def,
                                 virDomainShmemDef *shmem,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 5840504d13..2df59873db 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2275,7 +2275,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
         goto cleanup;
     releaseaddr = true;
 
-    if (qemuAssignDeviceMemoryAlias(vm->def, mem, false) < 0)
+    if (qemuAssignDeviceMemoryAlias(vm->def, mem) < 0)
         goto cleanup;
 
     objalias = g_strdup_printf("mem%s", mem->info.alias);
-- 
2.39.1