[libvirt] [PATCH 4/5] test: qemuhotplugtest: Add testing of individual vcpu hotplug

Peter Krempa pkrempa at redhat.com
Fri Feb 10 17:10:21 UTC 2017


Test that the vcpu entity selection code works properly
---
 tests/qemuhotplugtest.c                            |  63 ++++
 .../ppc64-modern-individual-domain.xml             |  20 ++
 .../ppc64-modern-individual-monitor.json           | 318 +++++++++++++++++++++
 .../ppc64-modern-individual-result-conf.xml        |  64 +++++
 .../ppc64-modern-individual-result-live.xml        |  72 +++++
 .../x86-modern-individual-add-domain.xml           |  21 ++
 .../x86-modern-individual-add-monitor.json         | 299 +++++++++++++++++++
 .../x86-modern-individual-add-result-conf.xml      |  40 +++
 .../x86-modern-individual-add-result-live.xml      |  48 ++++
 9 files changed, 945 insertions(+)
 create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-domain.xml
 create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-monitor.json
 create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml
 create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml
 create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-add-domain.xml
 create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json
 create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml
 create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml

diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 8a58d5468..cdeb3f1bf 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -493,6 +493,8 @@ testQemuHotplugCpuFinalize(struct testQemuHotplugCpuData *data)
 struct testQemuHotplugCpuParams {
     const char *test;
     int newcpus;
+    const char *cpumap;
+    bool state;
     bool modern;
     bool fail;
 };
@@ -534,6 +536,46 @@ testQemuHotplugCpuGroup(const void *opaque)


 static int
