Issue 90 Further Clarifications
by Dustan B Helm
[image: Dustan Helm] <https://gitlab.com/dustan.helm>
Dustan Helm <https://gitlab.com/dustan.helm> @dustan.helm
<https://gitlab.com/dustan.helm> · just now
<https://gitlab.com/libvirt/libvirt/-/issues/90#note_451306432>
<https://gitlab.com/libvirt/libvirt/-/issues/90#>
Before we start making changes and solidifying our XML parameter choices,
we have a few clarifying questions about the issue we'd like to get out of
the way.
1.
In src/qemu/qemu_capabilities.h, we found the string "/* -drive
file.driver=vxhs via query-qmp-schema */" after the QEMU_CAPS_VXHS
declaration. What is the purpose of these strings, and how do we modify
them to make sense for nfs? Would we simply mirror what is done for VXHS,
adding nfs as the protocol instead?
2.
Where is domain XML parsed and formatted? Is that what is referred to by
the schema formats in domaincommon.rng?
3.
In src/qemu/qemu_block.c, the json object arguments currently present in
qemuBlockStorageSourceGetVxHSProps(...) are not the same ones listed in the
example commit. What is the reason for this change, and how should we take
it into account when implementing a new protocol type?
Additionally, we were hoping we could get some clarification on the proper
way to handle submitting patches with multiple commits. If we receive
feedback for only part of a patch, for example, how would we be meant to
update it? Would we simply amend the particular commit that needed updates,
and if so, how do we amend a commit other than the most recent commit?
Should we send in our patches for review one at a time, or try to get all
of them made and then send them in all at once?
3 years, 11 months
[PATCH 0/2] security: A couple of fixes
by Jim Fehlig
I finally got around to investigating some apparmor-related test failures.
The first patch is apparmor specific. The second patch fixes a bug that
should affect all security drivers.
Jim Fehlig (2):
apparmor: Allow lxc processes to receive signals from libvirt
security: Avoid calling virSecurityManagerCheckModel with NULL model
src/security/apparmor/libvirt-lxc | 4 ++++
src/security/security_manager.c | 3 +++
2 files changed, 7 insertions(+)
--
2.29.2
3 years, 11 months
[PATCH 00/18] qapi/qom: QAPIfy object-add
by Kevin Wolf
This series adds a QAPI type for the properties of all user creatable
QOM types and finally makes QMP object-add use the new ObjectOptions
union so that QAPI introspection can be used for user creatable objects.
If you are in the CC list and didn't expect this series, it's probably
because you're the maintainer of one of the objects for which I'm adding
a QAPI schema description. Please just have a look at the specific patch
for your object and check whether the schema and its documentation make
sense to you. You can ignore all other patches.
After this series, there is least one obvious next step that needs to be
done: Change HMP and all of the command line parser to use
ObjectOptions, too, so that the QAPI schema is consistently enforced in
all external interfaces. I am planning to send another series to address
this.
In a third step, we can try to start deduplicating and integrating things
better between QAPI and the QOM implementation, e.g. by generating parts
of the QOM boilerplate from the QAPI schema.
Kevin Wolf (18):
qapi/qom: Add ObjectOptions for iothread
qapi/qom: Add ObjectOptions for authz-*
qapi/qom: Add ObjectOptions for cryptodev-*
qapi/qom: Add ObjectOptions for dbus-vmstate
qapi/qom: Add ObjectOptions for memory-backend-*
qapi/qom: Add ObjectOptions for rng-*, deprecate 'opened'
qapi/qom: Add ObjectOptions for throttle-group
qapi/qom: Add ObjectOptions for secret*, deprecate 'loaded'
qapi/qom: Add ObjectOptions for tls-*, deprecate 'loaded'
qapi/qom: Add ObjectOptions for can-*
qapi/qom: Add ObjectOptions for colo-compare
qapi/qom: Add ObjectOptions for filter-*
qapi/qom: Add ObjectOptions for pr-manager-helper
qapi/qom: Add ObjectOptions for sev-guest
qapi/qom: Add ObjectOptions for input-*
tests: Drop 'props' from object-add calls
qapi/qom: Drop deprecated 'props' from object-add
qapi/qom: QAPIfy object-add
qapi/authz.json | 62 +++
qapi/block-core.json | 12 +
qapi/common.json | 52 +++
qapi/crypto.json | 159 +++++++
qapi/machine.json | 22 +-
qapi/net.json | 20 -
qapi/qom.json | 609 ++++++++++++++++++++++++++-
qapi/ui.json | 13 +-
docs/system/deprecated.rst | 29 +-
include/qom/object_interfaces.h | 7 -
hw/block/xen-block.c | 16 +-
monitor/misc.c | 2 -
qom/qom-qmp-cmds.c | 44 +-
tests/qtest/qmp-cmd-test.c | 16 +-
tests/qtest/test-netfilter.c | 54 ++-
storage-daemon/qapi/qapi-schema.json | 1 +
tests/qemu-iotests/087 | 8 +-
tests/qemu-iotests/184 | 18 +-
tests/qemu-iotests/218 | 2 +-
tests/qemu-iotests/235 | 2 +-
tests/qemu-iotests/245 | 4 +-
tests/qemu-iotests/258 | 6 +-
tests/qemu-iotests/258.out | 4 +-
tests/qemu-iotests/295 | 2 +-
tests/qemu-iotests/296 | 2 +-
25 files changed, 993 insertions(+), 173 deletions(-)
--
2.28.0
3 years, 11 months
[PATCH libvirt v2 00/11] Support AP card, AP queues and AP matrix
by Shalini Chellathurai Saroja
Add support for AP card devices, AP queues and AP matrix devices in
libvirt node device driver.
---
v2:
- The tests included in the patches to detect the node devices (AP
card, AP queues and AP matrix) are moved to separate patches.
These patches are not divided further due to the following reasons:
- The previous patches that add support for node devices in
libvirt are not divided further into smaller patches (eg:
53aec799fa31711ffaeacc7ec17ec6d3c2e3cadf).
- It would be easier to identify the patches relevant to support
AP node devices.
- The number of lines in each of these patches are around 125,
which is not too much.
- Modified according to review comments.
- New patch to detect mdev_types capabilty of AP matrix device is
added to this patch series.
Boris Fiuczynski (1):
node_device: detecting mdev_types capability on ap_matrix device
Farhan Ali (1):
virsh: nodedev: Filter by AP card and AP queue capabilities
Shalini Chellathurai Saroja (9):
nodedev: detect AP card device
tests: AP card node device
nodedev: detect AP queues
tests: AP queue node device
nodedev: detect AP matrix device
tests: AP matrix node device
virsh: nodedev: filter by AP Matrix capability
node_device: refactor address retrieval of node device
node_device: mdev matrix support
docs/formatnode.html.in | 44 +++-
docs/manpages/virsh.rst | 2 +-
docs/schemas/nodedev.rng | 70 +++++-
include/libvirt/libvirt-nodedev.h | 3 +
src/conf/node_device_conf.c | 213 +++++++++++++++++-
src/conf/node_device_conf.h | 41 +++-
src/conf/virnodedeviceobj.c | 13 +-
src/libvirt-nodedev.c | 3 +
src/libvirt_private.syms | 1 +
src/node_device/node_device_driver.c | 33 ++-
src/node_device/node_device_udev.c | 83 +++++++
tests/nodedevschemadata/ap_07_0038.xml | 9 +
tests/nodedevschemadata/ap_card07.xml | 8 +
tests/nodedevschemadata/ap_matrix.xml | 7 +
.../ap_matrix_mdev_types.xml | 14 ++
...v_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml | 9 +
tests/nodedevxml2xmltest.c | 5 +
tools/virsh-nodedev.c | 9 +
18 files changed, 554 insertions(+), 13 deletions(-)
create mode 100644 tests/nodedevschemadata/ap_07_0038.xml
create mode 100644 tests/nodedevschemadata/ap_card07.xml
create mode 100644 tests/nodedevschemadata/ap_matrix.xml
create mode 100644 tests/nodedevschemadata/ap_matrix_mdev_types.xml
create mode 100644 tests/nodedevschemadata/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml
--
2.26.2
3 years, 11 months
[libvirt PATCH 0/2] tests: Sync and simplify some ppc64 tests
by Andrea Bolognani
Inspired by
https://www.redhat.com/archives/libvir-list/2020-November/msg01057.html
Andrea Bolognani (2):
tests: Sync some ppc64 tests
tests: Simplify some ppc64 tests
.../memory-hotplug-nvdimm-ppc64.args | 6 +--
...ory-hotplug-nvdimm-ppc64.ppc64-latest.args | 38 -------------------
.../memory-hotplug-nvdimm-ppc64.xml | 8 +---
.../memory-hotplug-ppc64-nonuma.args | 7 +---
.../memory-hotplug-ppc64-nonuma.xml | 14 +++++--
tests/qemuxml2argvtest.c | 4 +-
.../memory-hotplug-nvdimm-ppc64.xml | 8 +---
.../memory-hotplug-ppc64-nonuma.xml | 1 +
tests/qemuxml2xmltest.c | 5 +++
9 files changed, 26 insertions(+), 65 deletions(-)
delete mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.ppc64-=
latest.args
create mode 120000 tests/qemuxml2xmloutdata/memory-hotplug-ppc64-nonuma.xml
--=20
2.26.2
3 years, 11 months
[libvirt PATCH] conf: Fix segfault when parsing mdev types
by Jonathon Jongsma
Commit f1b0890 introduced a potential crash due to incorrect operator
precedence when accessing an element from a pointer to an array.
Backtrace below:
#0 virNodeDeviceGetMdevTypesCaps (sysfspath=0x7fff801661e0 "/sys/devices/pci0000:00/0000:00:02.0", mdev_types=0x7fff801c9b40, nmdev_types=0x7fff801c9b48) at ../src/conf/node_device_conf.c:2676
#1 0x00007ffff7caf53d in virNodeDeviceGetPCIDynamicCaps (sysfsPath=0x7fff801661e0 "/sys/devices/pci0000:00/0000:00:02.0", pci_dev=0x7fff801c9ac8) at ../src/conf/node_device_conf.c:2705
#2 0x00007ffff7cae38f in virNodeDeviceUpdateCaps (def=0x7fff80168a10) at ../src/conf/node_device_conf.c:2342
#3 0x00007ffff7cb11c0 in virNodeDeviceObjMatch (obj=0x7fff84002e50, flags=0) at ../src/conf/virnodedeviceobj.c:850
#4 0x00007ffff7cb153d in virNodeDeviceObjListExportCallback (payload=0x7fff84002e50, name=0x7fff801cbc20 "pci_0000_00_02_0", opaque=0x7fffe2ffc6a0) at ../src/conf/virnodedeviceobj.c:909
#5 0x00007ffff7b69146 in virHashForEach (table=0x7fff9814b700 = {...}, iter=0x7ffff7cb149e <virNodeDeviceObjListExportCallback>, opaque=0x7fffe2ffc6a0) at ../src/util/virhash.c:394
#6 0x00007ffff7cb1694 in virNodeDeviceObjListExport (conn=0x7fff98013170, devs=0x7fff98154430, devices=0x7fffe2ffc798, filter=0x7ffff7cf47a1 <virConnectListAllNodeDevicesCheckACL>, flags=0)
at ../src/conf/virnodedeviceobj.c:943
#7 0x00007fffe00694b2 in nodeConnectListAllNodeDevices (conn=0x7fff98013170, devices=0x7fffe2ffc798, flags=0) at ../src/node_device/node_device_driver.c:228
#8 0x00007ffff7e703aa in virConnectListAllNodeDevices (conn=0x7fff98013170, devices=0x7fffe2ffc798, flags=0) at ../src/libvirt-nodedev.c:130
#9 0x000055555557f796 in remoteDispatchConnectListAllNodeDevices (server=0x555555627080, client=0x5555556bf050, msg=0x5555556c0000, rerr=0x7fffe2ffc8a0, args=0x7fffd4008470, ret=0x7fffd40084e0)
at src/remote/remote_daemon_dispatch_stubs.h:1613
#10 0x000055555557f6f9 in remoteDispatchConnectListAllNodeDevicesHelper (server=0x555555627080, client=0x5555556bf050, msg=0x5555556c0000, rerr=0x7fffe2ffc8a0, args=0x7fffd4008470, ret=0x7fffd40084e0)
at src/remote/remote_daemon_dispatch_stubs.h:1591
#11 0x00007ffff7ce9542 in virNetServerProgramDispatchCall (prog=0x555555690c10, server=0x555555627080, client=0x5555556bf050, msg=0x5555556c0000) at ../src/rpc/virnetserverprogram.c:428
#12 0x00007ffff7ce90bd in virNetServerProgramDispatch (prog=0x555555690c10, server=0x555555627080, client=0x5555556bf050, msg=0x5555556c0000) at ../src/rpc/virnetserverprogram.c:302
#13 0x00007ffff7cf042b in virNetServerProcessMsg (srv=0x555555627080, client=0x5555556bf050, prog=0x555555690c10, msg=0x5555556c0000) at ../src/rpc/virnetserver.c:137
#14 0x00007ffff7cf04eb in virNetServerHandleJob (jobOpaque=0x5555556b66b0, opaque=0x555555627080) at ../src/rpc/virnetserver.c:154
#15 0x00007ffff7bd912f in virThreadPoolWorker (opaque=0x55555562bc70) at ../src/util/virthreadpool.c:163
#16 0x00007ffff7bd8645 in virThreadHelper (data=0x55555562bc90) at ../src/util/virthread.c:233
#17 0x00007ffff6d90432 in start_thread () at /lib64/libpthread.so.0
#18 0x00007ffff75c5913 in clone () at /lib64/libc.so.6
Signed-off-by: Jonathon Jongsma <jjongsma(a)redhat.com>
---
src/conf/node_device_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 4e2837c1cd..cac4243b50 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -2673,7 +2673,7 @@ virNodeDeviceGetMdevTypesCaps(const char *sysfspath,
/* this could be a refresh, so clear out the old data */
for (i = 0; i < *nmdev_types; i++)
- virMediatedDeviceTypeFree(*mdev_types[i]);
+ virMediatedDeviceTypeFree((*mdev_types)[i]);
VIR_FREE(*mdev_types);
*nmdev_types = 0;
--
2.26.2
3 years, 11 months
[PATCH libvirt v3 00/11] Support AP card, AP queues and AP matrix
by Shalini Chellathurai Saroja
Add support for AP card devices, AP queues and AP matrix devices in
libvirt node device driver.
---
v3:
- Modify schema definition of ap-adapter to support hex values alone.
- Modify schema definition of ap-domain to support hex values alone.
- Verify domain value of AP queue device to be within the supported
range during parsing.
- Re-organized patches 6 and 10 according to review comment.
- Minor changes according to review comments.
v2:
- The tests included in the patches to detect the node devices (AP
card, AP queues and AP matrix) are moved to separate patches.
These patches are not divided further due to the following reasons:
- The previous patches that add support for node devices in
libvirt are not divided further into smaller patches (eg:
53aec799fa31711ffaeacc7ec17ec6d3c2e3cadf).
- It would be easier to identify the patches relevant to support
AP node devices.
- The number of lines in each of these patches are around 125,
which is not too much.
- Modified according to review comments.
- New patch to detect mdev_types capabilty of AP matrix device is
added to this patch series.
Boris Fiuczynski (1):
node_device: detecting mdev_types capability on ap_matrix device
Farhan Ali (1):
virsh: nodedev: Filter by AP card and AP queue capabilities
Shalini Chellathurai Saroja (9):
nodedev: detect AP card device
tests: AP card node device
nodedev: detect AP queues
tests: AP queue node device
nodedev: detect AP matrix device
tests: AP matrix node device
virsh: nodedev: filter by AP Matrix capability
node_device: refactor address retrieval of node device
node_device: mdev matrix support
docs/formatnode.html.in | 48 +++-
docs/manpages/virsh.rst | 2 +-
docs/schemas/nodedev.rng | 46 ++++
include/libvirt/libvirt-nodedev.h | 3 +
src/conf/node_device_conf.c | 218 ++++++++++++++++++
src/conf/node_device_conf.h | 41 +++-
src/conf/virnodedeviceobj.c | 13 +-
src/libvirt-nodedev.c | 3 +
src/libvirt_private.syms | 1 +
src/node_device/node_device_driver.c | 33 ++-
src/node_device/node_device_udev.c | 86 +++++++
tests/nodedevschemadata/ap_07_0038.xml | 9 +
tests/nodedevschemadata/ap_card07.xml | 8 +
tests/nodedevschemadata/ap_matrix.xml | 7 +
.../ap_matrix_mdev_types.xml | 14 ++
...v_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml | 9 +
tests/nodedevxml2xmltest.c | 5 +
tools/virsh-nodedev.c | 9 +
18 files changed, 549 insertions(+), 6 deletions(-)
create mode 100644 tests/nodedevschemadata/ap_07_0038.xml
create mode 100644 tests/nodedevschemadata/ap_card07.xml
create mode 100644 tests/nodedevschemadata/ap_matrix.xml
create mode 100644 tests/nodedevschemadata/ap_matrix_mdev_types.xml
create mode 100644 tests/nodedevschemadata/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml
--
2.26.2
3 years, 11 months
[PATCH 0/4] libvirt_recover_xattrs: Improve usability for libvirt development
by Peter Krempa
I run into scenarios where I forget to destroy a VM which has a new WIP
qemu capability. Starting a libvirtd which doesn't support it yet makes
the libvirt vanish, thus after manually killing it libvirtd doesn't
clear the xattrs, making it impossible to start the VM.
libvirt_recover_xattrs fixes this, but is unusable unless you want to
turn off all VMs.
Peter Krempa (4):
libvirt_recover_xattrs: Avoid backticks for subshell
libvirt_recover_xattrs: Use only the correct xattr prefix
libvirt_recover_xattrs: Add unsafe operation mode
libvirt_recover_xattrs: Allow fixing multiple PATHs
tools/libvirt_recover_xattrs.sh | 64 ++++++++++++++++++++++-----------
1 file changed, 43 insertions(+), 21 deletions(-)
--
2.28.0
3 years, 11 months
[PATCH v2] qemu: Pass / fill niothreads for qemuMonitorGetIOThreads
by John Ferlan
Let's pass along / fill @niothreads rather than trying to make dual
use as a return value and thread count.
This resolves a Coverity issue detected in qemuDomainGetIOThreadsMon
where if qemuDomainObjExitMonitor failed, then a -1 was returned and
overwrite @niothreads causing a memory leak.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Since v1, updated the logic to pass @niothreads around rather than
rely on the dual meaning. Took the full plunge.
src/qemu/qemu_driver.c | 23 +++++++++++------------
src/qemu/qemu_monitor.c | 8 +++++---
src/qemu/qemu_monitor.h | 3 ++-
src/qemu/qemu_monitor_json.c | 6 ++++--
src/qemu/qemu_monitor_json.h | 3 ++-
src/qemu/qemu_process.c | 4 ++--
tests/qemumonitorjsontest.c | 4 ++--
7 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bca1c84630..65725b2ef2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4972,17 +4972,18 @@ qemuDomainGetMaxVcpus(virDomainPtr dom)
static int
qemuDomainGetIOThreadsMon(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- qemuMonitorIOThreadInfoPtr **iothreads)
+ qemuMonitorIOThreadInfoPtr **iothreads,
+ int *niothreads)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- int niothreads = 0;
+ int ret = -1;
qemuDomainObjEnterMonitor(driver, vm);
- niothreads = qemuMonitorGetIOThreads(priv->mon, iothreads);
- if (qemuDomainObjExitMonitor(driver, vm) < 0 || niothreads < 0)
+ ret = qemuMonitorGetIOThreads(priv->mon, iothreads, niothreads);
+ if (qemuDomainObjExitMonitor(driver, vm) < 0)
return -1;
- return niothreads;
+ return ret;
}
@@ -5014,7 +5015,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver,
goto endjob;
}
- if ((niothreads = qemuDomainGetIOThreadsMon(driver, vm, &iothreads)) < 0)
+ if ((ret = qemuDomainGetIOThreadsMon(driver, vm, &iothreads, &niothreads)) < 0)
goto endjob;
/* Nothing to do */
@@ -5314,8 +5315,7 @@ qemuDomainHotplugAddIOThread(virQEMUDriverPtr driver,
* IOThreads thread_id's, adjust the cgroups, thread affinity,
* and add the thread_id to the vm->def->iothreadids list.
*/
- if ((new_niothreads = qemuMonitorGetIOThreads(priv->mon,
- &new_iothreads)) < 0)
+ if (qemuMonitorGetIOThreads(priv->mon, &new_iothreads, &new_niothreads) < 0)
goto exit_monitor;
if (qemuDomainObjExitMonitor(driver, vm) < 0)
@@ -5425,8 +5425,7 @@ qemuDomainHotplugDelIOThread(virQEMUDriverPtr driver,
if (rc < 0)
goto exit_monitor;
- if ((new_niothreads = qemuMonitorGetIOThreads(priv->mon,
- &new_iothreads)) < 0)
+ if (qemuMonitorGetIOThreads(priv->mon, &new_iothreads, &new_niothreads) < 0)
goto exit_monitor;
if (qemuDomainObjExitMonitor(driver, vm) < 0)
@@ -18507,7 +18506,7 @@ qemuDomainGetStatsIOThread(virQEMUDriverPtr driver,
qemuDomainObjPrivatePtr priv = dom->privateData;
size_t i;
qemuMonitorIOThreadInfoPtr *iothreads = NULL;
- int niothreads;
+ int niothreads = 0;
int ret = -1;
if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom))
@@ -18516,7 +18515,7 @@ qemuDomainGetStatsIOThread(virQEMUDriverPtr driver,
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD))
return 0;
- if ((niothreads = qemuDomainGetIOThreadsMon(driver, dom, &iothreads)) < 0)
+ if (qemuDomainGetIOThreadsMon(driver, dom, &iothreads, &niothreads) < 0)
return -1;
/* qemuDomainGetIOThreadsMon returns a NULL-terminated list, so we must free
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index ce1a06c4c8..551b65e778 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -4211,22 +4211,24 @@ qemuMonitorRTCResetReinjection(qemuMonitorPtr mon)
* qemuMonitorGetIOThreads:
* @mon: Pointer to the monitor
* @iothreads: Location to return array of IOThreadInfo data
+ * @niothreads: Count of the number of IOThreads in the array
*
* Issue query-iothreads command.
* Retrieve the list of iothreads defined/running for the machine
*
- * Returns count of IOThreadInfo structures on success
+ * Returns 0 on success
* -1 on error.
*/
int
qemuMonitorGetIOThreads(qemuMonitorPtr mon,
- qemuMonitorIOThreadInfoPtr **iothreads)
+ qemuMonitorIOThreadInfoPtr **iothreads,
+ int *niothreads)
{
VIR_DEBUG("iothreads=%p", iothreads);
QEMU_CHECK_MONITOR(mon);
- return qemuMonitorJSONGetIOThreads(mon, iothreads);
+ return qemuMonitorJSONGetIOThreads(mon, iothreads, niothreads);
}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 8bc092870b..49be2d5412 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1365,7 +1365,8 @@ struct _qemuMonitorIOThreadInfo {
bool set_poll_shrink;
};
int qemuMonitorGetIOThreads(qemuMonitorPtr mon,
- qemuMonitorIOThreadInfoPtr **iothreads);
+ qemuMonitorIOThreadInfoPtr **iothreads,
+ int *niothreads);
int qemuMonitorSetIOThread(qemuMonitorPtr mon,
qemuMonitorIOThreadInfoPtr iothreadInfo);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 5acc1a10aa..f70490d9b0 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -8072,7 +8072,8 @@ qemuMonitorJSONRTCResetReinjection(qemuMonitorPtr mon)
*/
int
qemuMonitorJSONGetIOThreads(qemuMonitorPtr mon,
- qemuMonitorIOThreadInfoPtr **iothreads)
+ qemuMonitorIOThreadInfoPtr **iothreads,
+ int *niothreads)
{
int ret = -1;
virJSONValuePtr cmd;
@@ -8149,9 +8150,10 @@ qemuMonitorJSONGetIOThreads(qemuMonitorPtr mon,
info->poll_valid = true;
}
- ret = n;
+ *niothreads = n;
*iothreads = infolist;
infolist = NULL;
+ ret = 0;
cleanup:
if (infolist) {
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index d2928b0ffc..4eb0f667a2 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -550,7 +550,8 @@ int qemuMonitorJSONGetGuestCPU(qemuMonitorPtr mon,
int qemuMonitorJSONRTCResetReinjection(qemuMonitorPtr mon);
int qemuMonitorJSONGetIOThreads(qemuMonitorPtr mon,
- qemuMonitorIOThreadInfoPtr **iothreads)
+ qemuMonitorIOThreadInfoPtr **iothreads,
+ int *niothreads)
ATTRIBUTE_NONNULL(2);
int qemuMonitorJSONSetIOThread(qemuMonitorPtr mon,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 20e90026e1..01afe66ec9 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2498,10 +2498,10 @@ qemuProcessDetectIOThreadPIDs(virQEMUDriverPtr driver,
/* Get the list of IOThreads from qemu */
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
goto cleanup;
- niothreads = qemuMonitorGetIOThreads(priv->mon, &iothreads);
+ ret = qemuMonitorGetIOThreads(priv->mon, &iothreads, &niothreads);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto cleanup;
- if (niothreads < 0)
+ if (ret < 0)
goto cleanup;
if (niothreads != vm->def->niothreadids) {
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 79ef2a545e..d0c37967d5 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2377,8 +2377,8 @@ testQemuMonitorJSONGetIOThreads(const void *opaque)
"}") < 0)
goto cleanup;
- if ((ninfo = qemuMonitorGetIOThreads(qemuMonitorTestGetMonitor(test),
- &info)) < 0)
+ if (qemuMonitorGetIOThreads(qemuMonitorTestGetMonitor(test),
+ &info, &ninfo) < 0)
goto cleanup;
if (ninfo != 2) {
--
2.28.0
3 years, 11 months
[libvirt PATCH] util: squelch G_DEFINE_TYPE volatile warnings with GCC 11
by Daniel P. Berrangé
In this previous commit:
commit 65491a2dfe00bfcf9f09a8d6eab60234b56c8cc4
Author: Martin Kletzander <mkletzan(a)redhat.com>
Date: Thu Nov 12 13:58:53 2020 +0100
Do not disable incompatible-pointer-types-discards-qualifiers
We selectively rewrite G_DEFINE_TYPE to avoid warnings about
mismatched volatile/non-volatile pointers that appeared with
CLang when using GLib2 >= 2.67
We have now just hit the reverse problem, GCC >= 11 has started
warning about mismatched volatile/non-volatile pointers but only
with GLib2 < 2.67. The new GLib2 avoids the warning, as does
older GCC.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/util/glibcompat.h | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/util/glibcompat.h b/src/util/glibcompat.h
index 457f6ba797..455324925f 100644
--- a/src/util/glibcompat.h
+++ b/src/util/glibcompat.h
@@ -22,7 +22,10 @@
#include <glib/gstdio.h>
#include <glib-object.h>
-#if defined(__clang__) && GLIB_CHECK_VERSION(2, 67, 0)
+#if GLIB_CHECK_VERSION(2, 67, 0)
+
+# if defined(__clang__)
+
/*
* Clang detects (valid) issue in G_DEFINE_TYPE and derivatives starting with
* glib >= 2.67.0. See https://gitlab.gnome.org/GNOME/glib/-/issues/600
@@ -34,16 +37,36 @@
* is defined in glib (with a very low probability of being changed thanks to a
* comment above it).
*/
-# undef _G_DEFINE_TYPE_EXTENDED_BEGIN
+# undef _G_DEFINE_TYPE_EXTENDED_BEGIN
-# define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) \
+# define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wincompatible-pointer-types-discards-qualifiers\"") \
_G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \
_G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
_Pragma("GCC diagnostic pop")
-#endif /* __clang__ */
+# endif /* __clang__ */
+
+#else /* GLib < 2.67.0 */
+
+/*
+ * ...meanwhile GCC >= 11 has started issuing warnings about volatile
+ * from the old G_DEFINE_TYPE macro impl. IOW the new macros impls fixed
+ * new GCC, but broke CLang
+ */
+# if !defined(__clang__) && __GNUC_PREREQ (11, 0)
+# undef _G_DEFINE_TYPE_EXTENDED_BEGIN
+
+# define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wincompatible-pointer-types\"") \
+ _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \
+ _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
+ _Pragma("GCC diagnostic pop")
+# endif /* !clang */
+
+#endif /* GLib < 2.67.0 */
gchar * vir_g_canonicalize_filename(const gchar *filename,
const gchar *relative_to);
--
2.25.4
3 years, 11 months