Compare commits

...

2 Commits

Author SHA1 Message Date
Alexandre Derumier
f3fde178c0 Merge branch 'fix-cpumap-version' into 'master'
cpu_map : sync_qemu_models : fix versionned models

See merge request libvirt/libvirt!258
2024-03-25 16:14:00 +00:00
Alexandre Derumier
31f446cf37 cpu_map : sync_qemu_models : fix versionned models
Currently, a new versionned model is only generated when an alias exist
in the version.

This is wrong, because not all versions have an alias, so some models
are not generated, and last version is override the main model.
(with newer flags not present in the original model)

This patch create an "<modelname>-v<version>.xml" for each versionned model,
and keep the extra "<alias>.xml"
2023-05-20 08:43:15 +02:00

View File

@ -429,9 +429,10 @@ def expand_model(model):
"""Expand a qemu cpu model description that has its feature split up into """Expand a qemu cpu model description that has its feature split up into
different fields and may have differing versions into several libvirt- different fields and may have differing versions into several libvirt-
friendly cpu models.""" friendly cpu models."""
name = model.pop(".name")
result = { result = {
"name": model.pop(".name"), "name": name,
"vendor": translate_vendor(model.pop(".vendor")), "vendor": translate_vendor(model.pop(".vendor")),
"features": set(), "features": set(),
"extra": dict()} "extra": dict()}
@ -454,7 +455,8 @@ def expand_model(model):
for version in versions: for version in versions:
result = copy.deepcopy(result) result = copy.deepcopy(result)
result["name"] = version.pop(".alias", result["name"]) version_num = version.pop(".version", '1')
result["name"] = name + "-v" + version_num
props = version.pop(".props", dict()) props = version.pop(".props", dict())
for k, v in props: for k, v in props:
@ -475,6 +477,11 @@ def expand_model(model):
yield result yield result
alias = version.pop(".alias", None)
if alias:
result = copy.deepcopy(result)
result["name"] = alias
yield result
def output_model(f, model): def output_model(f, model):
if model["extra"]: if model["extra"]: