On 29.04.2013 16:52, Martin Kletzander wrote:
Adding a VNC WebSocket support for QEMU driver. This funcitonality
is
in upstream qemu from commit described as v1.3.0-982-g7536ee4, so the
capability is being recognized based on QEMU version for now.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/libvirtd_qemu.aug | 4 +-
src/qemu/qemu.conf | 7 +++
src/qemu/qemu_capabilities.c | 5 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 60 +++++++++++++++++++++-
src/qemu/qemu_command.h | 5 +-
src/qemu/qemu_conf.c | 32 ++++++++++++
src/qemu/qemu_conf.h | 6 +++
src/qemu/qemu_driver.c | 5 ++
src/qemu/qemu_process.c | 31 ++++++++---
src/qemu/test_libvirtd_qemu.aug.in | 2 +
tests/qemuargv2xmltest.c | 1 +
.../qemuxml2argv-graphics-vnc-websocket.args | 4 ++
.../qemuxml2argv-graphics-vnc-websocket.xml | 35 +++++++++++++
tests/qemuxml2argvtest.c | 1 +
tests/qemuxml2xmltest.c | 1 +
16 files changed, 190 insertions(+), 10 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-websocket.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-websocket.xml
diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index 61740a9..5344125 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -41,6 +41,8 @@ module Libvirtd_qemu =
let remote_display_entry = int_entry "remote_display_port_min"
| int_entry "remote_display_port_max"
+ | int_entry "remote_websocket_port_min"
+ | int_entry "remote_websocket_port_max"
let security_entry = str_entry "security_driver"
| bool_entry "security_default_confined"
@@ -74,7 +76,7 @@ module Libvirtd_qemu =
| int_entry "keepalive_interval"
| int_entry "keepalive_count"
- (* Each enty in the config is one of the following three ... *)
+ (* Each entry in the config is one of the following ... *)
Typo worth 1.0.5 release.
let entry = vnc_entry
| spice_entry
| remote_display_entry
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 87bdf70..809e254 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -153,6 +153,13 @@
#remote_display_port_min = 5900
#remote_display_port_max = 65535
+# VNC WebSocket port policies, same rules apply as with remote display
+# ports. VNC WebSockets use similar display <-> port mappings, with
+# the exception being that ports starts from 5700 instead of 5900.
+# This is what may have be changed here.
+#
+#remote_websocket_port_min = 5700
+#remote_websocket_port_max = 65535
# The default security driver is SELinux. If SELinux is disabled
# on the host, then the security driver will automatically disable
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 2acf535..2ddeb8c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -225,6 +225,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"pci-bridge", /* 141 */
"vfio-pci", /* 142 */
"vfio-pci.bootindex", /* 143 */
+ "vnc-websocket", /* 143 */
);
struct _virQEMUCaps {
@@ -2520,6 +2521,10 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
if (qemuCaps->version >= 1003000)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_USB_OPT);
+ /* WebSockets were intriduced between 1.3.0 and 1.3.1 */
s/intriduced/introduced/
+ if (qemuCaps->version >= 1003001)
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_WEBSOCKET);
+
if (!(archstr = qemuMonitorGetTargetArch(mon)))
goto cleanup;
Michal