render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From ee7dbe155f527b43799816c324de447184f7de7e Mon Sep 17 00:00:00 2001
Message-Id: <ee7dbe155f527b43799816c324de447184f7de7e@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 24 Aug 2016 16:11:26 -0400
Subject: [PATCH] tests: cpu-hotplug: Add data for x86 hotplug with 11+ vcpus

https://bugzilla.redhat.com/show_bug.cgi?id=1097930
https://bugzilla.redhat.com/show_bug.cgi?id=1224341

During review it was reported that adding at least 11 vcpus creates a
collision of prefixes in the monitor matching algorithm. Add a test case
to verify that the problem won't happen.

(cherry picked from commit 22e3bb332e1e035b5905686936427ef93a7b834f)
---
 .../qemumonitorjson-cpuinfo-x86-full-cpus.json     | 104 +++++++++++++++++++
 .../qemumonitorjson-cpuinfo-x86-full-hotplug.json  | 115 +++++++++++++++++++++
 .../qemumonitorjson-cpuinfo-x86-full.data          |  76 ++++++++++++++
 tests/qemumonitorjsontest.c                        |   1 +
 4 files changed, 296 insertions(+)
 create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-cpus.json
 create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-hotplug.json
 create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data

diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-cpus.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-cpus.json
new file mode 100644
index 0000000..16f5cc4
--- /dev/null
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-cpus.json
@@ -0,0 +1,104 @@
+{
+  "return": [
+    {
+      "arch": "x86",
+      "current": true,
+      "CPU": 0,
+      "qom_path": "/machine/unattached/device[0]",
+      "pc": 1042686,
+      "halted": false,
+      "thread_id": 895040
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 1,
+      "qom_path": "/machine/peripheral/vcpu1",
+      "pc": 4294967280,
+      "halted": false,
+      "thread_id": 895056
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 2,
+      "qom_path": "/machine/peripheral/vcpu2",
+      "pc": 4294967280,
+      "halted": false,
+      "thread_id": 895057
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 3,
+      "qom_path": "/machine/peripheral/vcpu3",
+      "pc": 4294967280,
+      "halted": false,
+      "thread_id": 895058
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 4,
+      "qom_path": "/machine/peripheral/vcpu4",
+      "pc": 4294967280,
+      "halted": false,
+      "thread_id": 895059
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 5,
+      "qom_path": "/machine/peripheral/vcpu5",
+      "pc": 4294967280,
+      "halted": false,
+      "thread_id": 895060
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 6,
+      "qom_path": "/machine/peripheral/vcpu6",
+      "pc": 4294967280,
+      "halted": false,
+      "thread_id": 895061
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 7,
+      "qom_path": "/machine/peripheral/vcpu7",
+      "pc": 4294967280,
+      "halted": false,
+      "thread_id": 895062
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 8,
+      "qom_path": "/machine/peripheral/vcpu8",
+      "pc": 4294967280,
+      "halted": false,
+      "thread_id": 895063
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 9,
+      "qom_path": "/machine/peripheral/vcpu9",
+      "pc": 4294967280,
+      "halted": false,
+      "thread_id": 895064
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 10,
+      "qom_path": "/machine/peripheral/vcpu10",
+      "pc": 4294967280,
+      "halted": false,
+      "thread_id": 895065
+    }
+  ],
+  "id": "libvirt-52"
+}
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-hotplug.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-hotplug.json
new file mode 100644
index 0000000..aff5aa3
--- /dev/null
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-hotplug.json
@@ -0,0 +1,115 @@
+{
+  "return": [
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 10
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/peripheral/vcpu10",
+      "type": "Broadwell-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 9
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/peripheral/vcpu9",
+      "type": "Broadwell-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 8
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/peripheral/vcpu8",
+      "type": "Broadwell-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 7
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/peripheral/vcpu7",
+      "type": "Broadwell-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 6
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/peripheral/vcpu6",
+      "type": "Broadwell-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 5
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/peripheral/vcpu5",
+      "type": "Broadwell-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 4
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/peripheral/vcpu4",
+      "type": "Broadwell-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 3
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/peripheral/vcpu3",
+      "type": "Broadwell-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 2
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/peripheral/vcpu2",
+      "type": "Broadwell-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 1
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/peripheral/vcpu1",
+      "type": "Broadwell-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 0
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/unattached/device[0]",
+      "type": "Broadwell-x86_64-cpu"
+    }
+  ],
+  "id": "libvirt-51"
+}
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data
new file mode 100644
index 0000000..a6c1069
--- /dev/null
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data
@@ -0,0 +1,76 @@
+[vcpu libvirt-id='0']
+    thread-id='895040'
+    qemu-id='1'
+    type='Broadwell-x86_64-cpu'
+    qom_path='/machine/unattached/device[0]'
+    topology: socket='0' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='1']
+    thread-id='895056'
+    qemu-id='2'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu1'
+    qom_path='/machine/peripheral/vcpu1'
+    topology: socket='1' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='2']
+    thread-id='895057'
+    qemu-id='3'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu2'
+    qom_path='/machine/peripheral/vcpu2'
+    topology: socket='2' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='3']
+    thread-id='895058'
+    qemu-id='4'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu3'
+    qom_path='/machine/peripheral/vcpu3'
+    topology: socket='3' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='4']
+    thread-id='895059'
+    qemu-id='5'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu4'
+    qom_path='/machine/peripheral/vcpu4'
+    topology: socket='4' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='5']
+    thread-id='895060'
+    qemu-id='6'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu5'
+    qom_path='/machine/peripheral/vcpu5'
+    topology: socket='5' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='6']
+    thread-id='895061'
+    qemu-id='7'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu6'
+    qom_path='/machine/peripheral/vcpu6'
+    topology: socket='6' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='7']
+    thread-id='895062'
+    qemu-id='8'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu7'
+    qom_path='/machine/peripheral/vcpu7'
+    topology: socket='7' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='8']
+    thread-id='895063'
+    qemu-id='9'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu8'
+    qom_path='/machine/peripheral/vcpu8'
+    topology: socket='8' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='9']
+    thread-id='895064'
+    qemu-id='10'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu9'
+    qom_path='/machine/peripheral/vcpu9'
+    topology: socket='9' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='10']
+    thread-id='895065'
+    qemu-id='11'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu10'
+    qom_path='/machine/peripheral/vcpu10'
+    topology: socket='10' core='0' thread='0' vcpus='1'
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 22b4ccc..3d96397 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2585,6 +2585,7 @@ mymain(void)
     DO_TEST_CPU_DATA("ecx");
 
     DO_TEST_CPU_INFO("x86-basic-pluggable", 8);
+    DO_TEST_CPU_INFO("x86-full", 11);
 
     qemuTestDriverFree(&driver);
 
-- 
2.10.0