[pve-devel] [PATCH] add spice support

Alexandre Derumier aderumier at odiso.com
Wed Apr 10 13:06:23 CEST 2013


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 debian/control                    |    4 +-
 debian/patches/series             |    1 +
 debian/patches/spice-socket.patch |  107 +++++++++++++++++++++++++++++++++++++
 debian/rules                      |    2 +-
 4 files changed, 111 insertions(+), 3 deletions(-)
 create mode 100644 debian/patches/spice-socket.patch

diff --git a/debian/control b/debian/control
index d9867a0..b417347 100644
--- a/debian/control
+++ b/debian/control
@@ -2,12 +2,12 @@ Source: pve-qemu-kvm
 Section: admin
 Priority: extra
 Maintainer: Proxmox Support Team <support at proxmox.com>
-Build-Depends: debhelper (>= 5), autotools-dev, libpci-dev, quilt, texinfo, texi2html, libgnutls-dev, libsdl1.2-dev, check, libaio-dev, uuid-dev, librbd-dev (>= 0.48), libiscsi-dev (>= 1.5.0)
+Build-Depends: debhelper (>= 5), autotools-dev, libpci-dev, quilt, texinfo, texi2html, libgnutls-dev, libsdl1.2-dev, check, libaio-dev, uuid-dev, librbd-dev (>= 0.48), libiscsi-dev (>= 1.5.0), libspice-protocol-dev (>= 0.12.3), libspice-server-dev (>= 0.12.2)
 Standards-Version: 3.7.2
 
 Package: pve-qemu-kvm
 Architecture: any
-Depends: iproute, bridge-utils, python, libsdl1.2debian, libaio1, libuuid1, ceph-common (>= 0.48), libiscsi1 (>= 1.5.0), ${shlibs:Depends}, ${misc:Depends}
+Depends: iproute, bridge-utils, python, libsdl1.2debian, libaio1, libuuid1, ceph-common (>= 0.48), libiscsi1 (>= 1.5.0), libspice-server1:amd64 (>= 0.12.2),  ${shlibs:Depends}, ${misc:Depends}
 Conflicts: qemu, qemu-kvm, kvm, pve-kvm, pve-qemu-kvm-2.6.18
 Replaces: pve-kvm, pve-qemu-kvm-2.6.18
 Description: Full virtualization on x86 hardware
diff --git a/debian/patches/series b/debian/patches/series
index ed1ef4a..4565e97 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -21,3 +21,4 @@ enable-kvm-by-default.patch
 # always-update-expected-downtime.patch
 virtio-balloon-fix-query.patch
 set-cpu-model-to-kvm64.patch
