mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 18:05:20 +00:00
cpu: Rename and document cpuModelIsAllowed
The new name is virCPUModelIsAllowed. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
b7011dfe44
commit
938ec1620a
@ -813,10 +813,22 @@ cpuDataParse(const char *xmlStr)
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** virCPUModelIsAllowed:
|
||||||
|
*
|
||||||
|
* @model: CPU model to be checked
|
||||||
|
* @models: list of supported CPU models
|
||||||
|
* @nmodels: number of models in @models
|
||||||
|
*
|
||||||
|
* Checks whether @model can be found in the list of supported @models.
|
||||||
|
* If @models is empty, all models are supported.
|
||||||
|
*
|
||||||
|
* Returns true if @model is supported, false otherwise.
|
||||||
|
*/
|
||||||
bool
|
bool
|
||||||
cpuModelIsAllowed(const char *model,
|
virCPUModelIsAllowed(const char *model,
|
||||||
const char **models,
|
const char **models,
|
||||||
unsigned int nmodels)
|
unsigned int nmodels)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -830,6 +842,7 @@ cpuModelIsAllowed(const char *model,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virCPUGetModels:
|
* virCPUGetModels:
|
||||||
*
|
*
|
||||||
@ -898,7 +911,7 @@ virCPUTranslate(virArch arch,
|
|||||||
cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH)
|
cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (cpuModelIsAllowed(cpu->model, (const char **) models, nmodels))
|
if (virCPUModelIsAllowed(cpu->model, (const char **) models, nmodels))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) {
|
if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) {
|
||||||
|
@ -214,9 +214,9 @@ virCPUDataCheckFeature(const virCPUData *data,
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cpuModelIsAllowed(const char *model,
|
virCPUModelIsAllowed(const char *model,
|
||||||
const char **models,
|
const char **models,
|
||||||
unsigned int nmodels)
|
unsigned int nmodels)
|
||||||
ATTRIBUTE_NONNULL(1);
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -691,7 +691,7 @@ ppc64DriverDecode(virCPUDefPtr cpu,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cpuModelIsAllowed(model->name, models, nmodels)) {
|
if (!virCPUModelIsAllowed(model->name, models, nmodels)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("CPU model %s is not supported by hypervisor"),
|
_("CPU model %s is not supported by hypervisor"),
|
||||||
model->name);
|
model->name);
|
||||||
|
@ -1833,7 +1833,7 @@ x86Decode(virCPUDefPtr cpu,
|
|||||||
*/
|
*/
|
||||||
for (i = map->nmodels - 1; i >= 0; i--) {
|
for (i = map->nmodels - 1; i >= 0; i--) {
|
||||||
candidate = map->models[i];
|
candidate = map->models[i];
|
||||||
if (!cpuModelIsAllowed(candidate->name, models, nmodels)) {
|
if (!virCPUModelIsAllowed(candidate->name, models, nmodels)) {
|
||||||
if (preferred && STREQ(candidate->name, preferred)) {
|
if (preferred && STREQ(candidate->name, preferred)) {
|
||||||
if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) {
|
if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user