1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

cpu_conf: Format vendor_id for host-model CPUs

In commit v5.9.0-400-gaf8e39921a 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=1804549

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jiri Denemark 2020-02-19 13:48:39 +01:00
parent 1939fbef98
commit 0905f222f1
2 changed files with 12 additions and 6 deletions

View File

@ -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);
}
virBufferEscapeString(buf, ">%s</model>\n", def->model);
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)

View File

@ -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>