+testQemuHotplugCpuIndividual(const void *opaque)
+{
+    const struct testQemuHotplugCpuParams *params = opaque;
+    struct testQemuHotplugCpuData *data = NULL;
+    virBitmapPtr map = NULL;
+    int ret = -1;
+    int rc;
+
+    if (!(data = testQemuHotplugCpuPrepare(params->test, params->modern)))
+        return -1;
+
+    if (virBitmapParse(params->cpumap, &map, 128) < 0)
+        goto cleanup;
+
+    rc = qemuDomainSetVcpuInternal(&driver, data->vm, data->vm->def,
+                                   data->vm->newDef, map, params->state);
+
+    if (params->fail) {
+        if (rc == 0)
+            fprintf(stderr, "cpu test '%s' should have failed\n", params->test);
+        else
+            ret = 0;
+
+        goto cleanup;
+    } else {
+        if (rc < 0)
+            goto cleanup;
+    }
+
+    ret = testQemuHotplugCpuFinalize(data);
+
+ cleanup:
+    virBitmapFree(map);
+    testQemuHotplugCpuDataFree(data);
+    return ret;
+}
+
+
+
+static int
 mymain(void)
 {
     int ret = 0;
@@ -789,6 +831,27 @@ mymain(void)
     DO_TEST_CPU_GROUP("ppc64-modern-bulk", 23, true, true);
     DO_TEST_CPU_GROUP("ppc64-modern-bulk", 25, true, true);

+#define DO_TEST_CPU_INDIVIDUAL(prefix, mapstr, statefl, modernhp, expectfail)  \
+    do {                                                                       \
+        cpudata.test = prefix;                                                 \
+        cpudata.cpumap = mapstr;                                               \
+        cpudata.state = statefl;                                               \
+        cpudata.modern = modernhp;                                             \
+        cpudata.fail = expectfail;                                             \
+        if (virTestRun("hotplug vcpus group " prefix,                          \
+                       testQemuHotplugCpuIndividual, &cpudata) < 0)            \
+            ret = -1;                                                          \
+    } while (0)
+
+    DO_TEST_CPU_INDIVIDUAL("x86-modern-individual-add", "7", true, true, false);
+    DO_TEST_CPU_INDIVIDUAL("x86-modern-individual-add", "6,7", true, true, true);
+    DO_TEST_CPU_INDIVIDUAL("x86-modern-individual-add", "7", false, true, true);
+    DO_TEST_CPU_INDIVIDUAL("x86-modern-individual-add", "7", true, false, true);
+
+    DO_TEST_CPU_INDIVIDUAL("ppc64-modern-individual", "16-23", true, true, false);
+    DO_TEST_CPU_INDIVIDUAL("ppc64-modern-individual", "16-22", true, true, true);
+    DO_TEST_CPU_INDIVIDUAL("ppc64-modern-individual", "17", true, true, true);
+
     qemuTestDriverFree(&driver);
     return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-domain.xml b/tests/qemuhotplugtestcpus/ppc64-modern-individual-domain.xml
new file mode 100644
index 000000000..eb04e42b6
--- /dev/null
+++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-domain.xml
@@ -0,0 +1,20 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' current='8'>32</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu>
+    <topology sockets="1" cores="4" threads="8"/>
+  </cpu>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+      <emulator>/usr/bin/qemu</emulator>
+  </devices>
+</domain>
diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-monitor.json b/tests/qemuhotplugtestcpus/ppc64-modern-individual-monitor.json
new file mode 100644
index 000000000..ad5cc984a
--- /dev/null
+++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-monitor.json
@@ -0,0 +1,318 @@
+{"execute":"query-hotpluggable-cpus","id":"libvirt-1"}
+
+{
+  "return": [
+    {
+      "props": {
+        "core-id": 24
+      },
+      "vcpus-count": 8,
+      "type": "host-spapr-cpu-core"
+    },
+    {
+      "props": {
+        "core-id": 16
+      },
+      "vcpus-count": 8,
+      "type": "host-spapr-cpu-core"
+    },
+    {
+      "props": {
+        "core-id": 8
+      },
+      "vcpus-count": 8,
+      "type": "host-spapr-cpu-core"
+    },
+    {
+      "props": {
+        "core-id": 0
+      },
+      "vcpus-count": 8,
+      "qom-path": "/machine/unattached/device[1]",
+      "type": "host-spapr-cpu-core"
+    }
+  ],
+  "id": "libvirt-15"
+}
+
+{"execute":"query-cpus","id":"libvirt-2"}
+
+{
+  "return": [
+    {
+      "arch": "ppc",
+      "current": true,
+      "CPU": 0,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[0]",
+      "halted": false,
+      "thread_id": 21925
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 1,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[1]",
+      "halted": false,
+      "thread_id": 21926
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 2,
+      "nip": -4611686018422360608,
+      "qom_path": "/machine/unattached/device[1]/thread[2]",
+      "halted": false,
+      "thread_id": 21927
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 3,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[3]",
+      "halted": false,
+      "thread_id": 21928
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 4,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[4]",
+      "halted": false,
+      "thread_id": 21930
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 5,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[5]",
+      "halted": false,
+      "thread_id": 21931
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 6,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[6]",
+      "halted": false,
+      "thread_id": 21932
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 7,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[7]",
+      "halted": false,
+      "thread_id": 21933
+    }
+  ],
+  "id": "libvirt-12"
+}
+
+{
+    "execute": "device_add",
+    "arguments": {
+        "driver": "host-spapr-cpu-core",
+        "id": "vcpu16",
+        "core-id": 16
+    },
+    "id": "libvirt-3"
+}
+
+{"return": {}}
+
+{"execute":"query-hotpluggable-cpus","id":"libvirt-4"}
+
+{
+  "return": [
+    {
+      "props": {
+        "core-id": 24
+      },
+      "vcpus-count": 8,
+      "type": "host-spapr-cpu-core"
+    },
+    {
+      "props": {
+        "core-id": 16
+      },
+      "vcpus-count": 8,
+      "qom-path": "/machine/peripheral/vcpu16",
+      "type": "host-spapr-cpu-core"
+    },
+    {
+      "props": {
+        "core-id": 8
+      },
+      "vcpus-count": 8,
+      "type": "host-spapr-cpu-core"
+    },
+    {
+      "props": {
+        "core-id": 0
+      },
+      "vcpus-count": 8,
+      "qom-path": "/machine/unattached/device[1]",
+      "type": "host-spapr-cpu-core"
+    }
+  ],
+  "id": "libvirt-15"
+}
+
+{"execute":"query-cpus","id":"libvirt-5"}
+
+{
+  "return": [
+    {
+      "arch": "ppc",
+      "current": true,
+      "CPU": 0,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[0]",
+      "halted": false,
+      "thread_id": 21925
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 1,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[1]",
+      "halted": false,
+      "thread_id": 21926
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 2,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[2]",
+      "halted": false,
+      "thread_id": 21927
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 3,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[3]",
+      "halted": false,
+      "thread_id": 21928
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 4,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[4]",
+      "halted": false,
+      "thread_id": 21930
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 5,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[5]",
+      "halted": false,
+      "thread_id": 21931
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 6,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[6]",
+      "halted": false,
+      "thread_id": 21932
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 7,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/unattached/device[1]/thread[7]",
+      "halted": false,
+      "thread_id": 21933
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 8,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/peripheral/vcpu16/thread[0]",
+      "halted": false,
+      "thread_id": 22131
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 9,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/peripheral/vcpu16/thread[1]",
+      "halted": false,
+      "thread_id": 22132
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 10,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/peripheral/vcpu16/thread[2]",
+      "halted": false,
+      "thread_id": 22133
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 11,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/peripheral/vcpu16/thread[3]",
+      "halted": false,
+      "thread_id": 22134
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 12,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/peripheral/vcpu16/thread[4]",
+      "halted": false,
+      "thread_id": 22135
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 13,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/peripheral/vcpu16/thread[5]",
+      "halted": false,
+      "thread_id": 22136
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 14,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/peripheral/vcpu16/thread[6]",
+      "halted": false,
+      "thread_id": 22137
+    },
+    {
+      "arch": "ppc",
+      "current": false,
+      "CPU": 15,
+      "nip": -4611686018426772172,
+      "qom_path": "/machine/peripheral/vcpu16/thread[7]",
+      "halted": false,
+      "thread_id": 22138
+    }
+  ],
+  "id": "libvirt-14"
+}
diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml
new file mode 100644
index 000000000..bda1bc579
--- /dev/null
+++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml
@@ -0,0 +1,64 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' current='16'>32</vcpu>
+  <vcpus>
+    <vcpu id='0' enabled='yes' hotpluggable='no'/>
+    <vcpu id='1' enabled='yes' hotpluggable='no'/>
+    <vcpu id='2' enabled='yes' hotpluggable='no'/>
+    <vcpu id='3' enabled='yes' hotpluggable='no'/>
+    <vcpu id='4' enabled='yes' hotpluggable='no'/>
+    <vcpu id='5' enabled='yes' hotpluggable='no'/>
+    <vcpu id='6' enabled='yes' hotpluggable='no'/>
+    <vcpu id='7' enabled='yes' hotpluggable='no'/>
+    <vcpu id='8' enabled='no' hotpluggable='yes'/>
+    <vcpu id='9' enabled='no' hotpluggable='yes'/>
+    <vcpu id='10' enabled='no' hotpluggable='yes'/>
+    <vcpu id='11' enabled='no' hotpluggable='yes'/>
+    <vcpu id='12' enabled='no' hotpluggable='yes'/>
+    <vcpu id='13' enabled='no' hotpluggable='yes'/>
+    <vcpu id='14' enabled='no' hotpluggable='yes'/>
+    <vcpu id='15' enabled='no' hotpluggable='yes'/>
+    <vcpu id='16' enabled='yes' hotpluggable='yes'/>
+    <vcpu id='17' enabled='yes' hotpluggable='yes'/>
+    <vcpu id='18' enabled='yes' hotpluggable='yes'/>
+    <vcpu id='19' enabled='yes' hotpluggable='yes'/>
+    <vcpu id='20' enabled='yes' hotpluggable='yes'/>
+    <vcpu id='21' enabled='yes' hotpluggable='yes'/>
+    <vcpu id='22' enabled='yes' hotpluggable='yes'/>
+    <vcpu id='23' enabled='yes' hotpluggable='yes'/>
+    <vcpu id='24' enabled='no' hotpluggable='yes'/>
+    <vcpu id='25' enabled='no' hotpluggable='yes'/>
+    <vcpu id='26' enabled='no' hotpluggable='yes'/>
+    <vcpu id='27' enabled='no' hotpluggable='yes'/>
+    <vcpu id='28' enabled='no' hotpluggable='yes'/>
+    <vcpu id='29' enabled='no' hotpluggable='yes'/>
+    <vcpu id='30' enabled='no' hotpluggable='yes'/>
+    <vcpu id='31' enabled='no' hotpluggable='yes'/>
+  </vcpus>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu>
+    <topology sockets='1' cores='4' threads='8'/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml
new file mode 100644
index 000000000..8621b62b7
--- /dev/null
+++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml
@@ -0,0 +1,72 @@
+<domain type='qemu' id='7'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' current='16'>32</vcpu>
+  <vcpus>
+    <vcpu id='0' enabled='yes' hotpluggable='no' order='1'/>
+    <vcpu id='1' enabled='yes' hotpluggable='no' order='1'/>
+    <vcpu id='2' enabled='yes' hotpluggable='no' order='1'/>
+    <vcpu id='3' enabled='yes' hotpluggable='no' order='1'/>
+    <vcpu id='4' enabled='yes' hotpluggable='no' order='1'/>
+    <vcpu id='5' enabled='yes' hotpluggable='no' order='1'/>
+    <vcpu id='6' enabled='yes' hotpluggable='no' order='1'/>
+    <vcpu id='7' enabled='yes' hotpluggable='no' order='1'/>
+    <vcpu id='8' enabled='no' hotpluggable='yes'/>
+    <vcpu id='9' enabled='no' hotpluggable='yes'/>
+    <vcpu id='10' enabled='no' hotpluggable='yes'/>
+    <vcpu id='11' enabled='no' hotpluggable='yes'/>
+    <vcpu id='12' enabled='no' hotpluggable='yes'/>
+    <vcpu id='13' enabled='no' hotpluggable='yes'/>
+    <vcpu id='14' enabled='no' hotpluggable='yes'/>
+    <vcpu id='15' enabled='no' hotpluggable='yes'/>
+    <vcpu id='16' enabled='yes' hotpluggable='yes' order='2'/>
+    <vcpu id='17' enabled='yes' hotpluggable='yes' order='2'/>
+    <vcpu id='18' enabled='yes' hotpluggable='yes' order='2'/>
+    <vcpu id='19' enabled='yes' hotpluggable='yes' order='2'/>
+    <vcpu id='20' enabled='yes' hotpluggable='yes' order='2'/>
+    <vcpu id='21' enabled='yes' hotpluggable='yes' order='2'/>
+    <vcpu id='22' enabled='yes' hotpluggable='yes' order='2'/>
+    <vcpu id='23' enabled='yes' hotpluggable='yes' order='2'/>
+    <vcpu id='24' enabled='no' hotpluggable='yes'/>
+    <vcpu id='25' enabled='no' hotpluggable='yes'/>
+    <vcpu id='26' enabled='no' hotpluggable='yes'/>
+    <vcpu id='27' enabled='no' hotpluggable='yes'/>
+    <vcpu id='28' enabled='no' hotpluggable='yes'/>
+    <vcpu id='29' enabled='no' hotpluggable='yes'/>
+    <vcpu id='30' enabled='no' hotpluggable='yes'/>
+    <vcpu id='31' enabled='no' hotpluggable='yes'/>
+  </vcpus>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu>
+    <topology sockets='1' cores='4' threads='8'/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'>
+      <alias name='usb'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'>
+      <alias name='pci'/>
+    </controller>
+    <input type='mouse' bus='ps2'>
+      <alias name='input0'/>
+    </input>
+    <input type='keyboard' bus='ps2'>
+      <alias name='input1'/>
+    </input>
+    <memballoon model='virtio'>
+      <alias name='balloon0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-domain.xml b/tests/qemuhotplugtestcpus/x86-modern-individual-add-domain.xml
new file mode 100644
index 000000000..1c2a5b131
--- /dev/null
+++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-domain.xml
@@ -0,0 +1,21 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' current='5'>8</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu>
+    <topology sockets="4" cores="2" threads="1"/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+      <emulator>/usr/bin/qemu</emulator>
+  </devices>
+</domain>
diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json b/tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json
new file mode 100644
index 000000000..294198b27
--- /dev/null
+++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json
@@ -0,0 +1,299 @@
+{"execute":"query-hotpluggable-cpus","id":"libvirt-1"}
+
+{
+  "return": [
+    {
+      "props": {
+        "core-id": 1,
+        "thread-id": 1,
+        "socket-id": 1
+      },
+      "vcpus-count": 1,
+      "type": "qemu64-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 1,
+        "thread-id": 0,
+        "socket-id": 1
+      },
+      "vcpus-count": 1,
+      "type": "qemu64-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 1,
+        "socket-id": 1
+      },
+      "vcpus-count": 1,
+      "type": "qemu64-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 1
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/unattached/device[5]",
+      "type": "qemu64-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 1,
+        "thread-id": 1,
+        "socket-id": 0
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/unattached/device[4]",
+      "type": "qemu64-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 1,
+        "thread-id": 0,
+        "socket-id": 0
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/unattached/device[3]",
+      "type": "qemu64-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 1,
+        "socket-id": 0
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/unattached/device[2]",
+      "type": "qemu64-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 0
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/unattached/device[0]",
+      "type": "qemu64-x86_64-cpu"
+    }
+  ],
+  "id": "libvirt-23"
+}
+
+{"execute":"query-cpus","id":"libvirt-2"}
+
+{
+  "return": [
+    {
+      "arch": "x86",
+      "current": true,
+      "CPU": 0,
+      "qom_path": "/machine/unattached/device[0]",
+      "pc": -2130415978,
+      "halted": true,
+      "thread_id": 518291
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 1,
+      "qom_path": "/machine/unattached/device[2]",
+      "pc": -2130415978,
+      "halted": true,
+      "thread_id": 518292
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 2,
+      "qom_path": "/machine/unattached/device[3]",
+      "pc": -2130415978,
+      "halted": true,
+      "thread_id": 518294
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 3,
+      "qom_path": "/machine/unattached/device[4]",
+      "pc": -2130415978,
+      "halted": true,
+      "thread_id": 518295
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 4,
+      "qom_path": "/machine/unattached/device[5]",
+      "pc": -2130415978,
+      "halted": true,
+      "thread_id": 518296
+    }
+  ],
+  "id": "libvirt-22"
+}
+
+{
+    "execute": "device_add",
+    "arguments": {
+        "driver": "qemu64-x86_64-cpu",
+        "id": "vcpu7",
+        "socket-id": 1,
+        "core-id": 1,
+        "thread-id": 1
+    },
+    "id": "libvirt-3"
+}
+
+{"return": {}}
+
+{"execute":"query-hotpluggable-cpus","id":"libvirt-4"}
+
+{
+  "return": [
+    {
+      "props": {
+        "core-id": 1,
+        "thread-id": 1,
+        "socket-id": 1
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/peripheral/vcpu7",
+      "type": "qemu64-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 1,
+        "thread-id": 0,
+        "socket-id": 1
+      },
+      "vcpus-count": 1,
+      "type": "qemu64-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 1,
+        "socket-id": 1
+      },
+      "vcpus-count": 1,
+      "type": "qemu64-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 1
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/unattached/device[5]",
+      "type": "qemu64-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 1,
+        "thread-id": 1,
+        "socket-id": 0
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/unattached/device[4]",
+      "type": "qemu64-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 1,
+        "thread-id": 0,
+        "socket-id": 0
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/unattached/device[3]",
+      "type": "qemu64-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 1,
+        "socket-id": 0
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/unattached/device[2]",
+      "type": "qemu64-x86_64-cpu"
+    },
+    {
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 0
+      },
+      "vcpus-count": 1,
+      "qom-path": "/machine/unattached/device[0]",
+      "type": "qemu64-x86_64-cpu"
+    }
+  ],
+  "id": "libvirt-23"
+}
+
+{"execute":"query-cpus","id":"libvirt-5"}
+
+{
+  "return": [
+    {
+      "arch": "x86",
+      "current": true,
+      "CPU": 0,
+      "qom_path": "/machine/unattached/device[0]",
+      "pc": -2130415978,
+      "halted": true,
+      "thread_id": 518291
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 1,
+      "qom_path": "/machine/unattached/device[2]",
+      "pc": -2130415978,
+      "halted": true,
+      "thread_id": 518292
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 2,
+      "qom_path": "/machine/unattached/device[3]",
+      "pc": -2130415978,
+      "halted": true,
+      "thread_id": 518294
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 3,
+      "qom_path": "/machine/unattached/device[4]",
+      "pc": -2130415978,
+      "halted": true,
+      "thread_id": 518295
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 4,
+      "qom_path": "/machine/unattached/device[5]",
+      "pc": -2130415978,
+      "halted": true,
+      "thread_id": 518296
+    },
+    {
+      "arch": "x86",
+      "current": false,
+      "CPU": 5,
+      "qom_path": "/machine/peripheral/vcpu7",
+      "pc": -2130415978,
+      "halted": true,
+      "thread_id": 518297
+    }
+  ],
+  "id": "libvirt-22"
+}
diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml
new file mode 100644
index 000000000..75e833558
--- /dev/null
+++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml
@@ -0,0 +1,40 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' current='6'>8</vcpu>
+  <vcpus>
+    <vcpu id='0' enabled='yes' hotpluggable='no'/>
+    <vcpu id='1' enabled='yes' hotpluggable='no'/>
+    <vcpu id='2' enabled='yes' hotpluggable='no'/>
+    <vcpu id='3' enabled='yes' hotpluggable='no'/>
+    <vcpu id='4' enabled='yes' hotpluggable='no'/>
+    <vcpu id='5' enabled='no' hotpluggable='yes'/>
+    <vcpu id='6' enabled='no' hotpluggable='yes'/>
+    <vcpu id='7' enabled='yes' hotpluggable='yes'/>
+  </vcpus>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu>
+    <topology sockets='4' cores='2' threads='1'/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml
new file mode 100644
index 000000000..a21db6f3b
--- /dev/null
+++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml
@@ -0,0 +1,48 @@
+<domain type='qemu' id='7'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static' current='6'>8</vcpu>
+  <vcpus>
+    <vcpu id='0' enabled='yes' hotpluggable='no' order='1'/>
+    <vcpu id='1' enabled='yes' hotpluggable='no' order='2'/>
+    <vcpu id='2' enabled='yes' hotpluggable='no' order='3'/>
+    <vcpu id='3' enabled='yes' hotpluggable='no' order='4'/>
+    <vcpu id='4' enabled='yes' hotpluggable='no' order='5'/>
+    <vcpu id='5' enabled='no' hotpluggable='yes'/>
+    <vcpu id='6' enabled='no' hotpluggable='yes'/>
+    <vcpu id='7' enabled='yes' hotpluggable='yes' order='6'/>
+  </vcpus>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='network'/>
+  </os>
+  <cpu>
+    <topology sockets='4' cores='2' threads='1'/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='usb' index='0'>
+      <alias name='usb'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'>
+      <alias name='pci'/>
+    </controller>
+    <input type='mouse' bus='ps2'>
+      <alias name='input0'/>
+    </input>
+    <input type='keyboard' bus='ps2'>
+      <alias name='input1'/>
+    </input>
+    <memballoon model='virtio'>
+      <alias name='balloon0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
-- 
2.11.0




More information about the libvir-list mailing list