Bug 1673320 - libvirt needs to replace use of query-events with query-qmp-schema
Summary: libvirt needs to replace use of query-events with query-qmp-schema
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.0
Assignee: Peter Krempa
QA Contact: Yanqiu Zhang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-02-07 11:27 UTC by Daniel Berrangé
Modified: 2020-11-14 05:58 UTC (History)
10 users (show)

Fixed In Version: libvirt-5.3.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-06 07:12:49 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:3723 0 None None None 2019-11-06 07:13:21 UTC

Description Daniel Berrangé 2019-02-07 11:27:38 UTC
Description of problem:
Upstream is deprecating query-events & will ultimately remove it:

  https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg01658.html

This is not an immediate problem, but eventually 8.x will rebase to a QEMU version where this command is gone, and libvirt should be prepared for that in advance.

Version-Release number of selected component (if applicable):
libvirt-5.0.0

Comment 1 Peter Krempa 2019-02-07 11:34:55 UTC
I'm working on a patch

Comment 2 Peter Krempa 2019-02-08 11:14:27 UTC
commit 22d7222ec0424f7c0355718bd70f613c00729852 (origin/master, origin/HEAD, master)
Author: Peter Krempa <pkrempa>
Date:   Thu Feb 7 13:03:37 2019 +0100

    qemu: caps: Don't call 'query-events' when we probe events from QMP schema
    
    Avoid calling the command and fix test fallout.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1673320
    
    Signed-off-by: Peter Krempa <pkrempa>

Fixed upstream:

commit 398d5766b30819c56d6d5e280678dd273f6585f7
Author: Peter Krempa <pkrempa>
Date:   Thu Feb 7 12:50:27 2019 +0100

    qemu: caps: Probe events from 'query-qmp-schema' rather than 'query-events'
    
    QEMU plans to deprecate 'query-events' as it's non-extensible. Events
    are also described by 'query-qmp-schema' so we can use that one instead.
    
    This patch adds detection of events to
    virQEMUCapsProbeQMPSchemaCapabilities using the same structure declaring
    them for the old approach (virQEMUCapsEvents). This is possible as the
    name is the same in the QMP schema and our detector supports that
    trivially.
    
    For any complex queries virQEMUCapsQMPSchemaQueries can be used in the
    future.
    
    For now we still call 'query-events' and discard the result so that it's
    obvious that the tests pass. This will be cleaned up later.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1673320
    
    Signed-off-by: Peter Krempa <pkrempa>

Comment 3 Yanqiu Zhang 2019-02-13 09:37:50 UTC
Can be reproduced:
libvirt-5.0.0-1.module+el8+2718+dce7093f.x86_64
qemu-kvm-3.1.0-8.module+el8+2726+efbc7128.x86_64

# rm -f /var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml
# systemctl restart libvirtd
# cat /var/log/libvirt/libvirtd.log|grep -E '"execute":"query-events"|"execute":"query-qmp-schema"'
2019-02-13 09:18:40.927+0000: 557: debug : virJSONValueToString:1995 : result={"execute":"query-events","id":"libvirt-6"}
2019-02-13 09:18:40.927+0000: 557: debug : qemuMonitorJSONCommandWithFd:304 : Send command '{"execute":"query-events","id":"libvirt-6"}' for write with FD -1
2019-02-13 09:18:40.927+0000: 557: info : qemuMonitorSend:1081 : QEMU_MONITOR_SEND_MSG: mon=0x7f58a0106d10 msg={"execute":"query-events","id":"libvirt-6"}
2019-02-13 09:18:40.928+0000: 508: info : qemuMonitorIOWrite:549 : QEMU_MONITOR_IO_WRITE: mon=0x7f58a0106d10 buf={"execute":"query-events","id":"libvirt-6"}
2019-02-13 09:18:41.058+0000: 557: debug : virJSONValueToString:1995 : result={"execute":"query-qmp-schema","id":"libvirt-44"}
2019-02-13 09:18:41.058+0000: 557: debug : qemuMonitorJSONCommandWithFd:304 : Send command '{"execute":"query-qmp-schema","id":"libvirt-44"}' for write with FD -1
2019-02-13 09:18:41.058+0000: 557: info : qemuMonitorSend:1081 : QEMU_MONITOR_SEND_MSG: mon=0x7f58a0106d10 msg={"execute":"query-qmp-schema","id":"libvirt-44"}
2019-02-13 09:18:41.058+0000: 508: info : qemuMonitorIOWrite:549 : QEMU_MONITOR_IO_WRITE: mon=0x7f58a0106d10 buf={"execute":"query-qmp-schema","id":"libvirt-44"}


"query-events" is used.

Comment 7 Yanqiu Zhang 2019-08-13 03:36:53 UTC
Verify this bug with:
libvirt-daemon-5.6.0-1.module+el8.1.0+3890+4d3d259c.x86_64
qemu-kvm-4.0.0-6.module+el8.1.0+3736+a2aefea3.x86_64

Steps:
1. Newly create caps xml, should use "query-qmp-schema" only, without "query-events":
# rm -f /var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml

# systemctl restart libvirtd

#  cat /var/log/libvirt/libvirtd.log|grep -E '"execute":"query-events"|"execute":"query-qmp-schema"'
2019-08-13 02:38:43.565+0000: 16853: info : qemuMonitorSend:1072 : QEMU_MONITOR_SEND_MSG: mon=0x7f3d780f77b0 msg={"execute":"query-qmp-schema","id":"libvirt-43"}
2019-08-13 02:38:43.565+0000: 16837: info : qemuMonitorIOWrite:546 : QEMU_MONITOR_IO_WRITE: mon=0x7f3d780f77b0 buf={"execute":"query-qmp-schema","id":"libvirt-43"}

2. Upgrade libvirt, caps xml should not lose any events:
# rpm -q libvirt-daemon qemu-kvm
libvirt-daemon-5.5.0-2.module+el8.1.0+3773+7dd501bf.x86_64
qemu-kvm-4.0.0-6.module+el8.1.0+3736+a2aefea3.x86_64

# ls -l /var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml
-rw-------. 1 root root 62517 Aug 12 **23:00** /var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml

# cp /var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml  /root/caps_5-5.xml

# yum module update virt:8.1

# rpm -q libvirt-daemon qemu-kvm
libvirt-daemon-5.6.0-1.module+el8.1.0+3890+4d3d259c.x86_64
qemu-kvm-4.0.0-6.module+el8.1.0+3736+a2aefea3.x86_64

# ls -l /var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml
-rw-------. 1 root root 62548 Aug 12 **23:06***/var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml

# diff /var/cache/libvirt/qemu/capabilities/3c76bc41d59c0c7314b1ae8e63f4f765d2cf16abaeea081b3ca1f5d8732f7bb1.xml  /root/caps_5-5.xml
3,4c3,4
<   <selfctime>1565665559</selfctime>
<   <selfvers>5006000</selfvers>
---
>   <selfctime>1565665000</selfctime>
>   <selfvers>5005000</selfvers>
196d195
<   <flag name='bochs-display'/>

Only selfctime and selfvers are different, and new flag 'bochs-display' is added. No event related flags changed.

Comment 9 errata-xmlrpc 2019-11-06 07:12:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:3723


Note You need to log in before you can comment on or make changes to this bug.