tests: validate parsing of CPUs with dies > 1

Add sample data files for validating handling of a QEMU guest started
with:

  -smp 7,maxcpus=16,sockets=2,dies=2,cores=2,threads=2

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2020-03-16 12:55:52 +00:00
parent 8b789c6574
commit c34b8cbf1c
4 changed files with 377 additions and 0 deletions

View File

@ -0,0 +1,95 @@
{
"return": [
{
"arch": "x86",
"thread-id": 1538346,
"props": {
"core-id": 0,
"thread-id": 0,
"die-id": 0,
"socket-id": 0
},
"qom-path": "/machine/unattached/device[0]",
"cpu-index": 0,
"target": "x86_64"
},
{
"arch": "x86",
"thread-id": 1538347,
"props": {
"core-id": 0,
"thread-id": 1,
"die-id": 0,
"socket-id": 0
},
"qom-path": "/machine/unattached/device[2]",
"cpu-index": 1,
"target": "x86_64"
},
{
"arch": "x86",
"thread-id": 1538348,
"props": {
"core-id": 1,
"thread-id": 0,
"die-id": 0,
"socket-id": 0
},
"qom-path": "/machine/unattached/device[3]",
"cpu-index": 2,
"target": "x86_64"
},
{
"arch": "x86",
"thread-id": 1538349,
"props": {
"core-id": 1,
"thread-id": 1,
"die-id": 0,
"socket-id": 0
},
"qom-path": "/machine/unattached/device[4]",
"cpu-index": 3,
"target": "x86_64"
},
{
"arch": "x86",
"thread-id": 1538350,
"props": {
"core-id": 0,
"thread-id": 0,
"die-id": 1,
"socket-id": 0
},
"qom-path": "/machine/unattached/device[5]",
"cpu-index": 4,
"target": "x86_64"
},
{
"arch": "x86",
"thread-id": 1538351,
"props": {
"core-id": 0,
"thread-id": 1,
"die-id": 1,
"socket-id": 0
},
"qom-path": "/machine/unattached/device[6]",
"cpu-index": 5,
"target": "x86_64"
},
{
"arch": "x86",
"thread-id": 1538352,
"props": {
"core-id": 1,
"thread-id": 0,
"die-id": 1,
"socket-id": 0
},
"qom-path": "/machine/unattached/device[7]",
"cpu-index": 6,
"target": "x86_64"
}
]
}

View File

@ -0,0 +1,171 @@
{
"return": [
{
"props": {
"core-id": 1,
"thread-id": 1,
"die-id": 1,
"socket-id": 1
},
"vcpus-count": 1,
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 1,
"thread-id": 0,
"die-id": 1,
"socket-id": 1
},
"vcpus-count": 1,
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 0,
"thread-id": 1,
"die-id": 1,
"socket-id": 1
},
"vcpus-count": 1,
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 0,
"thread-id": 0,
"die-id": 1,
"socket-id": 1
},
"vcpus-count": 1,
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 1,
"thread-id": 1,
"die-id": 0,
"socket-id": 1
},
"vcpus-count": 1,
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 1,
"thread-id": 0,
"die-id": 0,
"socket-id": 1
},
"vcpus-count": 1,
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 0,
"thread-id": 1,
"die-id": 0,
"socket-id": 1
},
"vcpus-count": 1,
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 0,
"thread-id": 0,
"die-id": 0,
"socket-id": 1
},
"vcpus-count": 1,
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 1,
"thread-id": 1,
"die-id": 1,
"socket-id": 0
},
"vcpus-count": 1,
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 1,
"thread-id": 0,
"die-id": 1,
"socket-id": 0
},
"vcpus-count": 1,
"qom-path": "/machine/unattached/device[7]",
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 0,
"thread-id": 1,
"die-id": 1,
"socket-id": 0
},
"vcpus-count": 1,
"qom-path": "/machine/unattached/device[6]",
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 0,
"thread-id": 0,
"die-id": 1,
"socket-id": 0
},
"vcpus-count": 1,
"qom-path": "/machine/unattached/device[5]",
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 1,
"thread-id": 1,
"die-id": 0,
"socket-id": 0
},
"vcpus-count": 1,
"qom-path": "/machine/unattached/device[4]",
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 1,
"thread-id": 0,
"die-id": 0,
"socket-id": 0
},
"vcpus-count": 1,
"qom-path": "/machine/unattached/device[3]",
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 0,
"thread-id": 1,
"die-id": 0,
"socket-id": 0
},
"vcpus-count": 1,
"qom-path": "/machine/unattached/device[2]",
"type": "host-x86_64-cpu"
},
{
"props": {
"core-id": 0,
"thread-id": 0,
"die-id": 0,
"socket-id": 0
},
"vcpus-count": 1,
"qom-path": "/machine/unattached/device[0]",
"type": "host-x86_64-cpu"
}
]
}

