mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-21 13:34:06 +03:00
qemu_capabilities: filter deprecated features if requested
If flag VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES is passed to qemuConnectGetDomainCapabilities, then the domain's CPU model features will be updated to set any deprecated features to the 'disabled' policy. Signed-off-by: Collin Walling <walling@linux.ibm.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
4e2c8de204
commit
cd1e837c22
@ -3330,6 +3330,26 @@ virQEMUCapsGetCPUFeatures(virQEMUCaps *qemuCaps,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
virQEMUCapsUpdateCPUDeprecatedFeatures(virQEMUCaps *qemuCaps,
|
||||
virDomainVirtType virtType,
|
||||
virCPUDef *cpu)
|
||||
{
|
||||
qemuMonitorCPUModelInfo *modelInfo;
|
||||
size_t i;
|
||||
|
||||
modelInfo = virQEMUCapsGetCPUModelInfo(qemuCaps, virtType);
|
||||
|
||||
if (!modelInfo || !modelInfo->deprecated_props)
|
||||
return;
|
||||
|
||||
for (i = 0; i < g_strv_length(modelInfo->deprecated_props); i++) {
|
||||
virCPUDefUpdateFeature(cpu, modelInfo->deprecated_props[i],
|
||||
VIR_CPU_FEATURE_DISABLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct tpmTypeToCaps {
|
||||
int type;
|
||||
virQEMUCapsFlags caps;
|
||||
|
@ -764,6 +764,9 @@ int virQEMUCapsGetCPUFeatures(virQEMUCaps *qemuCaps,
|
||||
virDomainVirtType virtType,
|
||||
bool migratable,
|
||||
char ***features);
|
||||
void virQEMUCapsUpdateCPUDeprecatedFeatures(virQEMUCaps *qemuCaps,
|
||||
virDomainVirtType virtType,
|
||||
virCPUDef *cpu);
|
||||
|
||||
virDomainVirtType virQEMUCapsGetVirtType(virQEMUCaps *qemuCaps);
|
||||
|
||||
|
@ -16530,7 +16530,8 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
virDomainVirtType virttype;
|
||||
g_autoptr(virDomainCaps) domCaps = NULL;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
virCheckFlags(VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES,
|
||||
NULL);
|
||||
|
||||
if (virConnectGetDomainCapabilitiesEnsureACL(conn) < 0)
|
||||
return NULL;
|
||||
@ -16549,6 +16550,11 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
arch, virttype)))
|
||||
return NULL;
|
||||
|
||||
if (flags & VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES) {
|
||||
virQEMUCapsUpdateCPUDeprecatedFeatures(qemuCaps, virttype,
|
||||
domCaps->cpu.hostModel);
|
||||
}
|
||||
|
||||
return virDomainCapsFormat(domCaps);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user