提交 0b763774 编写于 作者: J Jiri Denemark

qemu: Filter CPU features in active XML

Properly filter features which should not be passed to QEMU because they
were never supported by QEMU or they did nothing and QEMU dropped them.

Currently they are just silently ignored by the command line generator.
Let's make this process more visible and clean by dropping the features
from the domain's active definition in qemuProcessUpdateGuestCPU.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 c145b660
...@@ -7106,9 +7106,6 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver, ...@@ -7106,9 +7106,6 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
virBufferAsprintf(buf, ",vendor=%s", cpu->vendor_id); virBufferAsprintf(buf, ",vendor=%s", cpu->vendor_id);
for (i = 0; i < cpu->nfeatures; i++) { for (i = 0; i < cpu->nfeatures; i++) {
if (!virQEMUCapsCPUFilterFeatures(cpu->features[i].name,
(virArch *)&def->os.arch))
continue;
switch ((virCPUFeaturePolicy) cpu->features[i].policy) { switch ((virCPUFeaturePolicy) cpu->features[i].policy) {
case VIR_CPU_FEATURE_FORCE: case VIR_CPU_FEATURE_FORCE:
case VIR_CPU_FEATURE_REQUIRE: case VIR_CPU_FEATURE_REQUIRE:
......
...@@ -5928,26 +5928,30 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def, ...@@ -5928,26 +5928,30 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def,
return -1; return -1;
/* nothing to update for host-passthrough */ /* nothing to update for host-passthrough */
if (def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) if (def->cpu->mode != VIR_CPU_MODE_HOST_PASSTHROUGH) {
return 0; if (def->cpu->check == VIR_CPU_CHECK_PARTIAL &&
virCPUCompare(caps->host.arch,
virQEMUCapsGetHostModel(qemuCaps, def->virtType,
VIR_QEMU_CAPS_HOST_CPU_FULL),
def->cpu, true) < 0)
return -1;
if (def->cpu->check == VIR_CPU_CHECK_PARTIAL && if (virCPUUpdate(def->os.arch, def->cpu,
virCPUCompare(caps->host.arch, virQEMUCapsGetHostModel(qemuCaps, def->virtType,
virQEMUCapsGetHostModel(qemuCaps, def->virtType, VIR_QEMU_CAPS_HOST_CPU_MIGRATABLE)) < 0)
VIR_QEMU_CAPS_HOST_CPU_FULL), return -1;
def->cpu, true) < 0)
return -1;
if (virCPUUpdate(def->os.arch, def->cpu, if (virCPUTranslate(def->os.arch, def->cpu,
virQEMUCapsGetHostModel(qemuCaps, def->virtType, virQEMUCapsGetCPUDefinitions(qemuCaps, def->virtType)) < 0)
VIR_QEMU_CAPS_HOST_CPU_MIGRATABLE)) < 0) return -1;
return -1;
def->cpu->fallback = VIR_CPU_FALLBACK_FORBID;
}
if (virCPUTranslate(def->os.arch, def->cpu, if (virCPUDefFilterFeatures(def->cpu, virQEMUCapsCPUFilterFeatures,
virQEMUCapsGetCPUDefinitions(qemuCaps, def->virtType)) < 0) &def->os.arch) < 0)
return -1; return -1;
def->cpu->fallback = VIR_CPU_FALLBACK_FORBID;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册