domaincapstest: Use default machine type

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2016-04-28 18:01:18 +02:00
parent 7aa86f6358
commit f51e8a6282
2 changed files with 15 additions and 4 deletions

View File

@ -1,7 +1,7 @@
<domainCapabilities> <domainCapabilities>
<path>/usr/bin/qemu-system-x86_64</path> <path>/usr/bin/qemu-system-x86_64</path>
<domain>kvm</domain> <domain>kvm</domain>
<machine>pc-1.2</machine> <machine>pc-i440fx-1.7</machine>
<arch>x86_64</arch> <arch>x86_64</arch>
<vcpu max='255'/> <vcpu max='255'/>
<os supported='yes'> <os supported='yes'>

View File

@ -96,6 +96,7 @@ static int
fillQemuCaps(virDomainCapsPtr domCaps, fillQemuCaps(virDomainCapsPtr domCaps,
const char *name, const char *name,
virArch arch, virArch arch,
const char *machine,
virQEMUDriverConfigPtr cfg) virQEMUDriverConfigPtr cfg)
{ {
int ret = -1; int ret = -1;
@ -108,6 +109,16 @@ fillQemuCaps(virDomainCapsPtr domCaps,
!(qemuCaps = qemuTestParseCapabilities(path))) !(qemuCaps = qemuTestParseCapabilities(path)))
goto cleanup; goto cleanup;
if (machine &&
VIR_STRDUP(domCaps->machine,
virQEMUCapsGetCanonicalMachine(qemuCaps, machine)) < 0)
goto cleanup;
if (!domCaps->machine &&
VIR_STRDUP(domCaps->machine,
virQEMUCapsGetDefaultMachine(qemuCaps)) < 0)
goto cleanup;
if (virQEMUCapsFillDomainCaps(domCaps, qemuCaps, if (virQEMUCapsFillDomainCaps(domCaps, qemuCaps,
cfg->loader, cfg->nloader) < 0) cfg->loader, cfg->nloader) < 0)
goto cleanup; goto cleanup;
@ -187,7 +198,7 @@ test_virDomainCapsFormat(const void *opaque)
case CAPS_QEMU: case CAPS_QEMU:
#if WITH_QEMU #if WITH_QEMU
if (fillQemuCaps(domCaps, data->capsName, data->arch, if (fillQemuCaps(domCaps, data->capsName, data->arch, data->machine,
data->capsOpaque) < 0) data->capsOpaque) < 0)
goto cleanup; goto cleanup;
#endif #endif
@ -258,8 +269,8 @@ mymain(void)
#if WITH_QEMU #if WITH_QEMU
DO_TEST_QEMU("qemu_1.6.50-1", "caps_1.6.50-1", DO_TEST_QEMU("qemu_1.6.50-1", "caps_1.6.50-1",
"/usr/bin/qemu-system-x86_64", "pc-1.2", VIR_ARCH_X86_64, "/usr/bin/qemu-system-x86_64", NULL,
VIR_DOMAIN_VIRT_KVM); VIR_ARCH_X86_64, VIR_DOMAIN_VIRT_KVM);
#endif /* WITH_QEMU */ #endif /* WITH_QEMU */