Bug 784813

Summary: Handle spice events
Product: [Fedora] Fedora Reporter: Jakub Libosvar <jlibosva>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 16CC: berrange, clalancette, crobinso, dallan, dougsland, itamar, jforbes, laine, libvirt-maint, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-05 23:43:52 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:
Attachments:
Description Flags
upstream patch backported to Fedora 16 none

Description Jakub Libosvar 2012-01-26 10:40:52 UTC
Description of problem:
Events from qemu such as SPICE_CONNECTED, SPICE_DISCONNECTED are not handled in libvirt.

Version-Release number of selected component (if applicable):
libvirt-0.9.6-4.fc16.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Have a script with registered callback function for event libvirt.VIR_DOMAIN_EVENT_ID_GRAPHICS
2. Have running domain with spice
3. Connect to domain via spice and disconnect
  
Actual results:
Callback function is not called

Expected results:
Callback function is called

Additional info:
2012-01-26 10:02:20.381+0000: 26265: debug : qemuMonitorJSONIOProcessLine:114 : Line [{"timestamp": {"seconds": 1327572140, "microseconds": 381577}, "event": "SPICE_DISCONNECTED", "data": {"server": {"port": "5901", "family": "ipv4", "host": "<hostIP>"}, "client": {"port": "51059", "family": "ipv4", "host": "<clientIP>"}}}]

Comment 1 Dave Allan 2012-01-27 03:27:02 UTC
Hi Jakub, handling the spice events shouldn't be difficult; I noticed you marked the BZ urgent though; can you provide a little background on what you need this functionality for and when?

Comment 2 Jakub Libosvar 2012-01-27 07:15:43 UTC
These events are used in oVirt Project by guest agents on Fedora guest OS to lock user Gnome or KDE session. If this event is not handled in libvirt, the session in guest VM is not locked so I considered it as security issue.

Comment 3 Daniel Berrangé 2012-01-27 10:06:39 UTC
This is a case where we added support for those events in RHEL first, and then forgot to apply the patch upstream later :-( The existing RHEL patch should just be commited upstream.

Comment 4 Dave Allan 2012-02-17 20:05:50 UTC
(In reply to comment #3)
> This is a case where we added support for those events in RHEL first, and then
> forgot to apply the patch upstream later :-( The existing RHEL patch should
> just be commited upstream.

Laine, would you mind doing that?

Comment 5 Laine Stump 2012-02-18 03:10:45 UTC
The patch I see in RHEL is one that adds the events "__com.redhat_SPICE_INITIALIZED" and "__com.redhat_SPICE_DISCONNECTED". This sounds like not exactly what we want upstream. Or am I misunderstanding something?

Comment 6 Dave Allan 2012-02-22 19:20:32 UTC
I believe that's generally what's wanted, but you do need to make sure that the event names are correct.  IMO we should support whatever upstream qemu does + any RHEL specific versions.

Comment 7 Laine Stump 2012-03-15 15:32:39 UTC
A patch has been pushed upstream:

commit 89ae6a5a30bd91cfb2365544f9dd2e6c2a36ecca
Author: Laine Stump <laine>
Date:   Wed Mar 14 01:41:35 2012 -0400

    Emit graphics events when a SPICE client connects/disconnects
   
    Wire up the domain graphics event notifications for SPICE. Adapted
    from a RHEL-only patch written by Dan Berrange that used custom
    __com.redhat_SPICE events - equivalent events are now available in
    upstream QEMU (including a SPICE_CONNECTED event, which was missing in
    the __COM.redhat_SPICE version).

Comment 8 Laine Stump 2012-03-15 15:36:16 UTC
Created attachment 570328 [details]
upstream patch backported to Fedora 16

This patch was backported from upstream to Fedora 16. You should be able to just drop it into the f16 libvirt directory and add it to the patch list. There were no conflicts in the backport.

Note that it does *not* add support for the redhat-specific events, as those will never be in upstream qemu, and will eventually be deprecated in RHEL.

Comment 9 Fedora Update System 2012-06-24 23:54:04 UTC
libvirt-0.9.6.1-1.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/libvirt-0.9.6.1-1.fc16

Comment 10 Fedora Update System 2012-06-26 00:54:57 UTC
Package libvirt-0.9.6.1-1.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing libvirt-0.9.6.1-1.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-9913/libvirt-0.9.6.1-1.fc16
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2012-07-05 23:43:52 UTC
libvirt-0.9.6.1-1.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.