mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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
This commit is contained in:
parent
d86120fc52
commit
89ae6a5a30
@ -59,6 +59,9 @@ static void qemuMonitorJSONHandleVNCConnect(qemuMonitorPtr mon, virJSONValuePtr
|
|||||||
static void qemuMonitorJSONHandleVNCInitialize(qemuMonitorPtr mon, virJSONValuePtr data);
|
static void qemuMonitorJSONHandleVNCInitialize(qemuMonitorPtr mon, virJSONValuePtr data);
|
||||||
static void qemuMonitorJSONHandleVNCDisconnect(qemuMonitorPtr mon, virJSONValuePtr data);
|
static void qemuMonitorJSONHandleVNCDisconnect(qemuMonitorPtr mon, virJSONValuePtr data);
|
||||||
static void qemuMonitorJSONHandleBlockJob(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 {
|
static struct {
|
||||||
const char *type;
|
const char *type;
|
||||||
@ -75,6 +78,9 @@ static struct {
|
|||||||
{ "VNC_INITIALIZED", qemuMonitorJSONHandleVNCInitialize, },
|
{ "VNC_INITIALIZED", qemuMonitorJSONHandleVNCInitialize, },
|
||||||
{ "VNC_DISCONNECTED", qemuMonitorJSONHandleVNCDisconnect, },
|
{ "VNC_DISCONNECTED", qemuMonitorJSONHandleVNCDisconnect, },
|
||||||
{ "BLOCK_JOB_COMPLETED", qemuMonitorJSONHandleBlockJob, },
|
{ "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,
|
VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_LAST,
|
||||||
"ipv4", "ipv6", "unix");
|
"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 *localNode, *localService, *localFamily;
|
||||||
const char *remoteNode, *remoteService, *remoteFamily;
|
const char *remoteNode, *remoteService, *remoteFamily;
|
||||||
@ -643,14 +649,38 @@ static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
authScheme = virJSONValueObjectGetString(server, "auth");
|
authScheme = virJSONValueObjectGetString(server, "auth");
|
||||||
|
if (!authScheme) {
|
||||||
|
VIR_WARN("missing auth scheme in graphics event");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
localFamily = virJSONValueObjectGetString(server, "family");
|
localFamily = virJSONValueObjectGetString(server, "family");
|
||||||
|
if (!localFamily) {
|
||||||
|
VIR_WARN("missing local address family in graphics event");
|
||||||
|
return;
|
||||||
|
}
|
||||||
localNode = virJSONValueObjectGetString(server, "host");
|
localNode = virJSONValueObjectGetString(server, "host");
|
||||||
|
if (!localNode) {
|
||||||
|
VIR_WARN("missing local hostname in graphics event");
|
||||||
|
return;
|
||||||
|
}
|
||||||
localService = virJSONValueObjectGetString(server, "service");
|
localService = virJSONValueObjectGetString(server, "service");
|
||||||
|
if (!localService)
|
||||||
|
localService = ""; /* Spice has multiple ports, so this isn't provided */
|
||||||
|
|
||||||
remoteFamily = virJSONValueObjectGetString(client, "family");
|
remoteFamily = virJSONValueObjectGetString(client, "family");
|
||||||
|
if (!remoteFamily) {
|
||||||
|
VIR_WARN("missing remote address family in graphics event");
|
||||||
|
return;
|
||||||
|
}
|
||||||
remoteNode = virJSONValueObjectGetString(client, "host");
|
remoteNode = virJSONValueObjectGetString(client, "host");
|
||||||
|
if (!remoteNode) {
|
||||||
|
VIR_WARN("missing remote hostname in graphics event");
|
||||||
|
return;
|
||||||
|
}
|
||||||
remoteService = virJSONValueObjectGetString(client, "service");
|
remoteService = virJSONValueObjectGetString(client, "service");
|
||||||
|
if (!remoteService)
|
||||||
|
remoteService = ""; /* Spice has multiple ports, so this isn't provided */
|
||||||
|
|
||||||
saslUsername = virJSONValueObjectGetString(client, "sasl_username");
|
saslUsername = virJSONValueObjectGetString(client, "sasl_username");
|
||||||
x509dname = virJSONValueObjectGetString(client, "x509_dname");
|
x509dname = virJSONValueObjectGetString(client, "x509_dname");
|
||||||
@ -672,19 +702,37 @@ static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, i
|
|||||||
|
|
||||||
static void qemuMonitorJSONHandleVNCConnect(qemuMonitorPtr mon, virJSONValuePtr data)
|
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)
|
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)
|
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)
|
static void qemuMonitorJSONHandleBlockJob(qemuMonitorPtr mon, virJSONValuePtr data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user