mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-14 08:35:15 +00:00
qemu: taint the VM if it is using a deprecated CPU model
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
30626ed15b
commit
c212eb6c7f
@ -2445,6 +2445,23 @@ virQEMUCapsGetMachineDefaultCPU(virQEMUCapsPtr qemuCaps,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
virQEMUCapsIsCPUDeprecated(virQEMUCapsPtr qemuCaps,
|
||||||
|
virDomainVirtType type,
|
||||||
|
const char *model)
|
||||||
|
{
|
||||||
|
virQEMUCapsAccelPtr accel = virQEMUCapsGetAccel(qemuCaps, type);
|
||||||
|
qemuMonitorCPUDefsPtr defs = accel->cpuModels;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < defs->ncpus; i++) {
|
||||||
|
if (STREQ_NULLABLE(defs->cpus[i].name, model))
|
||||||
|
return defs->cpus[i].deprecated;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
virQEMUCapsGetMachineNumaMemSupported(virQEMUCapsPtr qemuCaps,
|
virQEMUCapsGetMachineNumaMemSupported(virQEMUCapsPtr qemuCaps,
|
||||||
virDomainVirtType virtType,
|
virDomainVirtType virtType,
|
||||||
|
@ -687,6 +687,9 @@ bool virQEMUCapsGetMachineHotplugCpus(virQEMUCapsPtr qemuCaps,
|
|||||||
const char *virQEMUCapsGetMachineDefaultCPU(virQEMUCapsPtr qemuCaps,
|
const char *virQEMUCapsGetMachineDefaultCPU(virQEMUCapsPtr qemuCaps,
|
||||||
const char *name,
|
const char *name,
|
||||||
virDomainVirtType type);
|
virDomainVirtType type);
|
||||||
|
bool virQEMUCapsIsCPUDeprecated(virQEMUCapsPtr qemuCaps,
|
||||||
|
virDomainVirtType type,
|
||||||
|
const char *model);
|
||||||
bool virQEMUCapsGetMachineNumaMemSupported(virQEMUCapsPtr qemuCaps,
|
bool virQEMUCapsGetMachineNumaMemSupported(virQEMUCapsPtr qemuCaps,
|
||||||
virDomainVirtType virtType,
|
virDomainVirtType virtType,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
@ -6274,6 +6274,37 @@ void qemuDomainObjTaintMsg(virQEMUDriverPtr driver,
|
|||||||
virErrorRestore(&orig_err);
|
virErrorRestore(&orig_err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
qemuDomainObjCheckCPUTaint(virQEMUDriverPtr driver,
|
||||||
|
virDomainObjPtr obj,
|
||||||
|
qemuDomainLogContextPtr logCtxt,
|
||||||
|
bool incomingMigration)
|
||||||
|
{
|
||||||
|
qemuDomainObjPrivatePtr priv = obj->privateData;
|
||||||
|
virQEMUCapsPtr qemuCaps = priv->qemuCaps;
|
||||||
|
|
||||||
|
switch (obj->def->cpu->mode) {
|
||||||
|
case VIR_CPU_MODE_HOST_PASSTHROUGH:
|
||||||
|
if (incomingMigration)
|
||||||
|
qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HOST_CPU, logCtxt);
|
||||||
|
break;
|
||||||
|
case VIR_CPU_MODE_CUSTOM:
|
||||||
|
if (obj->def->cpu->model &&
|
||||||
|
virQEMUCapsIsCPUDeprecated(qemuCaps,
|
||||||
|
obj->def->virtType,
|
||||||
|
obj->def->cpu->model)) {
|
||||||
|
qemuDomainObjTaintMsg(driver, obj, VIR_DOMAIN_TAINT_DEPRECATED_CONFIG, logCtxt,
|
||||||
|
_("CPU model '%s'"),
|
||||||
|
obj->def->cpu->model);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case VIR_CPU_MODE_HOST_MODEL:
|
||||||
|
case VIR_CPU_MODE_LAST:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
|
void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
|
||||||
virDomainObjPtr obj,
|
virDomainObjPtr obj,
|
||||||
@ -6307,10 +6338,8 @@ void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
|
|||||||
VIR_DOMAIN_TAINT_CUSTOM_HYPERVISOR_FEATURE, logCtxt);
|
VIR_DOMAIN_TAINT_CUSTOM_HYPERVISOR_FEATURE, logCtxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj->def->cpu &&
|
if (obj->def->cpu)
|
||||||
obj->def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH &&
|
qemuDomainObjCheckCPUTaint(driver, obj, logCtxt, incomingMigration);
|
||||||
incomingMigration)
|
|
||||||
qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HOST_CPU, logCtxt);
|
|
||||||
|
|
||||||
for (i = 0; i < obj->def->ndisks; i++)
|
for (i = 0; i < obj->def->ndisks; i++)
|
||||||
qemuDomainObjCheckDiskTaint(driver, obj, obj->def->disks[i], logCtxt);
|
qemuDomainObjCheckDiskTaint(driver, obj, obj->def->disks[i], logCtxt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user