提交 b2de33e2 编写于 作者: J Jiri Denemark

cpu: Use vendor in baseline CPU only if all hosts use it

When only some host CPUs given to cpuBaseline contain <vendor> element,
baseline CPU should not contain it. Otherwise the result would not be
compatible with the host CPUs without vendor. CPU vendors are still
taken into account when computing baseline CPU, it's just removed from
the result.
上级 ac7afbeb
......@@ -1621,6 +1621,7 @@ x86Baseline(virCPUDefPtr *cpus,
unsigned int i;
const struct x86_vendor *vendor = NULL;
struct x86_model *model = NULL;
bool outputVendor = true;
if (!(map = x86LoadMap()))
goto error;
......@@ -1634,8 +1635,9 @@ x86Baseline(virCPUDefPtr *cpus,
cpu->type = VIR_CPU_TYPE_GUEST;
cpu->match = VIR_CPU_MATCH_EXACT;
if (cpus[0]->vendor &&
!(vendor = x86VendorFind(map, cpus[0]->vendor))) {
if (!cpus[0]->vendor)
outputVendor = false;
else if (!(vendor = x86VendorFind(map, cpus[0]->vendor))) {
virCPUReportError(VIR_ERR_OPERATION_FAILED,
_("Unknown CPU vendor %s"), cpus[0]->vendor);
goto error;
......@@ -1657,8 +1659,11 @@ x86Baseline(virCPUDefPtr *cpus,
if (cpus[i]->vendor)
vn = cpus[i]->vendor;
else if (model->vendor)
vn = model->vendor->name;
else {
outputVendor = false;
if (model->vendor)
vn = model->vendor->name;
}
if (vn) {
if (!vendor) {
......@@ -1694,6 +1699,9 @@ x86Baseline(virCPUDefPtr *cpus,
if (x86Decode(cpu, data, models, nmodels, NULL) < 0)
goto error;
if (!outputVendor)
VIR_FREE(cpu->vendor);
VIR_FREE(cpu->arch);
cleanup:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册