mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
qemu: taint the VM if it is using a deprecated machine type
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
c212eb6c7f
commit
6a40c01ed0
@ -2462,6 +2462,22 @@ virQEMUCapsIsCPUDeprecated(virQEMUCapsPtr qemuCaps,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
virQEMUCapsIsMachineDeprecated(virQEMUCapsPtr qemuCaps,
|
||||||
|
virDomainVirtType type,
|
||||||
|
const char *machine)
|
||||||
|
{
|
||||||
|
virQEMUCapsAccelPtr accel = virQEMUCapsGetAccel(qemuCaps, type);
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < accel->nmachineTypes; i++) {
|
||||||
|
if (STREQ_NULLABLE(accel->machineTypes[i].name, machine))
|
||||||
|
return accel->machineTypes[i].deprecated;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
virQEMUCapsGetMachineNumaMemSupported(virQEMUCapsPtr qemuCaps,
|
virQEMUCapsGetMachineNumaMemSupported(virQEMUCapsPtr qemuCaps,
|
||||||
virDomainVirtType virtType,
|
virDomainVirtType virtType,
|
||||||
|
@ -690,6 +690,9 @@ const char *virQEMUCapsGetMachineDefaultCPU(virQEMUCapsPtr qemuCaps,
|
|||||||
bool virQEMUCapsIsCPUDeprecated(virQEMUCapsPtr qemuCaps,
|
bool virQEMUCapsIsCPUDeprecated(virQEMUCapsPtr qemuCaps,
|
||||||
virDomainVirtType type,
|
virDomainVirtType type,
|
||||||
const char *model);
|
const char *model);
|
||||||
|
bool virQEMUCapsIsMachineDeprecated(virQEMUCapsPtr qemuCaps,
|
||||||
|
virDomainVirtType type,
|
||||||
|
const char *machine);
|
||||||
bool virQEMUCapsGetMachineNumaMemSupported(virQEMUCapsPtr qemuCaps,
|
bool virQEMUCapsGetMachineNumaMemSupported(virQEMUCapsPtr qemuCaps,
|
||||||
virDomainVirtType virtType,
|
virDomainVirtType virtType,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
@ -6274,6 +6274,24 @@ void qemuDomainObjTaintMsg(virQEMUDriverPtr driver,
|
|||||||
virErrorRestore(&orig_err);
|
virErrorRestore(&orig_err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
qemuDomainObjCheckMachineTaint(virQEMUDriverPtr driver,
|
||||||
|
virDomainObjPtr obj,
|
||||||
|
qemuDomainLogContextPtr logCtxt)
|
||||||
|
{
|
||||||
|
qemuDomainObjPrivatePtr priv = obj->privateData;
|
||||||
|
virQEMUCapsPtr qemuCaps = priv->qemuCaps;
|
||||||
|
|
||||||
|
if (virQEMUCapsIsMachineDeprecated(qemuCaps,
|
||||||
|
obj->def->virtType,
|
||||||
|
obj->def->os.machine)) {
|
||||||
|
qemuDomainObjTaintMsg(driver, obj, VIR_DOMAIN_TAINT_DEPRECATED_CONFIG, logCtxt,
|
||||||
|
_("machine type '%s'"),
|
||||||
|
obj->def->os.machine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
qemuDomainObjCheckCPUTaint(virQEMUDriverPtr driver,
|
qemuDomainObjCheckCPUTaint(virQEMUDriverPtr driver,
|
||||||
virDomainObjPtr obj,
|
virDomainObjPtr obj,
|
||||||
@ -6338,6 +6356,8 @@ void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
|
|||||||
VIR_DOMAIN_TAINT_CUSTOM_HYPERVISOR_FEATURE, logCtxt);
|
VIR_DOMAIN_TAINT_CUSTOM_HYPERVISOR_FEATURE, logCtxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qemuDomainObjCheckMachineTaint(driver, obj, logCtxt);
|
||||||
|
|
||||||
if (obj->def->cpu)
|
if (obj->def->cpu)
|
||||||
qemuDomainObjCheckCPUTaint(driver, obj, logCtxt, incomingMigration);
|
qemuDomainObjCheckCPUTaint(driver, obj, logCtxt, incomingMigration);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user