mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
cpu: Introduce virCPUGetHostIsSupported
Sometimes we want to call virCPUGetHost only when it is implemented for a given architecture to avoid logging expected and possibly misleading errors. The new virCPUGetHostIsSupported API may be used to guard such calls to virCPUGetHost. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
232d87c7dd
commit
bf1a881715
@ -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:
|
* virCPUGetHost:
|
||||||
*
|
*
|
||||||
|
@ -183,6 +183,9 @@ virCPUDataNew(virArch arch);
|
|||||||
void
|
void
|
||||||
virCPUDataFree(virCPUDataPtr data);
|
virCPUDataFree(virCPUDataPtr data);
|
||||||
|
|
||||||
|
bool
|
||||||
|
virCPUGetHostIsSupported(virArch arch);
|
||||||
|
|
||||||
virCPUDefPtr
|
virCPUDefPtr
|
||||||
virCPUGetHost(virArch arch,
|
virCPUGetHost(virArch arch,
|
||||||
virCPUType type,
|
virCPUType type,
|
||||||
|
@ -1039,6 +1039,7 @@ virCPUDataNew;
|
|||||||
virCPUDataParse;
|
virCPUDataParse;
|
||||||
virCPUExpandFeatures;
|
virCPUExpandFeatures;
|
||||||
virCPUGetHost;
|
virCPUGetHost;
|
||||||
|
virCPUGetHostIsSupported;
|
||||||
virCPUGetModels;
|
virCPUGetModels;
|
||||||
virCPUProbeHost;
|
virCPUProbeHost;
|
||||||
virCPUTranslate;
|
virCPUTranslate;
|
||||||
|
Loading…
Reference in New Issue
Block a user