render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
735c6b
From 9271efe525e9cfaf1aad931ffccf61d6d17e5273 Mon Sep 17 00:00:00 2001
735c6b
Message-Id: <9271efe525e9cfaf1aad931ffccf61d6d17e5273@dist-git>
735c6b
From: Peter Krempa <pkrempa@redhat.com>
735c6b
Date: Thu, 19 Jan 2023 15:16:58 +0100
735c6b
Subject: [PATCH] qemu: alias: Remove 'oldAlias' argument of
735c6b
 qemuAssignDeviceMemoryAlias
735c6b
735c6b
All callers pass 'false' so we no longer need it.
735c6b
735c6b
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
735c6b
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
735c6b
(cherry picked from commit 6d3f0b11b2b056313b123510c96f2924689341f9)
735c6b
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2158701
735c6b
---
735c6b
 src/qemu/qemu_alias.c   | 13 ++++---------
735c6b
 src/qemu/qemu_alias.h   |  3 +--
735c6b
 src/qemu/qemu_hotplug.c |  2 +-
735c6b
 3 files changed, 6 insertions(+), 12 deletions(-)
735c6b
735c6b
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
735c6b
index ef8e87ab58..0f1310a0e5 100644
735c6b
--- a/src/qemu/qemu_alias.c
735c6b
+++ b/src/qemu/qemu_alias.c
735c6b
@@ -454,7 +454,6 @@ qemuAssignDeviceRNGAlias(virDomainDef *def,
735c6b
 static int
735c6b
 qemuDeviceMemoryGetAliasID(virDomainDef *def,
735c6b
                            virDomainMemoryDef *mem,
735c6b
-                           bool oldAlias,
735c6b
                            const char *prefix)
735c6b
 {
735c6b
     size_t i;
735c6b
@@ -462,8 +461,7 @@ qemuDeviceMemoryGetAliasID(virDomainDef *def,
735c6b
 
735c6b
     /* virtio-pmem and virtio-mem go onto PCI bus and thus DIMM address is not
735c6b
      * valid */
735c6b
-    if (!oldAlias &&
735c6b
-        mem->model != VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM &&
735c6b
+    if (mem->model != VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM &&
735c6b
         mem->model != VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM &&
735c6b
         mem->model != VIR_DOMAIN_MEMORY_MODEL_SGX_EPC)
735c6b
         return mem->info.addr.dimm.slot;
735c6b
@@ -482,8 +480,6 @@ qemuDeviceMemoryGetAliasID(virDomainDef *def,
735c6b
  * qemuAssignDeviceMemoryAlias:
735c6b
  * @def: domain definition. Necessary only if @oldAlias is true.
735c6b
  * @mem: memory device definition
735c6b
- * @oldAlias: Generate the alias according to the order of the device in @def
735c6b
- *            rather than according to the slot number for legacy reasons.
735c6b
  *
735c6b
  * Generates alias for a memory device according to slot number if @oldAlias is
735c6b
  * false or according to order in @def->mems otherwise.
735c6b
@@ -492,8 +488,7 @@ qemuDeviceMemoryGetAliasID(virDomainDef *def,
735c6b
  */
735c6b
 int
735c6b
 qemuAssignDeviceMemoryAlias(virDomainDef *def,
735c6b
-                            virDomainMemoryDef *mem,
735c6b
-                            bool oldAlias)
735c6b
+                            virDomainMemoryDef *mem)
735c6b
 {
735c6b
     const char *prefix = NULL;
735c6b
     int idx = 0;
735c6b
@@ -525,7 +520,7 @@ qemuAssignDeviceMemoryAlias(virDomainDef *def,
735c6b
         break;
735c6b
     }
735c6b
 
735c6b
-    idx = qemuDeviceMemoryGetAliasID(def, mem, oldAlias, prefix);
735c6b
+    idx = qemuDeviceMemoryGetAliasID(def, mem, prefix);
735c6b
     mem->info.alias = g_strdup_printf("%s%d", prefix, idx);
735c6b
 
735c6b
     return 0;
735c6b
@@ -685,7 +680,7 @@ qemuAssignDeviceAliases(virDomainDef *def)
735c6b
         qemuAssignDeviceTPMAlias(def->tpms[i], i);
735c6b
     }
735c6b
     for (i = 0; i < def->nmems; i++) {
735c6b
-        if (qemuAssignDeviceMemoryAlias(def, def->mems[i], false) < 0)
735c6b
+        if (qemuAssignDeviceMemoryAlias(def, def->mems[i]) < 0)
735c6b
             return -1;
735c6b
     }
735c6b
     if (def->vsock) {
735c6b
diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h
735c6b
index 6433ae4cec..af9c3f62d3 100644
735c6b
--- a/src/qemu/qemu_alias.h
735c6b
+++ b/src/qemu/qemu_alias.h
735c6b
@@ -55,8 +55,7 @@ void qemuAssignDeviceRNGAlias(virDomainDef *def,
735c6b
                               virDomainRNGDef *rng);
735c6b
 
735c6b
 int qemuAssignDeviceMemoryAlias(virDomainDef *def,
735c6b
-                                virDomainMemoryDef *mems,
735c6b
-                                bool oldAlias);
735c6b
+                                virDomainMemoryDef *mems);
735c6b
 
735c6b
 void qemuAssignDeviceShmemAlias(virDomainDef *def,
735c6b
                                 virDomainShmemDef *shmem,
735c6b
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
735c6b
index 5840504d13..2df59873db 100644
735c6b
--- a/src/qemu/qemu_hotplug.c
735c6b
+++ b/src/qemu/qemu_hotplug.c
735c6b
@@ -2275,7 +2275,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
735c6b
         goto cleanup;
735c6b
     releaseaddr = true;
735c6b
 
735c6b
-    if (qemuAssignDeviceMemoryAlias(vm->def, mem, false) < 0)
735c6b
+    if (qemuAssignDeviceMemoryAlias(vm->def, mem) < 0)
735c6b
         goto cleanup;
735c6b
 
735c6b
     objalias = g_strdup_printf("mem%s", mem->info.alias);
735c6b
-- 
735c6b
2.39.1
735c6b