View File

@ -0,0 +1,108 @@
[vcpu libvirt-id='0']
online=yes
hotpluggable=no
thread-id='1538346'
enable-id='1'
query-cpus-id='0'
type='host-x86_64-cpu'
qom_path='/machine/unattached/device[0]'
topology: socket='0' die='0' core='0' thread='0' vcpus='1'
[vcpu libvirt-id='1']
online=yes
hotpluggable=no
thread-id='1538347'
enable-id='2'
query-cpus-id='1'
type='host-x86_64-cpu'
qom_path='/machine/unattached/device[2]'
topology: socket='0' die='0' core='0' thread='1' vcpus='1'
[vcpu libvirt-id='2']
online=yes
hotpluggable=no
thread-id='1538348'
enable-id='3'
query-cpus-id='2'
type='host-x86_64-cpu'
qom_path='/machine/unattached/device[3]'
topology: socket='0' die='0' core='1' thread='0' vcpus='1'
[vcpu libvirt-id='3']
online=yes
hotpluggable=no
thread-id='1538349'
enable-id='4'
query-cpus-id='3'
type='host-x86_64-cpu'
qom_path='/machine/unattached/device[4]'
topology: socket='0' die='0' core='1' thread='1' vcpus='1'
[vcpu libvirt-id='4']
online=yes
hotpluggable=no
thread-id='1538350'
enable-id='5'
query-cpus-id='4'
type='host-x86_64-cpu'
qom_path='/machine/unattached/device[5]'
topology: socket='0' die='1' core='0' thread='0' vcpus='1'
[vcpu libvirt-id='5']
online=yes
hotpluggable=no
thread-id='1538351'
enable-id='6'
query-cpus-id='5'
type='host-x86_64-cpu'
qom_path='/machine/unattached/device[6]'
topology: socket='0' die='1' core='0' thread='1' vcpus='1'
[vcpu libvirt-id='6']
online=yes
hotpluggable=no
thread-id='1538352'
enable-id='7'
query-cpus-id='6'
type='host-x86_64-cpu'
qom_path='/machine/unattached/device[7]'
topology: socket='0' die='1' core='1' thread='0' vcpus='1'
[vcpu libvirt-id='7']
online=no
hotpluggable=yes
type='host-x86_64-cpu'
topology: socket='0' die='1' core='1' thread='1' vcpus='1'
[vcpu libvirt-id='8']
online=no
hotpluggable=yes
type='host-x86_64-cpu'
topology: socket='1' die='0' core='0' thread='0' vcpus='1'
[vcpu libvirt-id='9']
online=no
hotpluggable=yes
type='host-x86_64-cpu'
topology: socket='1' die='0' core='0' thread='1' vcpus='1'
[vcpu libvirt-id='10']
online=no
hotpluggable=yes
type='host-x86_64-cpu'
topology: socket='1' die='0' core='1' thread='0' vcpus='1'
[vcpu libvirt-id='11']
online=no
hotpluggable=yes
type='host-x86_64-cpu'
topology: socket='1' die='0' core='1' thread='1' vcpus='1'
[vcpu libvirt-id='12']
online=no
hotpluggable=yes
type='host-x86_64-cpu'
topology: socket='1' die='1' core='0' thread='0' vcpus='1'
[vcpu libvirt-id='13']
online=no
hotpluggable=yes
type='host-x86_64-cpu'
topology: socket='1' die='1' core='0' thread='1' vcpus='1'
[vcpu libvirt-id='14']
online=no
hotpluggable=yes
type='host-x86_64-cpu'
topology: socket='1' die='1' core='1' thread='0' vcpus='1'
[vcpu libvirt-id='15']
online=no
hotpluggable=yes
type='host-x86_64-cpu'
topology: socket='1' die='1' core='1' thread='1' vcpus='1'

View File

@ -2615,6 +2615,8 @@ testQemuMonitorCPUInfoFormat(qemuMonitorCPUInfoPtr vcpus,
virBufferAddLit(&buf, "topology:");
if (vcpu->socket_id != -1)
virBufferAsprintf(&buf, " socket='%d'", vcpu->socket_id);
if (vcpu->die_id != -1)
virBufferAsprintf(&buf, " die='%d'", vcpu->die_id);
if (vcpu->core_id != -1)
virBufferAsprintf(&buf, " core='%d'", vcpu->core_id);
if (vcpu->thread_id != -1)
@ -3235,6 +3237,7 @@ mymain(void)
DO_TEST_CPU_INFO("x86-full", 11);
DO_TEST_CPU_INFO("x86-node-full", 8);
DO_TEST_CPU_INFO_FAST("x86-full-fast", 11);
DO_TEST_CPU_INFO_FAST("x86-dies", 16);
DO_TEST_CPU_INFO("ppc64-basic", 24);
DO_TEST_CPU_INFO("ppc64-hotplug-1", 24);