Each CPU model with -v* suffix is defined as a standalone model copying
all attributes of the previous version. The only difference is -v1 which
are defined as identical to the possibly already existing non-versioned
CPU model. The -v1 CPU models will never be used in either host or
domain capabilities for describing the host CPU for better compatibility
with older releases of libvirt.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/cpu_map/sync_qemu_models_i386.py | 45 ++++++++++++++++++++++++----
1 file changed, 40 insertions(+), 5 deletions(-)
diff --git a/src/cpu_map/sync_qemu_models_i386.py b/src/cpu_map/sync_qemu_models_i386.py
index 13f62780e6..f75d649fe0 100755
--- a/src/cpu_map/sync_qemu_models_i386.py
+++ b/src/cpu_map/sync_qemu_models_i386.py
@@ -454,11 +454,20 @@ def expand_model(model):
versions = model.pop(".versions", [])
for k, v in model.items():
result["extra"]["model" + k] = v
+
+ print(result['name'])
yield result
+ name = result["name"]
for version in versions:
result = copy.deepcopy(result)
- result["name"] = version.pop(".alias", result["name"])
+
+ ver = int(version.pop(".version"))
+ result["name"] = f"{name}-v{ver}"
+
+ alias = version.pop(".alias", None)
+ if not alias and ver == 1:
+ alias = name
props = version.pop(".props", dict())
for k, v in props:
@@ -477,7 +486,25 @@ def expand_model(model):
for k, v in version.items():
result["extra"]["version" + k] = v
- yield result
+ if ver == 1:
+ print(f"v{ver}: {result['name']} => {alias}")
+ yield {
+ "vendor": result["vendor"],
+ "name": result["name"],
+ "alias": alias,
+ "extra": None,
+ "features": [],
+ }
+ else:
+ if alias:
+ print(f"v{ver}: {result['name']}")
+ yield result
+
+ result = copy.deepcopy(result)
+ result["name"] = alias
+
+ print(f"v{ver}: {result['name']}")
+ yield result
def output_model(f, model):
@@ -487,11 +514,19 @@ def output_model(f, model):
f.write(f" '{k}': '{v}'\n")
f.write("-->\n")
+ alias = "alias" in model
+ decode = "off" if alias else "on"
+
f.write("<cpus>\n")
f.write(f" <model name='{model['name']}'>\n")
- f.write(" <decode host='on' guest='on'/>\n")
- f.write(f" <signature family='{model['family']}' model='{model['model']}'/>\n")
- f.write(f" <vendor name='{model['vendor']}'/>\n")
+ f.write(f" <decode host='{decode}' guest='{decode}'/>\n")
+
+ if alias:
+ f.write(f" <model name='{model['alias']}'/>\n")
+ else:
+ f.write(f" <signature family='{model['family']}' model='{model['model']}'/>\n")
+ f.write(f" <vendor name='{model['vendor']}'/>\n")
+
for feature in sorted(model["features"]):
f.write(f" <feature name='{feature}'/>\n")
f.write(" </model>\n")
--
2.47.0