1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

cpu_map: sync_qemu_cpu_i386: Translate features in model versions

If a feature is added (or removed) in a QEMU CPU model version, we
get to see the QEMU pretty name for the feature, not the name of
the macro.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Tim Wiederhake 2020-11-23 15:14:26 +01:00 committed by Jiri Denemark
parent 8292597da6
commit 4644a17d76

View File

@ -164,6 +164,10 @@ def translate_feature(name):
if name in T: if name in T:
return T[name] return T[name]
for v in T.values():
if name.replace("-", "_") == v.replace("-", "_"):
return v
print("warning: Unknown feature '{}'".format(name)) print("warning: Unknown feature '{}'".format(name))
return name return name
@ -308,6 +312,11 @@ def expand_model(model):
props = version.pop(".props", dict()) props = version.pop(".props", dict())
for k, v in props: for k, v in props:
if k not in ("model-id", "stepping", "model"):
k = translate_feature(k)
if k is None:
continue
if v == "on": if v == "on":
result["features"].add(k) result["features"].add(k)
elif v == "off" and k in result["features"]: elif v == "off" and k in result["features"]: