1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-12 13:17:58 +03:00

qemu: Add virQEMUCapsGetVirtType convenience function

Signed-off-by: Tobin Feldman-Fitzthum <tobin@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Tobin Feldman-Fitzthum 2020-04-22 17:50:43 -04:00 committed by Michal Privoznik
parent 00ea049daa
commit 856587ea64
2 changed files with 18 additions and 9 deletions

View File

@ -4999,6 +4999,20 @@ virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCapsPtr qemuCaps,
#define QEMU_MIN_MINOR 5
#define QEMU_MIN_MICRO 0
virDomainVirtType
virQEMUCapsGetVirtType(virQEMUCapsPtr qemuCaps)
{
virDomainVirtType type;
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
type = VIR_DOMAIN_VIRT_KVM;
else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_TCG))
type = VIR_DOMAIN_VIRT_QEMU;
else
type = VIR_DOMAIN_VIRT_NONE;
return type;
}
int
virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
qemuMonitorPtr mon)
@ -5043,11 +5057,7 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
if (virQEMUCapsProbeQMPKVMState(qemuCaps, mon) < 0)
return -1;
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
type = VIR_DOMAIN_VIRT_KVM;
else
type = VIR_DOMAIN_VIRT_QEMU;
type = virQEMUCapsGetVirtType(qemuCaps);
accel = virQEMUCapsGetAccel(qemuCaps, type);
if (virQEMUCapsProbeQMPEvents(qemuCaps, mon) < 0)
@ -5540,10 +5550,7 @@ virQEMUCapsCacheLookupDefault(virFileCachePtr cache,
goto cleanup;
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
capsType = VIR_DOMAIN_VIRT_KVM;
else
capsType = VIR_DOMAIN_VIRT_QEMU;
capsType = virQEMUCapsGetVirtType(qemuCaps);
if (virttype == VIR_DOMAIN_VIRT_NONE)
virttype = capsType;

View File

@ -642,6 +642,8 @@ int virQEMUCapsGetCPUFeatures(virQEMUCapsPtr qemuCaps,
bool migratable,
char ***features);
virDomainVirtType virQEMUCapsGetVirtType(virQEMUCapsPtr qemuCaps);
bool virQEMUCapsIsArchSupported(virQEMUCapsPtr qemuCaps,
virArch arch);
bool virQEMUCapsIsVirtTypeSupported(virQEMUCapsPtr qemuCaps,