From nobody Wed May 14 18:57:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1519983175774146.51142877096243; Fri, 2 Mar 2018 01:32:55 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 33B3CC0587E5; Fri, 2 Mar 2018 09:32:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0BA415F722; Fri, 2 Mar 2018 09:32:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CA0354A471; Fri, 2 Mar 2018 09:32:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w229TQ4L017654 for ; Fri, 2 Mar 2018 04:29:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6DD9F189B7; Fri, 2 Mar 2018 09:29:26 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 67D5460175 for ; Fri, 2 Mar 2018 09:29:24 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2DB1E7FDC9 for ; Fri, 2 Mar 2018 09:29:23 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w229QXJI067714 for ; Fri, 2 Mar 2018 04:29:22 -0500 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gf1rad75s-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 02 Mar 2018 04:29:19 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 2 Mar 2018 09:29:17 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 2 Mar 2018 09:29:15 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w229TFXJ58589238 for ; Fri, 2 Mar 2018 09:29:15 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0FEFA42041 for ; Fri, 2 Mar 2018 09:21:43 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D672E42042 for ; Fri, 2 Mar 2018 09:21:42 +0000 (GMT) Received: from bradbury.ibm.com (unknown [9.152.222.40]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Fri, 2 Mar 2018 09:21:42 +0000 (GMT) From: Viktor Mihajlovski To: libvir-list@redhat.com Date: Fri, 2 Mar 2018 10:29:08 +0100 In-Reply-To: <1519982951-15767-1-git-send-email-mihajlov@linux.vnet.ibm.com> References: <1519982951-15767-1-git-send-email-mihajlov@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030209-0020-0000-0000-000003FDB941 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030209-0021-0000-0000-00004291EAB5 Message-Id: <1519982951-15767-4-git-send-email-mihajlov@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-02_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803020109 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 02 Mar 2018 09:29:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 02 Mar 2018 09:29:23 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mihajlov@de.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.702 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/6] tests: add qemumonitorjson tests for query-cpus-fast X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 02 Mar 2018 09:32:54 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Extended the json monitor test program with support for query-cpus-fast and added a sample file set for x86 data obtained using the it. Signed-off-by: Viktor Mihajlovski Reviewed-by: Boris Fiuczynski --- ...qemumonitorjson-cpuinfo-x86-full-fast-cpus.json | 71 +++++++++++++ ...umonitorjson-cpuinfo-x86-full-fast-hotplug.json | 115 +++++++++++++++++= +++ .../qemumonitorjson-cpuinfo-x86-full-fast.data | 109 +++++++++++++++++= ++ tests/qemumonitorjsontest.c | 116 ++++++++++++++++-= ---- tests/qemumonitortestutils.c | 6 ++ tests/qemumonitortestutils.h | 1 + 6 files changed, 393 insertions(+), 25 deletions(-) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-f= ull-fast-cpus.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-f= ull-fast-hotplug.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-f= ull-fast.data diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fas= t-cpus.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fa= st-cpus.json new file mode 100644 index 0000000..88fd2b8 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast-cpus.= json @@ -0,0 +1,71 @@ +{ + "return": [ + { + "arch": "x86", + "cpu-index": 0, + "qom-path": "/machine/unattached/device[0]", + "thread-id": 895040 + }, + { + "arch": "x86", + "cpu-index": 1, + "qom-path": "/machine/peripheral/vcpu1", + "thread-id": 895056 + }, + { + "arch": "x86", + "cpu-index": 2, + "qom-path": "/machine/peripheral/vcpu2", + "thread-id": 895057 + }, + { + "arch": "x86", + "cpu-index": 3, + "qom-path": "/machine/peripheral/vcpu3", + "thread-id": 895058 + }, + { + "arch": "x86", + "cpu-index": 4, + "qom-path": "/machine/peripheral/vcpu4", + "thread-id": 895059 + }, + { + "arch": "x86", + "cpu-index": 5, + "qom-path": "/machine/peripheral/vcpu5", + "thread-id": 895060 + }, + { + "arch": "x86", + "cpu-index": 6, + "qom-path": "/machine/peripheral/vcpu6", + "thread-id": 895061 + }, + { + "arch": "x86", + "cpu-index": 7, + "qom-path": "/machine/peripheral/vcpu7", + "thread-id": 895062 + }, + { + "arch": "x86", + "cpu-index": 8, + "qom-path": "/machine/peripheral/vcpu8", + "thread-id": 895063 + }, + { + "arch": "x86", + "cpu-index": 9, + "qom-path": "/machine/peripheral/vcpu9", + "thread-id": 895064 + }, + { + "arch": "x86", + "cpu-index": 10, + "qom-path": "/machine/peripheral/vcpu10", + "thread-id": 895065 + } + ], + "id": "libvirt-52" +} diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fas= t-hotplug.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full= -fast-hotplug.json new file mode 100644 index 0000000..aff5aa3 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast-hotpl= ug.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-fas= t.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast.da= ta new file mode 100644 index 0000000..1908e39 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast.data @@ -0,0 +1,109 @@ +[vcpu libvirt-id=3D'0'] + online=3Dyes + hotpluggable=3Dno + thread-id=3D'895040' + enable-id=3D'1' + query-cpus-id=3D'0' + type=3D'Broadwell-x86_64-cpu' + qom_path=3D'/machine/unattached/device[0]' + topology: socket=3D'0' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'1'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895056' + enable-id=3D'2' + query-cpus-id=3D'1' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu1' + qom_path=3D'/machine/peripheral/vcpu1' + topology: socket=3D'1' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'2'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895057' + enable-id=3D'3' + query-cpus-id=3D'2' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu2' + qom_path=3D'/machine/peripheral/vcpu2' + topology: socket=3D'2' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'3'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895058' + enable-id=3D'4' + query-cpus-id=3D'3' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu3' + qom_path=3D'/machine/peripheral/vcpu3' + topology: socket=3D'3' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'4'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895059' + enable-id=3D'5' + query-cpus-id=3D'4' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu4' + qom_path=3D'/machine/peripheral/vcpu4' + topology: socket=3D'4' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'5'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895060' + enable-id=3D'6' + query-cpus-id=3D'5' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu5' + qom_path=3D'/machine/peripheral/vcpu5' + topology: socket=3D'5' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'6'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895061' + enable-id=3D'7' + query-cpus-id=3D'6' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu6' + qom_path=3D'/machine/peripheral/vcpu6' + topology: socket=3D'6' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'7'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895062' + enable-id=3D'8' + query-cpus-id=3D'7' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu7' + qom_path=3D'/machine/peripheral/vcpu7' + topology: socket=3D'7' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'8'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895063' + enable-id=3D'9' + query-cpus-id=3D'8' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu8' + qom_path=3D'/machine/peripheral/vcpu8' + topology: socket=3D'8' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'9'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895064' + enable-id=3D'10' + query-cpus-id=3D'9' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu9' + qom_path=3D'/machine/peripheral/vcpu9' + topology: socket=3D'9' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'10'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895065' + enable-id=3D'11' + query-cpus-id=3D'10' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu10' + qom_path=3D'/machine/peripheral/vcpu10' + topology: socket=3D'10' core=3D'0' thread=3D'0' vcpus=3D'1' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 6824623..f23614e 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1360,6 +1360,41 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUsEqual(str= uct qemuMonitorQueryCpusEntr return true; } =20 +static int +testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(qemuMonitorTestPtr test, + struct qemuMonitorQueryC= pusEntry *expect, + bool fast, size_t num) +{ + struct qemuMonitorQueryCpusEntry *cpudata =3D NULL; + size_t ncpudata =3D 0; + size_t i; + int ret =3D -1; + + if (qemuMonitorJSONQueryCPUs(qemuMonitorTestGetMonitor(test), + &cpudata, &ncpudata, true, fast) < 0) + goto cleanup; + + if (ncpudata !=3D num) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "Expecting ncpupids =3D %zu but got %zu", num, ncpu= data); + goto cleanup; + } + + for (i =3D 0; i < ncpudata; i++) { + if (!testQemuMonitorJSONqemuMonitorJSONQueryCPUsEqual(cpudata + i, + expect + i))= { + virReportError(VIR_ERR_INTERNAL_ERROR, + "vcpu entry %zu does not match expected data", = i); + goto cleanup; + } + } + + ret =3D 0; + + cleanup: + qemuMonitorQueryCpusFree(cpudata, ncpudata); + return ret; +} =20 static int testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const void *data) @@ -1367,15 +1402,16 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const v= oid *data) virDomainXMLOptionPtr xmlopt =3D (virDomainXMLOptionPtr)data; qemuMonitorTestPtr test =3D qemuMonitorTestNewSimple(true, xmlopt); int ret =3D -1; - struct qemuMonitorQueryCpusEntry *cpudata =3D NULL; - struct qemuMonitorQueryCpusEntry expect[] =3D { - {0, 17622, (char *) "/machine/unattached/device[0]", true}, - {1, 17624, (char *) "/machine/unattached/device[1]", true}, - {2, 17626, (char *) "/machine/unattached/device[2]", true}, - {3, 17628, NULL, true}, + struct qemuMonitorQueryCpusEntry expect_slow[] =3D { + {0, 17622, (char *) "/machine/unattached/device[0]", true}, + {1, 17624, (char *) "/machine/unattached/device[1]", true}, + {2, 17626, (char *) "/machine/unattached/device[2]", true}, + {3, 17628, NULL, true}, + }; + struct qemuMonitorQueryCpusEntry expect_fast[] =3D { + {0, 17629, (char *) "/machine/unattached/device[0]", false}, + {1, 17630, (char *) "/machine/unattached/device[1]", false}, }; - size_t ncpudata =3D 0; - size_t i; =20 if (!test) return -1; @@ -1419,29 +1455,37 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const v= oid *data) "}") < 0) goto cleanup; =20 - if (qemuMonitorJSONQueryCPUs(qemuMonitorTestGetMonitor(test), - &cpudata, &ncpudata, true, false) < 0) + if (qemuMonitorTestAddItem(test, "query-cpus-fast", + "{" + " \"return\": [" + " {" + " \"cpu-index\": 0," + " \"qom-path\": \"/machine/unatt= ached/device[0]\"," + " \"thread-id\": 17629" + " }," + " {" + " \"cpu-index\": 1," + " \"qom-path\": \"/machine/unatt= ached/device[1]\"," + " \"thread-id\": 17630" + " }" + " ]," + " \"id\": \"libvirt-8\"" + "}") < 0) goto cleanup; =20 - if (ncpudata !=3D 4) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "Expecting ncpupids =3D 4 but got %zu", ncpudata); + /* query-cpus */ + if (testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(test, expect_slo= w, + false, 4)) goto cleanup; - } =20 - for (i =3D 0; i < ncpudata; i++) { - if (!testQemuMonitorJSONqemuMonitorJSONQueryCPUsEqual(cpudata + i, - expect + i))= { - virReportError(VIR_ERR_INTERNAL_ERROR, - "vcpu entry %zu does not match expected data", = i); - goto cleanup; - } - } + /* query-cpus-fast */ + if (testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(test, expect_fas= t, + true, 2)) + goto cleanup; =20 ret =3D 0; =20 cleanup: - qemuMonitorQueryCpusFree(cpudata, ncpudata); qemuMonitorTestFree(test); return ret; } @@ -2612,6 +2656,7 @@ struct testCPUInfoData { const char *name; size_t maxvcpus; virDomainXMLOptionPtr xmlopt; + bool fast; }; =20 =20 @@ -2678,6 +2723,7 @@ testQemuMonitorCPUInfo(const void *opaque) { const struct testCPUInfoData *data =3D opaque; qemuMonitorTestPtr test =3D qemuMonitorTestNewSimple(true, data->xmlop= t); + virDomainObjPtr vm =3D NULL; char *queryCpusFile =3D NULL; char *queryHotpluggableFile =3D NULL; char *dataFile =3D NULL; @@ -2712,9 +2758,20 @@ testQemuMonitorCPUInfo(const void *opaque) queryHotpluggableStr) < 0) goto cleanup; =20 - if (qemuMonitorTestAddItem(test, "query-cpus", queryCpusStr) < 0) + if (qemuMonitorTestAddItem(test, data->fast ? "query-cpus-fast" : "que= ry-cpus", + queryCpusStr) < 0) goto cleanup; =20 + vm =3D qemuMonitorTestGetDomainObj(test); + if (!vm) + return -1; + + if (data->fast) { + QEMU_DOMAIN_PRIVATE(vm)->qemuCaps =3D virQEMUCapsNew(); + virQEMUCapsSet(QEMU_DOMAIN_PRIVATE(vm)->qemuCaps, + QEMU_CAPS_QUERY_CPUS_FAST); + } + rc =3D qemuMonitorGetCPUInfo(qemuMonitorTestGetMonitor(test), &vcpus, data->maxvcpus, true); =20 @@ -2872,7 +2929,15 @@ mymain(void) =20 #define DO_TEST_CPU_INFO(name, maxvcpus) \ do { \ - struct testCPUInfoData data =3D {name, maxvcpus, driver.xmlopt}; \ + struct testCPUInfoData data =3D {name, maxvcpus, driver.xmlopt, fa= lse}; \ + if (virTestRun("GetCPUInfo(" name ")", testQemuMonitorCPUInfo, \ + &data) < 0) \ + ret =3D -1; \ + } while (0) + +#define DO_TEST_CPU_INFO_FAST(name, maxvcpus) \ + do { \ + struct testCPUInfoData data =3D {name, maxvcpus, driver.xmlopt, tr= ue}; \ if (virTestRun("GetCPUInfo(" name ")", testQemuMonitorCPUInfo, \ &data) < 0) \ ret =3D -1; \ @@ -2956,6 +3021,7 @@ mymain(void) DO_TEST_CPU_INFO("x86-basic-pluggable", 8); DO_TEST_CPU_INFO("x86-full", 11); DO_TEST_CPU_INFO("x86-node-full", 8); + DO_TEST_CPU_INFO_FAST("x86-full-fast", 11); =20 DO_TEST_CPU_INFO("ppc64-basic", 24); DO_TEST_CPU_INFO("ppc64-hotplug-1", 24); diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 5e30fb0..b20d59a 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -1439,3 +1439,9 @@ qemuMonitorTestGetAgent(qemuMonitorTestPtr test) { return test->agent; } + +virDomainObjPtr +qemuMonitorTestGetDomainObj(qemuMonitorTestPtr test) +{ + return test->vm; +} diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h index 8b19b37..3604a1b 100644 --- a/tests/qemumonitortestutils.h +++ b/tests/qemumonitortestutils.h @@ -96,5 +96,6 @@ void qemuMonitorTestFree(qemuMonitorTestPtr test); =20 qemuMonitorPtr qemuMonitorTestGetMonitor(qemuMonitorTestPtr test); qemuAgentPtr qemuMonitorTestGetAgent(qemuMonitorTestPtr test); +virDomainObjPtr qemuMonitorTestGetDomainObj(qemuMonitorTestPtr test); =20 #endif /* __VIR_QEMU_MONITOR_TEST_UTILS_H__ */ --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list