1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-24 06:03:52 +03:00

qemu: Drop vmx-* from migratable CPU model only when origCPU is set

When qemuDomainMakeCPUMigratable is called with origCPU == NULL the code
just removed all vmx-* features marked as added in the specified CPU
model just like when origCPU is not NULL, but does not list any of the
vmx-* features. But this is wrong, we should not touch these features at
all when no origCPU is supplied, which happens when parsing XML passed
by a user (e.g., migration XML). Such XML is supposed to be generated by
libvirt as migration XML and contains only vmx-* features explicitly
requested by a user.

https://issues.redhat.com/browse/RHEL-52314

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jiri Denemark 2024-10-08 12:26:40 +02:00
parent cd630c1b16
commit aae8a5774b

View File

@ -6889,23 +6889,21 @@ qemuDomainMakeCPUMigratable(virArch arch,
virCPUDefUpdateFeature(cpu, "pconfig", VIR_CPU_FEATURE_DISABLE);
}
if (virCPUx86GetAddedFeatures(cpu->model, &data.added) < 0)
return -1;
/* Drop features marked as added in a cpu model, but only
* when they are not mentioned in origCPU, i.e., when they were not
* explicitly mentioned by the user.
*/
if (data.added) {
g_auto(GStrv) keep = NULL;
if (origCPU) {
keep = virCPUDefListExplicitFeatures(origCPU);
data.keep = keep;
}
if (virCPUDefFilterFeatures(cpu, qemuDomainDropAddedCPUFeatures, &data) < 0)
if (origCPU) {
if (virCPUx86GetAddedFeatures(cpu->model, &data.added) < 0)
return -1;
/* Drop features marked as added in a cpu model, but only
* when they are not mentioned in origCPU, i.e., when they were not
* explicitly mentioned by the user.
*/
if (data.added) {
g_auto(GStrv) keep = virCPUDefListExplicitFeatures(origCPU);
data.keep = keep;
if (virCPUDefFilterFeatures(cpu, qemuDomainDropAddedCPUFeatures, &data) < 0)
return -1;
}
}
return 0;