testutilsqemu: Unify array for filling fake machine types

Both 'kvm_machines' and 'qemu_machines' now have the same members so we
can simply drop kvm_machines.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-03-02 16:51:18 +01:00
parent e5786922db
commit 14232f6944

View File

@ -83,18 +83,6 @@ static const char *const *qemu_machines[VIR_ARCH_LAST] = {
[VIR_ARCH_S390X] = s390x_machines, [VIR_ARCH_S390X] = s390x_machines,
}; };
static const char *const *kvm_machines[VIR_ARCH_LAST] = {
[VIR_ARCH_I686] = i386_machines,
[VIR_ARCH_X86_64] = x86_64_machines,
[VIR_ARCH_AARCH64] = aarch64_machines,
[VIR_ARCH_ARMV7L] = arm_machines,
[VIR_ARCH_PPC64] = ppc64_machines,
[VIR_ARCH_PPC] = ppc_machines,
[VIR_ARCH_RISCV32] = riscv32_machines,
[VIR_ARCH_RISCV64] = riscv64_machines,
[VIR_ARCH_S390X] = s390x_machines,
};
static const char *const *hvf_machines[VIR_ARCH_LAST] = { static const char *const *hvf_machines[VIR_ARCH_LAST] = {
[VIR_ARCH_I686] = NULL, [VIR_ARCH_I686] = NULL,
[VIR_ARCH_X86_64] = x86_64_machines, [VIR_ARCH_X86_64] = x86_64_machines,
@ -238,9 +226,8 @@ testQemuAddGuest(virCaps *caps,
NULL, NULL, 0, NULL); NULL, NULL, 0, NULL);
if (hostOS == HOST_OS_LINUX) { if (hostOS == HOST_OS_LINUX) {
if (kvm_machines[emu_arch] != NULL) { nmachines = g_strv_length((char **)qemu_machines[emu_arch]);
nmachines = g_strv_length((char **)kvm_machines[emu_arch]); machines = virCapabilitiesAllocMachines(qemu_machines[emu_arch],
machines = virCapabilitiesAllocMachines(kvm_machines[emu_arch],
nmachines); nmachines);
if (machines == NULL) if (machines == NULL)
goto error; goto error;
@ -249,7 +236,6 @@ testQemuAddGuest(virCaps *caps,
qemu_emulators[emu_arch], qemu_emulators[emu_arch],
NULL, nmachines, machines); NULL, nmachines, machines);
} }
}
if (hostOS == HOST_OS_MACOS) { if (hostOS == HOST_OS_MACOS) {
if (hvf_machines[emu_arch] != NULL) { if (hvf_machines[emu_arch] != NULL) {
@ -455,14 +441,11 @@ qemuTestCapsPopulateFakeMachines(virQEMUCaps *caps,
false, false,
VIR_TRISTATE_BOOL_ABSENT); VIR_TRISTATE_BOOL_ABSENT);
virQEMUCapsSet(caps, QEMU_CAPS_TCG); virQEMUCapsSet(caps, QEMU_CAPS_TCG);
}
if (hostOS == HOST_OS_LINUX) { if (hostOS == HOST_OS_LINUX) {
if (kvm_machines[arch] != NULL) {
for (i = 0; kvm_machines[arch][i] != NULL; i++) {
virQEMUCapsAddMachine(caps, virQEMUCapsAddMachine(caps,
VIR_DOMAIN_VIRT_KVM, VIR_DOMAIN_VIRT_KVM,
kvm_machines[arch][i], qemu_machines[arch][i],
NULL, NULL,
NULL, NULL,
0, 0,
@ -475,7 +458,6 @@ qemuTestCapsPopulateFakeMachines(virQEMUCaps *caps,
virQEMUCapsSet(caps, QEMU_CAPS_KVM); virQEMUCapsSet(caps, QEMU_CAPS_KVM);
} }
} }
}
if (hostOS == HOST_OS_MACOS) { if (hostOS == HOST_OS_MACOS) {
if (hvf_machines[arch] != NULL) { if (hvf_machines[arch] != NULL) {