tests: define QEMU driver capabilities for sparc architecture

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2020-11-18 17:06:45 +00:00
parent a46ca90d27
commit 04dd749a5f

View File

@ -31,7 +31,8 @@ static const char *qemu_emulators[VIR_ARCH_LAST] = {
[VIR_ARCH_PPC] = "/usr/bin/qemu-system-ppc", [VIR_ARCH_PPC] = "/usr/bin/qemu-system-ppc",
[VIR_ARCH_RISCV32] = "/usr/bin/qemu-system-riscv32", [VIR_ARCH_RISCV32] = "/usr/bin/qemu-system-riscv32",
[VIR_ARCH_RISCV64] = "/usr/bin/qemu-system-riscv64", [VIR_ARCH_RISCV64] = "/usr/bin/qemu-system-riscv64",
[VIR_ARCH_S390X] = "/usr/bin/qemu-system-s390x" [VIR_ARCH_S390X] = "/usr/bin/qemu-system-s390x",
[VIR_ARCH_SPARC] = "/usr/bin/qemu-system-sparc",
}; };
static const virArch arch_alias[VIR_ARCH_LAST] = { static const virArch arch_alias[VIR_ARCH_LAST] = {
@ -74,6 +75,11 @@ static const char *const riscv64_machines[] = {
static const char *const s390x_machines[] = { static const char *const s390x_machines[] = {
"s390-virtio", "s390-ccw-virtio", "s390-ccw", NULL "s390-virtio", "s390-ccw-virtio", "s390-ccw", NULL
}; };
static const char *const sparc_machines[] = {
"SS-5", "LX", "SPARCClassic", "SPARCbook",
"SS-10", "SS-20", "SS-4", "SS-600MP",
"Voyager", "leon3_generic", NULL
};
static const char *const *qemu_machines[VIR_ARCH_LAST] = { static const char *const *qemu_machines[VIR_ARCH_LAST] = {
[VIR_ARCH_I686] = i386_machines, [VIR_ARCH_I686] = i386_machines,
@ -85,6 +91,7 @@ static const char *const *qemu_machines[VIR_ARCH_LAST] = {
[VIR_ARCH_RISCV32] = riscv32_machines, [VIR_ARCH_RISCV32] = riscv32_machines,
[VIR_ARCH_RISCV64] = riscv64_machines, [VIR_ARCH_RISCV64] = riscv64_machines,
[VIR_ARCH_S390X] = s390x_machines, [VIR_ARCH_S390X] = s390x_machines,
[VIR_ARCH_SPARC] = sparc_machines,
}; };
static const char *const *kvm_machines[VIR_ARCH_LAST] = { static const char *const *kvm_machines[VIR_ARCH_LAST] = {
@ -106,7 +113,8 @@ static const char *qemu_default_ram_id[VIR_ARCH_LAST] = {
[VIR_ARCH_ARMV7L] = "vexpress.highmem", [VIR_ARCH_ARMV7L] = "vexpress.highmem",
[VIR_ARCH_PPC64] = "ppc_spapr.ram", [VIR_ARCH_PPC64] = "ppc_spapr.ram",
[VIR_ARCH_PPC] = "ppc_spapr.ram", [VIR_ARCH_PPC] = "ppc_spapr.ram",
[VIR_ARCH_S390X] = "s390.ram" [VIR_ARCH_S390X] = "s390.ram",
[VIR_ARCH_SPARC] = "sun4m.ram",
}; };
char * char *
@ -181,19 +189,21 @@ testQemuAddGuest(virCapsPtr caps,
NULL)) NULL))
goto error; goto error;
nmachines = g_strv_length((char **)kvm_machines[emu_arch]); if (kvm_machines[emu_arch] != NULL) {
machines = virCapabilitiesAllocMachines(kvm_machines[emu_arch], nmachines = g_strv_length((char **)kvm_machines[emu_arch]);
nmachines); machines = virCapabilitiesAllocMachines(kvm_machines[emu_arch],
if (machines == NULL) nmachines);
goto error; if (machines == NULL)
goto error;
if (!virCapabilitiesAddGuestDomain(guest, if (!virCapabilitiesAddGuestDomain(guest,
VIR_DOMAIN_VIRT_KVM, VIR_DOMAIN_VIRT_KVM,
qemu_emulators[emu_arch], qemu_emulators[emu_arch],
NULL, NULL,
nmachines, nmachines,
machines)) machines))
goto error; goto error;
}
return 0; return 0;
@ -363,18 +373,20 @@ int qemuTestCapsCacheInsert(virFileCachePtr cache,
defaultRAMid); defaultRAMid);
virQEMUCapsSet(tmpCaps, QEMU_CAPS_TCG); virQEMUCapsSet(tmpCaps, QEMU_CAPS_TCG);
} }
for (j = 0; kvm_machines[i][j] != NULL; j++) { if (kvm_machines[i] != NULL) {
virQEMUCapsAddMachine(tmpCaps, for (j = 0; kvm_machines[i][j] != NULL; j++) {
VIR_DOMAIN_VIRT_KVM, virQEMUCapsAddMachine(tmpCaps,
kvm_machines[i][j], VIR_DOMAIN_VIRT_KVM,
NULL, kvm_machines[i][j],
NULL, NULL,
0, NULL,
0,
false,
false, false,
false, true,
true, defaultRAMid);
defaultRAMid); virQEMUCapsSet(tmpCaps, QEMU_CAPS_KVM);
virQEMUCapsSet(tmpCaps, QEMU_CAPS_KVM); }
} }
} }