[libvirt] [PATCH] 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). * src/qemu/qemu_monitor_json.c: Wire up SPICE graphics events --- src/qemu/qemu_monitor_json.c | 56 +++++++++++++++++++++++++++++++++++++++--- 1 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 1a0ee94..a5ef1d4 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -59,6 +59,9 @@ static void qemuMonitorJSONHandleVNCConnect(qemuMonitorPtr mon, virJSONValuePtr static void qemuMonitorJSONHandleVNCInitialize(qemuMonitorPtr mon, virJSONValuePtr data); static void qemuMonitorJSONHandleVNCDisconnect(qemuMonitorPtr mon, virJSONValuePtr data); static void qemuMonitorJSONHandleBlockJob(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEConnect(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEInitialize(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEDisconnect(qemuMonitorPtr mon, virJSONValuePtr data); static struct { const char *type; @@ -75,6 +78,9 @@ static struct { { "VNC_INITIALIZED", qemuMonitorJSONHandleVNCInitialize, }, { "VNC_DISCONNECTED", qemuMonitorJSONHandleVNCDisconnect, }, { "BLOCK_JOB_COMPLETED", qemuMonitorJSONHandleBlockJob, }, + { "SPICE_CONNECTED", qemuMonitorJSONHandleSPICEConnect, }, + { "SPICE_INITIALIZED", qemuMonitorJSONHandleSPICEInitialize, }, + { "SPICE_DISCONNECTED", qemuMonitorJSONHandleSPICEDisconnect, }, }; @@ -624,7 +630,7 @@ VIR_ENUM_IMPL(qemuMonitorGraphicsAddressFamily, VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_LAST, "ipv4", "ipv6", "unix"); -static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, int phase) +static void qemuMonitorJSONHandleGraphics(qemuMonitorPtr mon, virJSONValuePtr data, int phase) { const char *localNode, *localService, *localFamily; const char *remoteNode, *remoteService, *remoteFamily; @@ -643,14 +649,38 @@ static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, i } authScheme = virJSONValueObjectGetString(server, "auth"); + if (!authScheme) { + VIR_WARN("missing auth scheme in graphics event"); + return; + } localFamily = virJSONValueObjectGetString(server, "family"); + if (!authScheme) { + VIR_WARN("missing local address family in graphics event"); + return; + } localNode = virJSONValueObjectGetString(server, "host"); + if (!authScheme) { + VIR_WARN("missing local hostname in graphics event"); + return; + } localService = virJSONValueObjectGetString(server, "service"); + if (!localService) + localService = ""; /* Spice has multiple ports, so this isn't provided */ remoteFamily = virJSONValueObjectGetString(client, "family"); + if (!authScheme) { + VIR_WARN("missing remote address family in graphics event"); + return; + } remoteNode = virJSONValueObjectGetString(client, "host"); + if (!authScheme) { + VIR_WARN("missing remote hostname in graphics event"); + return; + } remoteService = virJSONValueObjectGetString(client, "service"); + if (!remoteService) + remoteService = ""; /* Spice has multiple ports, so this isn't provided */ saslUsername = virJSONValueObjectGetString(client, "sasl_username"); x509dname = virJSONValueObjectGetString(client, "x509_dname"); @@ -672,19 +702,37 @@ static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, i static void qemuMonitorJSONHandleVNCConnect(qemuMonitorPtr mon, virJSONValuePtr data) { - qemuMonitorJSONHandleVNC(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_CONNECT); + qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_CONNECT); } static void qemuMonitorJSONHandleVNCInitialize(qemuMonitorPtr mon, virJSONValuePtr data) { - qemuMonitorJSONHandleVNC(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE); + qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE); } static void qemuMonitorJSONHandleVNCDisconnect(qemuMonitorPtr mon, virJSONValuePtr data) { - qemuMonitorJSONHandleVNC(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT); + qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT); +} + + +static void qemuMonitorJSONHandleSPICEConnect(qemuMonitorPtr mon, virJSONValuePtr data) +{ + qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_CONNECT); +} + + +static void qemuMonitorJSONHandleSPICEInitialize(qemuMonitorPtr mon, virJSONValuePtr data) +{ + qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE); +} + + +static void qemuMonitorJSONHandleSPICEDisconnect(qemuMonitorPtr mon, virJSONValuePtr data) +{ + qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT); } static void qemuMonitorJSONHandleBlockJob(qemuMonitorPtr mon, virJSONValuePtr data) -- 1.7.7.6