+spice-socket.patch
diff --git a/debian/patches/spice-socket.patch b/debian/patches/spice-socket.patch
new file mode 100644
index 0000000..00175c5
--- /dev/null
+++ b/debian/patches/spice-socket.patch
@@ -0,0 +1,107 @@
+From ea2bd3a49ab04110cde4e71d9afafcf5d93db909 Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier at odiso.com>
+Date: Mon, 8 Apr 2013 12:42:48 +0200
+Subject: [PATCH 1/2] Add spice support for unix socket option
+
+
+Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
+---
+ qemu-options.hx |    5 ++++-
+ ui/spice-core.c |   22 +++++++++++++++++++---
+ 2 files changed, 23 insertions(+), 4 deletions(-)
+
+diff --git a/qemu-options.hx b/qemu-options.hx
+index 06b6e58..37d271a 100644
+--- a/qemu-options.hx
++++ b/qemu-options.hx
+@@ -887,7 +887,7 @@ Enable SDL.
+ ETEXI
+ 
+ DEF("spice", HAS_ARG, QEMU_OPTION_spice,
+-    "-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]\n"
++    "-spice [port=port][,tls-port=secured-port][,unix=<sock>][,x509-dir=<dir>]\n"
+     "       [,x509-key-file=<file>][,x509-key-password=<file>]\n"
+     "       [,x509-cert-file=<file>][,x509-cacert-file=<file>]\n"
+     "       [,x509-dh-key-file=<file>][,addr=addr][,ipv4|ipv6]\n"
+@@ -911,6 +911,9 @@ Enable the spice remote desktop protocol. Valid options are
+ 
+ @table @option
+ 
++ at item unix=<sock>
++Path on which to bind a UNIX socket.
++
+ @item port=<nr>
+ Set the TCP port spice is listening on for plaintext channels.
+ 
+diff --git a/ui/spice-core.c b/ui/spice-core.c
+index bcc4199..acc1626 100644
+--- a/ui/spice-core.c
++++ b/ui/spice-core.c
+@@ -39,6 +39,8 @@
+ #include "hw/hw.h"
+ #include "ui/spice-display.h"
+ 
++static const int on=1, off=0;
++
+ /* core bits */
+ 
+ static SpiceServer *spice_server;
+@@ -428,6 +430,9 @@ static QemuOptsList qemu_spice_opts = {
+             .name = "tls-port",
+             .type = QEMU_OPT_NUMBER,
+         },{
++            .name = "unix",
++            .type = QEMU_OPT_STRING,
++        },{
+             .name = "addr",
+             .type = QEMU_OPT_STRING,
+         },{
+@@ -640,16 +645,18 @@ void qemu_spice_init(void)
+     spice_image_compression_t compression;
+     spice_wan_compression_t wan_compr;
+     bool seamless_migration;
++    const char *unix_socket;
+ 
+     qemu_thread_get_self(&me);
+ 
+     if (!opts) {
+         return;
+     }
++    unix_socket = qemu_opt_get(opts, "unix");
+     port = qemu_opt_get_number(opts, "port", 0);
+     tls_port = qemu_opt_get_number(opts, "tls-port", 0);
+-    if (!port && !tls_port) {
+-        error_report("neither port nor tls-port specified for spice");
++    if (!port && !tls_port && !unix_socket) {
++        error_report("neither sock, port nor tls-port specified for spice");
+         exit(1);
+     }
+     if (port < 0 || port > 65535) {
+@@ -705,7 +712,6 @@ void qemu_spice_init(void)
+     } else if (qemu_opt_get_bool(opts, "ipv6", 0)) {
+         addr_flags |= SPICE_ADDR_FLAG_IPV6_ONLY;
+     }
+-
+     spice_server = spice_server_new();
+     spice_server_set_addr(spice_server, addr ? addr : "", addr_flags);
+     if (port) {
+@@ -720,6 +726,16 @@ void qemu_spice_init(void)
+                              x509_dh_file,
+                              tls_ciphers);
+     }
++    if (unix_socket) {
++        char *dpy;
++        int lsock;
++        dpy = g_malloc(256);
++        pstrcpy(dpy, 256, unix_socket);
++        Error *local_err = NULL;
++        lsock = unix_listen(unix_socket, dpy, 256, &local_err);
++        setsockopt(lsock, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on));
++        spice_server_set_listen_socket_fd(spice_server, lsock);
++    }
+     if (password) {
+         spice_server_set_ticket(spice_server, password, 0, 0, 0);
+     }
+-- 
+1.7.10.4
+
diff --git a/debian/rules b/debian/rules
index 762159d..05acf25 100755
--- a/debian/rules
+++ b/debian/rules
@@ -33,7 +33,7 @@ endif
 config.status: configure
 	dh_testdir
 	# Add here commands to configure the package.
-	./configure --with-confsuffix="/kvm" --target-list=x86_64-softmmu --prefix=/usr --datadir=/usr/share --docdir=/usr/share/doc/pve-qemu-kvm --sysconfdir=/etc --disable-xen --enable-vnc-tls --enable-sdl --enable-uuid --enable-linux-aio --enable-rbd --enable-libiscsi --disable-smartcard-nss --audio-drv-list="alsa"
+	./configure --with-confsuffix="/kvm" --target-list=x86_64-softmmu --prefix=/usr --datadir=/usr/share --docdir=/usr/share/doc/pve-qemu-kvm --sysconfdir=/etc --disable-xen --enable-vnc-tls --enable-sdl --enable-uuid --enable-linux-aio --enable-rbd --enable-libiscsi --disable-smartcard-nss --audio-drv-list="alsa" --enable-spice
 
 build: patch build-stamp
 
-- 
1.7.10.4



More information about the pve-devel mailing list