]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
cpu-gather: Move simple model extraction to new script
authorTim Wiederhake <twiederh@redhat.com>
Tue, 15 Dec 2020 16:24:57 +0000 (17:24 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 18 Dec 2020 22:20:09 +0000 (23:20 +0100)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/cputestdata/cpu-gather.py
tests/cputestdata/cpu-gather.sh

index 0c8d8e93d0e1a7c064a94a1b11f8027ea6b9997e..5c03d226b6467ea60f2bd4f3ee5bf38bdd77a431 100755 (executable)
@@ -115,6 +115,63 @@ def gather_static_model(args):
     return None
 
 
+def gather_full_model(args, static_model):
+    if static_model:
+        return []
+    else:
+        return call_qemu(args.path_to_qemu, [
+            {
+                "execute": "qom-get",
+                "arguments":
+                {
+                    "path": "/machine/unattached/device[0]",
+                    "property": "feature-words"
+                },
+                "id": "feature-words"
+            },
+            {
+                "execute": "qom-get",
+                "arguments":
+                {
+                    "path": "/machine/unattached/device[0]",
+                    "property": "family"
+                },
+                "id": "family"
+            },
+            {
+                "execute": "qom-get",
+                "arguments":
+                {
+                    "path": "/machine/unattached/device[0]",
+                    "property": "model"
+                },
+                "id": "model"
+            },
+            {
+                "execute": "qom-get",
+                "arguments":
+                {
+                    "path": "/machine/unattached/device[0]",
+                    "property": "stepping"
+                },
+                "id": "stepping"
+            },
+            {
+                "execute": "qom-get",
+                "arguments":
+                {
+                    "path": "/machine/unattached/device[0]",
+                    "property": "model-id"
+                },
+                "id": "model-id"
+            },
+            {
+                "execute": "query-cpu-definitions",
+                "id": "definitions"
+            }
+        ])
+
+
 def main():
     parser = argparse.ArgumentParser(description="Gather cpu test data")
     parser.add_argument(
@@ -161,6 +218,9 @@ def main():
             print("   0x{:x}: 0x{:016x}\n".format(int(key), value))
 
     static_model = gather_static_model(args)
+    model = gather_full_model(args, static_model)
+    for o in model:
+        print(json.dumps(o))
 
     print(end="", flush=True)
     os.environ["CPU_GATHER_PY"] = "true"
index 726f0139084d9e26fe35fc593e0306cb7d24e14c..05faf14a96d8b872e47acae5103dd7abc45a3b34 100755 (executable)
@@ -5,13 +5,6 @@ if [ -z "${CPU_GATHER_PY}" ]; then
     exit 1
 fi
 
-qom_get()
-{
-    path='/machine/unattached/device[0]'
-    echo '{"execute":"qom-get","arguments":{"path":"'$path'",' \
-         '"property":"'$1'"},"id":"'$1'"}'
-}
-
 model_expansion()
 {
     mode=$1
@@ -26,12 +19,6 @@ $qemu -machine accel=kvm -cpu host -nodefaults -nographic -qmp stdio <<EOF
 $(
     if [ "x$model" != x ]; then
         model_expansion full "$model"
-    else
-        qom_get feature-words
-        qom_get family
-        qom_get model
-        qom_get stepping
-        qom_get model-id
     fi
 )
 {"execute":"query-cpu-definitions","id":"definitions"}