On 03/14/2012 01:45 PM, Laine Stump wrote:
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).
* src/qemu/qemu_monitor_json.c: Wire up SPICE graphics events --- src/qemu/qemu_monitor_json.c | 56 +++++++++++++++++++++++++++++++++++++++--- 1 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 1a0ee94..a5ef1d4 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -59,6 +59,9 @@ static void qemuMonitorJSONHandleVNCConnect(qemuMonitorPtr mon, virJSONValuePtr static void qemuMonitorJSONHandleVNCInitialize(qemuMonitorPtr mon, virJSONValuePtr data); static void qemuMonitorJSONHandleVNCDisconnect(qemuMonitorPtr mon, virJSONValuePtr data); static void qemuMonitorJSONHandleBlockJob(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEConnect(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEInitialize(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEDisconnect(qemuMonitorPtr mon, virJSONValuePtr data);
static struct { const char *type; @@ -75,6 +78,9 @@ static struct { { "VNC_INITIALIZED", qemuMonitorJSONHandleVNCInitialize, }, { "VNC_DISCONNECTED", qemuMonitorJSONHandleVNCDisconnect, }, { "BLOCK_JOB_COMPLETED", qemuMonitorJSONHandleBlockJob, }, + { "SPICE_CONNECTED", qemuMonitorJSONHandleSPICEConnect, }, + { "SPICE_INITIALIZED", qemuMonitorJSONHandleSPICEInitialize, }, + { "SPICE_DISCONNECTED", qemuMonitorJSONHandleSPICEDisconnect, }, };
@@ -624,7 +630,7 @@ VIR_ENUM_IMPL(qemuMonitorGraphicsAddressFamily, VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_LAST, "ipv4", "ipv6", "unix");
-static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, int phase) +static void qemuMonitorJSONHandleGraphics(qemuMonitorPtr mon, virJSONValuePtr data, int phase) { const char *localNode, *localService, *localFamily; const char *remoteNode, *remoteService, *remoteFamily; @@ -643,14 +649,38 @@ static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, i }
authScheme = virJSONValueObjectGetString(server, "auth"); + if (!authScheme) { + VIR_WARN("missing auth scheme in graphics event"); + return; + }
localFamily = virJSONValueObjectGetString(server, "family"); + if (!authScheme) {
s/authScheme/localFamily/
+ VIR_WARN("missing local address family in graphics event"); + return; + } localNode = virJSONValueObjectGetString(server, "host"); + if (!authScheme) {
likewise
+ VIR_WARN("missing local hostname in graphics event"); + return; + } localService = virJSONValueObjectGetString(server, "service"); + if (!localService) + localService = ""; /* Spice has multiple ports, so this isn't provided */
remoteFamily = virJSONValueObjectGetString(client, "family"); + if (!authScheme) {
likewise
+ VIR_WARN("missing remote address family in graphics event"); + return; + } remoteNode = virJSONValueObjectGetString(client, "host"); + if (!authScheme) {
likewise
+ VIR_WARN("missing remote hostname in graphics event"); + return; + } remoteService = virJSONValueObjectGetString(client, "service"); + if (!remoteService) + remoteService = ""; /* Spice has multiple ports, so this isn't provided */
Will we want to parse the specific parameters of spice events? e.g <snip> - "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) </snip> Osier

On Wed, Mar 14, 2012 at 05:06:48PM +0800, Osier Yang wrote:
On 03/14/2012 01:45 PM, Laine Stump wrote:
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).
* src/qemu/qemu_monitor_json.c: Wire up SPICE graphics events --- src/qemu/qemu_monitor_json.c | 56 +++++++++++++++++++++++++++++++++++++++--- 1 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 1a0ee94..a5ef1d4 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -59,6 +59,9 @@ static void qemuMonitorJSONHandleVNCConnect(qemuMonitorPtr mon, virJSONValuePtr static void qemuMonitorJSONHandleVNCInitialize(qemuMonitorPtr mon, virJSONValuePtr data); static void qemuMonitorJSONHandleVNCDisconnect(qemuMonitorPtr mon, virJSONValuePtr data); static void qemuMonitorJSONHandleBlockJob(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEConnect(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEInitialize(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEDisconnect(qemuMonitorPtr mon, virJSONValuePtr data);
static struct { const char *type; @@ -75,6 +78,9 @@ static struct { { "VNC_INITIALIZED", qemuMonitorJSONHandleVNCInitialize, }, { "VNC_DISCONNECTED", qemuMonitorJSONHandleVNCDisconnect, }, { "BLOCK_JOB_COMPLETED", qemuMonitorJSONHandleBlockJob, }, + { "SPICE_CONNECTED", qemuMonitorJSONHandleSPICEConnect, }, + { "SPICE_INITIALIZED", qemuMonitorJSONHandleSPICEInitialize, }, + { "SPICE_DISCONNECTED", qemuMonitorJSONHandleSPICEDisconnect, }, };
@@ -624,7 +630,7 @@ VIR_ENUM_IMPL(qemuMonitorGraphicsAddressFamily, VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_LAST, "ipv4", "ipv6", "unix");
-static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, int phase) +static void qemuMonitorJSONHandleGraphics(qemuMonitorPtr mon, virJSONValuePtr data, int phase) { const char *localNode, *localService, *localFamily; const char *remoteNode, *remoteService, *remoteFamily; @@ -643,14 +649,38 @@ static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, i }
authScheme = virJSONValueObjectGetString(server, "auth"); + if (!authScheme) { + VIR_WARN("missing auth scheme in graphics event"); + return; + }
localFamily = virJSONValueObjectGetString(server, "family"); + if (!authScheme) {
s/authScheme/localFamily/
+ VIR_WARN("missing local address family in graphics event"); + return; + } localNode = virJSONValueObjectGetString(server, "host"); + if (!authScheme) {
likewise
+ VIR_WARN("missing local hostname in graphics event"); + return; + } localService = virJSONValueObjectGetString(server, "service"); + if (!localService) + localService = ""; /* Spice has multiple ports, so this isn't provided */
remoteFamily = virJSONValueObjectGetString(client, "family"); + if (!authScheme) {
likewise
+ VIR_WARN("missing remote address family in graphics event"); + return; + } remoteNode = virJSONValueObjectGetString(client, "host"); + if (!authScheme) {
likewise
+ VIR_WARN("missing remote hostname in graphics event"); + return; + } remoteService = virJSONValueObjectGetString(client, "service"); + if (!remoteService) + remoteService = ""; /* Spice has multiple ports, so this isn't provided */
Will we want to parse the specific parameters of spice events? e.g
<snip> - "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)
and multiple usb redirection channels (which is going to be the usual case, I think the default is 4 right now).
- "tls": whevener the channel is encrypted (json-bool) </snip>
Osier
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 03/14/2012 05:06 AM, Osier Yang wrote:
On 03/14/2012 01:45 PM, Laine Stump wrote:
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).
* src/qemu/qemu_monitor_json.c: Wire up SPICE graphics events --- src/qemu/qemu_monitor_json.c | 56 +++++++++++++++++++++++++++++++++++++++--- 1 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 1a0ee94..a5ef1d4 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -59,6 +59,9 @@ static void qemuMonitorJSONHandleVNCConnect(qemuMonitorPtr mon, virJSONValuePtr static void qemuMonitorJSONHandleVNCInitialize(qemuMonitorPtr mon, virJSONValuePtr data); static void qemuMonitorJSONHandleVNCDisconnect(qemuMonitorPtr mon, virJSONValuePtr data); static void qemuMonitorJSONHandleBlockJob(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEConnect(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEInitialize(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEDisconnect(qemuMonitorPtr mon, virJSONValuePtr data);
static struct { const char *type; @@ -75,6 +78,9 @@ static struct { { "VNC_INITIALIZED", qemuMonitorJSONHandleVNCInitialize, }, { "VNC_DISCONNECTED", qemuMonitorJSONHandleVNCDisconnect, }, { "BLOCK_JOB_COMPLETED", qemuMonitorJSONHandleBlockJob, }, + { "SPICE_CONNECTED", qemuMonitorJSONHandleSPICEConnect, }, + { "SPICE_INITIALIZED", qemuMonitorJSONHandleSPICEInitialize, }, + { "SPICE_DISCONNECTED", qemuMonitorJSONHandleSPICEDisconnect, }, };
@@ -624,7 +630,7 @@ VIR_ENUM_IMPL(qemuMonitorGraphicsAddressFamily, VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_LAST, "ipv4", "ipv6", "unix");
-static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, int phase) +static void qemuMonitorJSONHandleGraphics(qemuMonitorPtr mon, virJSONValuePtr data, int phase) { const char *localNode, *localService, *localFamily; const char *remoteNode, *remoteService, *remoteFamily; @@ -643,14 +649,38 @@ static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, i }
authScheme = virJSONValueObjectGetString(server, "auth"); + if (!authScheme) { + VIR_WARN("missing auth scheme in graphics event"); + return; + }
localFamily = virJSONValueObjectGetString(server, "family"); + if (!authScheme) {
s/authScheme/localFamily/
Oops. That means the original patch in RHEL is also wrong. I'm resending with these fixed.
+ VIR_WARN("missing local address family in graphics event"); + return; + } localNode = virJSONValueObjectGetString(server, "host"); + if (!authScheme) {
likewise
+ VIR_WARN("missing local hostname in graphics event"); + return; + } localService = virJSONValueObjectGetString(server, "service"); + if (!localService) + localService = ""; /* Spice has multiple ports, so this isn't provided */
remoteFamily = virJSONValueObjectGetString(client, "family"); + if (!authScheme) {
likewise
+ VIR_WARN("missing remote address family in graphics event"); + return; + } remoteNode = virJSONValueObjectGetString(client, "host"); + if (!authScheme) {
likewise
+ VIR_WARN("missing remote hostname in graphics event"); + return; + } remoteService = virJSONValueObjectGetString(client, "service"); + if (!remoteService) + remoteService = ""; /* Spice has multiple ports, so this isn't provided */
Will we want to parse the specific parameters of spice events? e.g
If we do, that will be a separate patch. The intent here is to bring upstream to parity with the RHEL build.
<snip> - "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) </snip>

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). * src/qemu/qemu_monitor_json.c: Wire up SPICE graphics events --- V2: fix copy-paste typos checking for wrong strings. Not adding any interpretation of parameters, as this patch is just achieving parity with RHEL-specific build. src/qemu/qemu_monitor_json.c | 56 +++++++++++++++++++++++++++++++++++++++--- 1 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 1a0ee94..ce68e69 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -59,6 +59,9 @@ static void qemuMonitorJSONHandleVNCConnect(qemuMonitorPtr mon, virJSONValuePtr static void qemuMonitorJSONHandleVNCInitialize(qemuMonitorPtr mon, virJSONValuePtr data); static void qemuMonitorJSONHandleVNCDisconnect(qemuMonitorPtr mon, virJSONValuePtr data); static void qemuMonitorJSONHandleBlockJob(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEConnect(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEInitialize(qemuMonitorPtr mon, virJSONValuePtr data); +static void qemuMonitorJSONHandleSPICEDisconnect(qemuMonitorPtr mon, virJSONValuePtr data); static struct { const char *type; @@ -75,6 +78,9 @@ static struct { { "VNC_INITIALIZED", qemuMonitorJSONHandleVNCInitialize, }, { "VNC_DISCONNECTED", qemuMonitorJSONHandleVNCDisconnect, }, { "BLOCK_JOB_COMPLETED", qemuMonitorJSONHandleBlockJob, }, + { "SPICE_CONNECTED", qemuMonitorJSONHandleSPICEConnect, }, + { "SPICE_INITIALIZED", qemuMonitorJSONHandleSPICEInitialize, }, + { "SPICE_DISCONNECTED", qemuMonitorJSONHandleSPICEDisconnect, }, }; @@ -624,7 +630,7 @@ VIR_ENUM_IMPL(qemuMonitorGraphicsAddressFamily, VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_LAST, "ipv4", "ipv6", "unix"); -static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, int phase) +static void qemuMonitorJSONHandleGraphics(qemuMonitorPtr mon, virJSONValuePtr data, int phase) { const char *localNode, *localService, *localFamily; const char *remoteNode, *remoteService, *remoteFamily; @@ -643,14 +649,38 @@ static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, i } authScheme = virJSONValueObjectGetString(server, "auth"); + if (!authScheme) { + VIR_WARN("missing auth scheme in graphics event"); + return; + } localFamily = virJSONValueObjectGetString(server, "family"); + if (!localFamily) { + VIR_WARN("missing local address family in graphics event"); + return; + } localNode = virJSONValueObjectGetString(server, "host"); + if (!localNode) { + VIR_WARN("missing local hostname in graphics event"); + return; + } localService = virJSONValueObjectGetString(server, "service"); + if (!localService) + localService = ""; /* Spice has multiple ports, so this isn't provided */ remoteFamily = virJSONValueObjectGetString(client, "family"); + if (!remoteFamily) { + VIR_WARN("missing remote address family in graphics event"); + return; + } remoteNode = virJSONValueObjectGetString(client, "host"); + if (!remoteNode) { + VIR_WARN("missing remote hostname in graphics event"); + return; + } remoteService = virJSONValueObjectGetString(client, "service"); + if (!remoteService) + remoteService = ""; /* Spice has multiple ports, so this isn't provided */ saslUsername = virJSONValueObjectGetString(client, "sasl_username"); x509dname = virJSONValueObjectGetString(client, "x509_dname"); @@ -672,19 +702,37 @@ static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, i static void qemuMonitorJSONHandleVNCConnect(qemuMonitorPtr mon, virJSONValuePtr data) { - qemuMonitorJSONHandleVNC(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_CONNECT); + qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_CONNECT); } static void qemuMonitorJSONHandleVNCInitialize(qemuMonitorPtr mon, virJSONValuePtr data) { - qemuMonitorJSONHandleVNC(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE); + qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE); } static void qemuMonitorJSONHandleVNCDisconnect(qemuMonitorPtr mon, virJSONValuePtr data) { - qemuMonitorJSONHandleVNC(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT); + qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT); +} + + +static void qemuMonitorJSONHandleSPICEConnect(qemuMonitorPtr mon, virJSONValuePtr data) +{ + qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_CONNECT); +} + + +static void qemuMonitorJSONHandleSPICEInitialize(qemuMonitorPtr mon, virJSONValuePtr data) +{ + qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE); +} + + +static void qemuMonitorJSONHandleSPICEDisconnect(qemuMonitorPtr mon, virJSONValuePtr data) +{ + qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT); } static void qemuMonitorJSONHandleBlockJob(qemuMonitorPtr mon, virJSONValuePtr data) -- 1.7.7.6

On 03/14/2012 11:05 PM, Laine Stump wrote:
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).
* src/qemu/qemu_monitor_json.c: Wire up SPICE graphics events ---
V2: fix copy-paste typos checking for wrong strings. Not adding any interpretation of parameters, as this patch is just achieving parity with RHEL-specific build.
ACK then. Osier

On 03/15/2012 12:19 AM, Osier Yang wrote:
On 03/14/2012 11:05 PM, Laine Stump wrote:
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).
* src/qemu/qemu_monitor_json.c: Wire up SPICE graphics events ---
V2: fix copy-paste typos checking for wrong strings. Not adding any interpretation of parameters, as this patch is just achieving parity with RHEL-specific build.
ACK then.
Okay. I pushed it. Thanks!
participants (3)
-
Alon Levy
-
Laine Stump
-
Osier Yang