提交 0905f222 编写于 作者: J Jiri Denemark

cpu_conf: Format vendor_id for host-model CPUs

In commit v5.9.0-400-gaf8e3992 I removed printing model's fallback and
vendor_id attributes when no model is specified. However, vendor_id
makes sense even without a specific CPU model (for host-model CPUs).

https://bugzilla.redhat.com/show_bug.cgi?id=1804549Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 1939fbef
......@@ -791,10 +791,10 @@ virCPUDefFormatBuf(virBufferPtr buf,
return -1;
}
if (formatModel && def->model) {
if (formatModel && (def->model || def->vendor_id)) {
virBufferAddLit(buf, "<model");
if (def->type == VIR_CPU_TYPE_GUEST) {
if (def->type == VIR_CPU_TYPE_GUEST && def->model) {
const char *fallback;
fallback = virCPUFallbackTypeToString(def->fallback);
......@@ -805,11 +805,15 @@ virCPUDefFormatBuf(virBufferPtr buf,
return -1;
}
virBufferAsprintf(buf, " fallback='%s'", fallback);
if (def->vendor_id)
virBufferEscapeString(buf, " vendor_id='%s'", def->vendor_id);
}
if (def->type == VIR_CPU_TYPE_GUEST)
virBufferEscapeString(buf, " vendor_id='%s'", def->vendor_id);
if (def->model)
virBufferEscapeString(buf, ">%s</model>\n", def->model);
else
virBufferAddLit(buf, "/>\n");
}
if (formatModel && def->vendor)
......
......@@ -8,7 +8,9 @@
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='network'/>
</os>
<cpu mode='host-model' check='partial'/>
<cpu mode='host-model' check='partial'>
<model vendor_id='Libvirt QEMU'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册