qemu: Introduce virQEMUCapsSetHostModel

A simple helper as a complement to virQEMUCapsGetHostModel.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2017-04-07 17:03:38 +02:00
parent 4d80317655
commit bffc3b9fe5

View File

@ -2455,6 +2455,18 @@ virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps,
} }
static void
virQEMUCapsSetHostModel(virQEMUCapsPtr qemuCaps,
virDomainVirtType type,
virCPUDefPtr cpu)
{
if (type == VIR_DOMAIN_VIRT_KVM)
qemuCaps->kvmCPUModel = cpu;
else
qemuCaps->tcgCPUModel = cpu;
}
bool bool
virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps, virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps,
virCapsPtr caps, virCapsPtr caps,
@ -3336,10 +3348,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
goto error; goto error;
} }
if (type == VIR_DOMAIN_VIRT_KVM) virQEMUCapsSetHostModel(qemuCaps, type, cpu);
qemuCaps->kvmCPUModel = cpu;
else
qemuCaps->tcgCPUModel = cpu;
cleanup: cleanup:
virCPUDefFree(hostCPU); virCPUDefFree(hostCPU);