|
|
99cbc7 |
From b7a1f0836d350bb4ee6930784a6f219e600ef794 Mon Sep 17 00:00:00 2001
|
|
|
99cbc7 |
Message-Id: <b7a1f0836d350bb4ee6930784a6f219e600ef794@dist-git>
|
|
|
99cbc7 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
99cbc7 |
Date: Tue, 4 Jun 2019 13:04:27 +0200
|
|
|
99cbc7 |
Subject: [PATCH] qemu: Make virQEMUCapsProbeHostCPUForEmulator more generic
|
|
|
99cbc7 |
MIME-Version: 1.0
|
|
|
99cbc7 |
Content-Type: text/plain; charset=UTF-8
|
|
|
99cbc7 |
Content-Transfer-Encoding: 8bit
|
|
|
99cbc7 |
|
|
|
99cbc7 |
The function is renamed as virQEMUCapsProbeHostCPU and it does not get
|
|
|
99cbc7 |
the list of allowed CPU models from qemuCaps anymore. This is
|
|
|
99cbc7 |
responsibility is moved to the caller. The result is just a very thin
|
|
|
99cbc7 |
wrapper around virCPUGetHost mostly required mocking in tests.
|
|
|
99cbc7 |
|
|
|
99cbc7 |
The generic function is used in place of a direct call to virCPUGetHost
|
|
|
99cbc7 |
in virQEMUCapsInitHostCPUModel to make sure tests don't accidentally
|
|
|
99cbc7 |
probe host CPU.
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
99cbc7 |
(cherry picked from commit dd3fc650de8ef8b05b491c9f362b660e07a857fd)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
https://bugzilla.redhat.com/show_bug.cgi?id=1641702
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
99cbc7 |
Message-Id: <36a308ac10a2c86970ea3188dcb197c75adddefe.1559646067.git.jdenemar@redhat.com>
|
|
|
99cbc7 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
99cbc7 |
---
|
|
|
99cbc7 |
src/qemu/qemu_capabilities.c | 14 ++++++--------
|
|
|
99cbc7 |
src/qemu/qemu_capspriv.h | 5 ++---
|
|
|
99cbc7 |
tests/qemucpumock.c | 5 ++---
|
|
|
99cbc7 |
3 files changed, 10 insertions(+), 14 deletions(-)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
|
|
99cbc7 |
index 66eefae988..c5032f9192 100644
|
|
|
99cbc7 |
--- a/src/qemu/qemu_capabilities.c
|
|
|
99cbc7 |
+++ b/src/qemu/qemu_capabilities.c
|
|
|
99cbc7 |
@@ -924,12 +924,10 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
|
|
|
99cbc7 |
|
|
|
99cbc7 |
|
|
|
99cbc7 |
virCPUDefPtr
|
|
|
99cbc7 |
-virQEMUCapsProbeHostCPUForEmulator(virArch hostArch,
|
|
|
99cbc7 |
- virQEMUCapsPtr qemuCaps,
|
|
|
99cbc7 |
- virDomainVirtType type)
|
|
|
99cbc7 |
+virQEMUCapsProbeHostCPU(virArch hostArch,
|
|
|
99cbc7 |
+ virDomainCapsCPUModelsPtr models)
|
|
|
99cbc7 |
{
|
|
|
99cbc7 |
- return virCPUGetHost(hostArch, VIR_CPU_TYPE_GUEST, NULL,
|
|
|
99cbc7 |
- virQEMUCapsGetCPUDefinitions(qemuCaps, type));
|
|
|
99cbc7 |
+ return virCPUGetHost(hostArch, VIR_CPU_TYPE_GUEST, NULL, models);
|
|
|
99cbc7 |
}
|
|
|
99cbc7 |
|
|
|
99cbc7 |
|
|
|
99cbc7 |
@@ -2960,7 +2958,8 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
|
|
|
99cbc7 |
} else if (rc == 1) {
|
|
|
99cbc7 |
VIR_DEBUG("No host CPU model info from QEMU; probing host CPU directly");
|
|
|
99cbc7 |
|
|
|
99cbc7 |
- hostCPU = virQEMUCapsProbeHostCPUForEmulator(hostArch, qemuCaps, type);
|
|
|
99cbc7 |
+ hostCPU = virQEMUCapsProbeHostCPU(hostArch,
|
|
|
99cbc7 |
+ virQEMUCapsGetCPUDefinitions(qemuCaps, type));
|
|
|
99cbc7 |
if (!hostCPU ||
|
|
|
99cbc7 |
virCPUDefCopyModelFilter(cpu, hostCPU, true,
|
|
|
99cbc7 |
virQEMUCapsCPUFilterFeatures,
|
|
|
99cbc7 |
@@ -2973,8 +2972,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
|
|
|
99cbc7 |
goto error;
|
|
|
99cbc7 |
} else if (type == VIR_DOMAIN_VIRT_KVM &&
|
|
|
99cbc7 |
virCPUGetHostIsSupported(qemuCaps->arch)) {
|
|
|
99cbc7 |
- if (!(fullCPU = virCPUGetHost(qemuCaps->arch, VIR_CPU_TYPE_GUEST,
|
|
|
99cbc7 |
- NULL, NULL)))
|
|
|
99cbc7 |
+ if (!(fullCPU = virQEMUCapsProbeHostCPU(qemuCaps->arch, NULL)))
|
|
|
99cbc7 |
goto error;
|
|
|
99cbc7 |
|
|
|
99cbc7 |
if (!(cpuExpanded = virCPUDefCopy(cpu)) ||
|
|
|
99cbc7 |
diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
|
|
|
99cbc7 |
index cb5e0dd9a9..8e458ef227 100644
|
|
|
99cbc7 |
--- a/src/qemu/qemu_capspriv.h
|
|
|
99cbc7 |
+++ b/src/qemu/qemu_capspriv.h
|
|
|
99cbc7 |
@@ -81,9 +81,8 @@ virQEMUCapsSetCPUModelInfo(virQEMUCapsPtr qemuCaps,
|
|
|
99cbc7 |
qemuMonitorCPUModelInfoPtr modelInfo);
|
|
|
99cbc7 |
|
|
|
99cbc7 |
virCPUDefPtr
|
|
|
99cbc7 |
-virQEMUCapsProbeHostCPUForEmulator(virArch hostArch,
|
|
|
99cbc7 |
- virQEMUCapsPtr qemuCaps,
|
|
|
99cbc7 |
- virDomainVirtType type) ATTRIBUTE_NOINLINE;
|
|
|
99cbc7 |
+virQEMUCapsProbeHostCPU(virArch hostArch,
|
|
|
99cbc7 |
+ virDomainCapsCPUModelsPtr models) ATTRIBUTE_NOINLINE;
|
|
|
99cbc7 |
|
|
|
99cbc7 |
void
|
|
|
99cbc7 |
virQEMUCapsSetGICCapabilities(virQEMUCapsPtr qemuCaps,
|
|
|
99cbc7 |
diff --git a/tests/qemucpumock.c b/tests/qemucpumock.c
|
|
|
99cbc7 |
index 74dcfa6291..0e89e9764f 100644
|
|
|
99cbc7 |
--- a/tests/qemucpumock.c
|
|
|
99cbc7 |
+++ b/tests/qemucpumock.c
|
|
|
99cbc7 |
@@ -29,9 +29,8 @@
|
|
|
99cbc7 |
|
|
|
99cbc7 |
|
|
|
99cbc7 |
virCPUDefPtr
|
|
|
99cbc7 |
-virQEMUCapsProbeHostCPUForEmulator(virArch hostArch ATTRIBUTE_UNUSED,
|
|
|
99cbc7 |
- virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,
|
|
|
99cbc7 |
- virDomainVirtType type ATTRIBUTE_UNUSED)
|
|
|
99cbc7 |
+virQEMUCapsProbeHostCPU(virArch hostArch ATTRIBUTE_UNUSED,
|
|
|
99cbc7 |
+ virDomainCapsCPUModelsPtr models ATTRIBUTE_UNUSED)
|
|
|
99cbc7 |
{
|
|
|
99cbc7 |
const char *model = getenv("VIR_TEST_MOCK_FAKE_HOST_CPU");
|
|
|
99cbc7 |
|
|
|
99cbc7 |
--
|
|
|
99cbc7 |
2.21.0
|
|
|
99cbc7 |
|