Bug 667620

Summary: libvirt: adapt to spice qmp event changes
Product: Red Hat Enterprise Linux 6 Reporter: Gerd Hoffmann <kraxel>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.1CC: dallan, dyuan, eblake, gren, mzhan, vbian, xen-maint, yoyzhang, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.9.4-11.el6 Doc Type: Bug Fix
Doc Text:
Cause: QEMU changed format of SPICE events Consequence: libvirt would not be able to resend these events to users Fix: Libvirt adapted to new format Result: SPICE events are passed by to users
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 10:53:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 737881    
Bug Blocks:    

Description Gerd Hoffmann 2011-01-06 09:26:43 UTC
Description of problem:
The qmp events for spice connect/disconnect will change
from rhel 6.0  to rhel 6.1 to follow upstream qemu.
libvirt needs to adapt.


Additional info:

From QMP/qmp-events.txt:

SPICE_CONNECTED, SPICE_DISCONNECTED
-----------------------------------

Emitted when a SPICE client connects or disconnects.

Data:

- "server": Server information (json-object)
  - "host": IP address (json-string)
  - "port": port number (json-string)
  - "family": address family (json-string, "ipv4" or "ipv6")
- "client": Client information (json-object)
  - "host": IP address (json-string)
  - "port": port number (json-string)
  - "family": address family (json-string, "ipv4" or "ipv6")

Example:

{ "timestamp": {"seconds": 1290688046, "microseconds": 388707},
  "event": "SPICE_CONNECTED",
  "data": {
    "server": { "port": "5920", "family": "ipv4", "host": "127.0.0.1"},
    "client": {"port": "52873", "family": "ipv4", "host": "127.0.0.1"}
}}


SPICE_INITIALIZED
-----------------

Emitted after initial handshake and authentication takes place (if any)
and the SPICE channel is up'n'running

Data:

- "server": Server information (json-object)
  - "host": IP address (json-string)
  - "port": port number (json-string)
  - "family": address family (json-string, "ipv4" or "ipv6")
  - "auth": authentication method (json-string, optional)
- "client": Client information (json-object)
  - "host": IP address (json-string)
  - "port": port number (json-string)
  - "family": address family (json-string, "ipv4" or "ipv6")
  - "connection-id": spice connection id.  All channels with the same id
                     belong to the same spice session (json-int)
  - "channel-type": channel type.  "1" is the main control channel, filter for
                    this one if you want track spice sessions only (json-int)
  - "channel-id": channel id.  Usually "0", might be different needed when
                  multiple channels of the same type exist, such as multiple
                  display channels in a multihead setup (json-int)
  - "tls": whevener the channel is encrypted (json-bool)

Example:

{ "timestamp": {"seconds": 1290688046, "microseconds": 417172},
  "event": "SPICE_INITIALIZED",
  "data": {"server": {"auth": "spice", "port": "5921",
                      "family": "ipv4", "host": "127.0.0.1"},
           "client": {"port": "49004", "family": "ipv4", "channel-type": 3,
                      "connection-id": 1804289383, "host": "127.0.0.1",
                      "channel-id": 0, "tls": true}
}}

Comment 2 RHEL Program Management 2011-04-04 01:49:13 UTC
Since RHEL 6.1 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 3 Michal Privoznik 2011-09-09 15:17:12 UTC
Moving to MODIFIED, as we have had patch for this a long time:

libvirt-Emit-graphics-events-when-a-SPICE-client-connects-disconnects.patch

Comment 6 Vivian Bian 2011-09-13 11:33:28 UTC
Will verify this bug after bug 737881 gets fixed

Comment 7 zhe peng 2011-10-19 07:32:26 UTC
Verify with:
libvirt-0.9.4-18.el6
qemu-kvm-0.12.1.2-2.196.el6
kernel-2.6.32-207.el6

step:
1:See the log info on /var/log/libvirt/libvirtd.log (with setting log_filters="1:qemu_monitor_json" log_outputs="1:file:/var/log/libvirt/libvirtd.log" in the libvirtd.conf file)

2:re-start the libvirtd service, and then open two terminals.

3:In the first terminal run:
# python /usr/share/doc/libvirt-python-0.9.4/events-python/event-test.py 
qemu:///system

4:In another terminal run:
# virt-viewer $name_of_domin

5:after a while ,close virt-viewer

output in firsh terminal:
Using uri:qemu:///system
myDomainEventGraphicsCallback: Domain win732(2) 0 none
myDomainEventGraphicsCallback: Domain win732(2) 1 none
myDomainEventGraphicsCallback: Domain win732(2) 2 none

6:tail -f /var/log/libvirt/libvirtd.log
03:18:27.414: 922: debug : qemuMonitorJSONIOProcessLine:119 : Line [{"timestamp": {"seconds": 1319008707, "microseconds": 414402}, "event": "SPICE_CONNECTED", "data": {"server": {"port": "5900", "family": "ipv4", "host": "127.0.0.1"}, "client": {"port": "36113", "family": "ipv4", "host": "127.0.0.1"}}}]
........
03:18:27.414: 922: debug : qemuMonitorJSONIOProcessEvent:90 : mon=0x7f6724000ce0 obj=0xbd60a0
03:18:27.414: 922: debug : qemuMonitorJSONIOProcess:186 : Total used 237 bytes out of 237 available in buffer
.......
03:18:27.480: 922: debug : qemuMonitorJSONIOProcessLine:119 : Line [{"timestamp": {"seconds": 1319008707, "microseconds": 478913}, "event": "SPICE_INITIALIZED", "data": {"server": {"auth": "none", "port": "5900", "family": "ipv4", "host": "127.0.0.1"}, "client": {"port": "36113", "family": "ipv4", "channel-type": 1, "connection-id": 1714636915, "host": "127.0.0.1", "channel-id": 0, "tls": false}}}]
.........
03:19:39.666: 922: debug : qemuMonitorJSONIOProcessLine:119 : Line [{"timestamp": {"seconds": 1319008779, "microseconds": 666140}, "event": "SPICE_DISCONNECTED", "data": {"server": {"port": "5900", "family": "ipv4", "host": "127.0.0.1"}, "client": {"port": "36120", "family": "ipv4", "host": "127.0.0.1"}}}]

Comment 10 zhe peng 2011-10-19 08:42:00 UTC
thanks Michal's help, according to comment 7 , move to verified.

Comment 11 Michal Privoznik 2011-11-11 09:43:20 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: QEMU changed format of SPICE events

Consequence: libvirt would not be able to resend these events to users

Fix: Libvirt adapted to new format

Result: SPICE events are passed by to users

Comment 12 errata-xmlrpc 2011-12-06 10:53:09 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.

http://rhn.redhat.com/errata/RHBA-2011-1513.html