|
|
d76c62 |
From 37b27a297ecb87e65f41c212aaabde7311b042d6 Mon Sep 17 00:00:00 2001
|
|
|
d76c62 |
Message-Id: <37b27a297ecb87e65f41c212aaabde7311b042d6@dist-git>
|
|
|
d76c62 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
d76c62 |
Date: Thu, 20 Feb 2020 09:08:05 +0100
|
|
|
d76c62 |
Subject: [PATCH] cpu_conf: Format vendor_id for host-model CPUs
|
|
|
d76c62 |
MIME-Version: 1.0
|
|
|
d76c62 |
Content-Type: text/plain; charset=UTF-8
|
|
|
d76c62 |
Content-Transfer-Encoding: 8bit
|
|
|
d76c62 |
|
|
|
d76c62 |
In commit v5.9.0-400-gaf8e39921a I removed printing model's fallback and
|
|
|
d76c62 |
vendor_id attributes when no model is specified. However, vendor_id
|
|
|
d76c62 |
makes sense even without a specific CPU model (for host-model CPUs).
|
|
|
d76c62 |
|
|
|
d76c62 |
https://bugzilla.redhat.com/show_bug.cgi?id=1804549
|
|
|
d76c62 |
|
|
|
d76c62 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
d76c62 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
d76c62 |
(cherry picked from commit 0905f222f1bfd9d741e94a8d653e05bb174846d3)
|
|
|
d76c62 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
d76c62 |
Message-Id: <0b46ae9e26d1c7dbaa7f2dd58fd1156db237a853.1582186015.git.jdenemar@redhat.com>
|
|
|
d76c62 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
d76c62 |
---
|
|
|
d76c62 |
src/conf/cpu_conf.c | 14 +++++++++-----
|
|
|
d76c62 |
tests/qemuxml2xmloutdata/cpu-host-model-vendor.xml | 4 +++-
|
|
|
d76c62 |
2 files changed, 12 insertions(+), 6 deletions(-)
|
|
|
d76c62 |
|
|
|
d76c62 |
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
|
|
|
d76c62 |
index 837d77581c..1a2948ce11 100644
|
|
|
d76c62 |
--- a/src/conf/cpu_conf.c
|
|
|
d76c62 |
+++ b/src/conf/cpu_conf.c
|
|
|
d76c62 |
@@ -791,10 +791,10 @@ virCPUDefFormatBuf(virBufferPtr buf,
|
|
|
d76c62 |
return -1;
|
|
|
d76c62 |
}
|
|
|
d76c62 |
|
|
|
d76c62 |
- if (formatModel && def->model) {
|
|
|
d76c62 |
+ if (formatModel && (def->model || def->vendor_id)) {
|
|
|
d76c62 |
virBufferAddLit(buf, "
|
|
|
d76c62 |
|
|
|
d76c62 |
- if (def->type == VIR_CPU_TYPE_GUEST) {
|
|
|
d76c62 |
+ if (def->type == VIR_CPU_TYPE_GUEST && def->model) {
|
|
|
d76c62 |
const char *fallback;
|
|
|
d76c62 |
|
|
|
d76c62 |
fallback = virCPUFallbackTypeToString(def->fallback);
|
|
|
d76c62 |
@@ -805,11 +805,15 @@ virCPUDefFormatBuf(virBufferPtr buf,
|
|
|
d76c62 |
return -1;
|
|
|
d76c62 |
}
|
|
|
d76c62 |
virBufferAsprintf(buf, " fallback='%s'", fallback);
|
|
|
d76c62 |
- if (def->vendor_id)
|
|
|
d76c62 |
- virBufferEscapeString(buf, " vendor_id='%s'", def->vendor_id);
|
|
|
d76c62 |
}
|
|
|
d76c62 |
|
|
|
d76c62 |
- virBufferEscapeString(buf, ">%s</model>\n", def->model);
|
|
|
d76c62 |
+ if (def->type == VIR_CPU_TYPE_GUEST)
|
|
|
d76c62 |
+ virBufferEscapeString(buf, " vendor_id='%s'", def->vendor_id);
|
|
|
d76c62 |
+
|
|
|
d76c62 |
+ if (def->model)
|
|
|
d76c62 |
+ virBufferEscapeString(buf, ">%s</model>\n", def->model);
|
|
|
d76c62 |
+ else
|
|
|
d76c62 |
+ virBufferAddLit(buf, "/>\n");
|
|
|
d76c62 |
}
|
|
|
d76c62 |
|
|
|
d76c62 |
if (formatModel && def->vendor)
|
|
|
d76c62 |
diff --git a/tests/qemuxml2xmloutdata/cpu-host-model-vendor.xml b/tests/qemuxml2xmloutdata/cpu-host-model-vendor.xml
|
|
|
d76c62 |
index d2447ccd10..2a7d0246cc 100644
|
|
|
d76c62 |
--- a/tests/qemuxml2xmloutdata/cpu-host-model-vendor.xml
|
|
|
d76c62 |
+++ b/tests/qemuxml2xmloutdata/cpu-host-model-vendor.xml
|
|
|
d76c62 |
@@ -8,7 +8,9 @@
|
|
|
d76c62 |
<type arch='x86_64' machine='pc'>hvm</type>
|
|
|
d76c62 |
<boot dev='network'/>
|
|
|
d76c62 |
</os>
|
|
|
d76c62 |
- <cpu mode='host-model' check='partial'/>
|
|
|
d76c62 |
+ <cpu mode='host-model' check='partial'>
|
|
|
d76c62 |
+ <model vendor_id='Libvirt QEMU'/>
|
|
|
d76c62 |
+ </cpu>
|
|
|
d76c62 |
<clock offset='utc'/>
|
|
|
d76c62 |
<on_poweroff>destroy</on_poweroff>
|
|
|
d76c62 |
<on_reboot>restart</on_reboot>
|
|
|
d76c62 |
--
|
|
|
d76c62 |
2.25.0
|
|
|
d76c62 |
|