diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 8a407ac18c34f2fe0c2b18f48536f8addaf1f961..702b14dbb76556b5eeba5fb55d30eaa2c9459723 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -357,6 +357,26 @@ virCPUDataFree(virCPUDataPtr data) } +/** + * virCPUGetHostIsSupported: + * + * @arch: CPU architecture + * + * Check whether virCPUGetHost is supported for @arch. + * + * Returns true if virCPUGetHost is supported, false otherwise. + */ +bool +virCPUGetHostIsSupported(virArch arch) +{ + struct cpuArchDriver *driver; + + VIR_DEBUG("arch=%s", virArchToString(arch)); + + return (driver = cpuGetSubDriver(arch)) && driver->getHost; +} + + /** * virCPUGetHost: * diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 352445c40b21dc84353284b25b3f55f4231d33ac..c6ca111e972280abbfcdf79f73339983e23f7123 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -183,6 +183,9 @@ virCPUDataNew(virArch arch); void virCPUDataFree(virCPUDataPtr data); +bool +virCPUGetHostIsSupported(virArch arch); + virCPUDefPtr virCPUGetHost(virArch arch, virCPUType type, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ba6b05d4bec783ff4457ca06b8bff751fab58fa0..181e178753a4fa6fffd3071d213b72bfdfb44e73 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1039,6 +1039,7 @@ virCPUDataNew; virCPUDataParse; virCPUExpandFeatures; virCPUGetHost; +virCPUGetHostIsSupported; virCPUGetModels; virCPUProbeHost; virCPUTranslate;