[libvirt PATCH 13/29] cpu-gather: Merge model gathering logic

Tim Wiederhake twiederh at redhat.com
Tue Dec 15 16:24:59 UTC 2020


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 tests/cputestdata/cpu-gather.py | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather.py
index ea1d42f1ec..c639c433d2 100755
--- a/tests/cputestdata/cpu-gather.py
+++ b/tests/cputestdata/cpu-gather.py
@@ -96,7 +96,7 @@ def call_qemu(qemu, qmp_cmds):
             yield json.loads(line)
 
 
-def gather_static_model(args):
+def gather_model(args):
     output = call_qemu(args.path_to_qemu, [
         {
             "execute": "query-cpu-model-expansion",
@@ -108,14 +108,11 @@ def gather_static_model(args):
             "id": "model-expansion"
         }])
 
+    static_model = None
     for o in output:
         if o.get("id") == "model-expansion":
-            return o["return"]["model"]
+            static_model = o["return"]["model"]
 
-    return None
-
-
-def gather_full_model(args, static_model):
     if static_model:
         return call_qemu(args.path_to_qemu, [
             {
@@ -231,15 +228,13 @@ def main():
         for key, value in sorted(msr.items()):
             print("   0x{:x}: 0x{:016x}\n".format(int(key), value))
 
-    static_model = gather_static_model(args)
-    model = gather_full_model(args, static_model)
+    model = gather_model(args)
     for o in model:
         print(json.dumps(o))
 
     print(end="", flush=True)
     os.environ["CPU_GATHER_PY"] = "true"
     os.environ["qemu"] = args.path_to_qemu
-    os.environ["model"] = json.dumps(static_model) if static_model else ""
     subprocess.check_call("./cpu-gather.sh")
 
 
-- 
2.26.2




More information about the libvir-list mailing list