[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] better support for vnc in qemu device model:
ChangeSet 1.1515.1.1, 2005/05/23 19:51:45+01:00, rneugeba@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx better support for vnc in qemu device model: - different ports for different VMs - allow reverse connect to a running viewer Signed-off-by: Rolf Neugebauer <rolf.neugebauer@xxxxxxxxx> ioemu/Makefile | 2 - ioemu/target-i386-dm/Makefile | 3 ++ ioemu/target-i386-dm/device-model | 18 ++++++++++++- ioemu/vl.c | 30 +++++++++++++++++++--- ioemu/vl.h | 3 +- ioemu/vnc.c | 50 +++++++++++++++++++++++++++++++++++++- python/xen/xend/XendDomainInfo.py | 20 ++++++++++++++- python/xen/xm/create.py | 3 +- 8 files changed, 118 insertions(+), 11 deletions(-) diff -Nru a/tools/ioemu/Makefile b/tools/ioemu/Makefile --- a/tools/ioemu/Makefile 2005-05-23 17:01:46 -04:00 +++ b/tools/ioemu/Makefile 2005-05-23 17:01:46 -04:00 @@ -42,7 +42,7 @@ rm -f config-host.mak config-host.h rm -f keysym_adapter_sdl.h keysym_adapter_vnc.h for d in $(TARGET_DIRS); do \ - rm -rf $$d || exit 1 ; \ + $(MAKE) -C $$d $@ || exit 1 ; \ done KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ diff -Nru a/tools/ioemu/target-i386-dm/Makefile b/tools/ioemu/target-i386-dm/Makefile --- a/tools/ioemu/target-i386-dm/Makefile 2005-05-23 17:01:46 -04:00 +++ b/tools/ioemu/target-i386-dm/Makefile 2005-05-23 17:01:46 -04:00 @@ -378,6 +378,9 @@ clean: rm -rf *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe slirp qemu-vgaram-bin +distclean: + rm -rf *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe slirp qemu-vgaram-bin + install: all if [ ! -d $(DESTDIR)$(bindir) ];then mkdir -p $(DESTDIR)$(bindir);fi if [ ! -d $(DESTDIR)$(configdir) ];then mkdir -p $(DESTDIR)$(configdir);fi diff -Nru a/tools/ioemu/target-i386-dm/device-model b/tools/ioemu/target-i386-dm/device-model --- a/tools/ioemu/target-i386-dm/device-model 2005-05-23 17:01:46 -04:00 +++ b/tools/ioemu/target-i386-dm/device-model 2005-05-23 17:01:46 -04:00 @@ -10,13 +10,22 @@ #gdb --args /usr/sbin/qemu-dm -hda /var/images/qemu-linux.img -nographic \ # -serial pty -l 'ioport,int' $* -while getopts ":f:" opt; +# XXX this is a bit skanky. we assume an order of arguments here. +# namely to have configfile and vncconnect argument as the first +# two arguments. + +while getopts ":f:v:d:" opt; do case $opt in - f) QEMUCONFIGFILE=$OPTARG;shift;shift;; + f) QEMUCONFIGFILE=$OPTARG;; + v) VNCCONNECT=$OPTARG;; + d) DOMAIN=$OPTARG;; \?) echo;; esac done +if [ "x$QEMUCONFIGFILE" != "x" ]; then shift; shift; fi +if [ "x$VNCCONNECT" != "x" ]; then shift; shift; fi + echo $QEMUCONFIGFILE if [ ! -z $QEMUCONFIGFILE ];then @@ -57,6 +66,11 @@ elif [ $vnc -eq 1 ];then PARMETER="$PARMETER -vnc -k en-us" fi + VNCPORT=`expr 5900 + $DOMAIN` + PARMETER="$PARMETER -vncport $VNCPORT" + if [ "x$VNCCONNECT" != "x" ]; then + PARMETER="$PARMETER -vncconnect $VNCCONNECT" + fi fi #optional cmdline for qemu diff -Nru a/tools/ioemu/vl.c b/tools/ioemu/vl.c --- a/tools/ioemu/vl.c 2005-05-23 17:01:47 -04:00 +++ b/tools/ioemu/vl.c 2005-05-23 17:01:47 -04:00 @@ -110,6 +110,8 @@ static DisplayState display_state; int nographic; int usevnc; /* 1=vnc only, 2=vnc and sdl */ +long vncport; /* server port */ +const char* vncconnect; /* do a reverse connect to this host*/ const char* keyboard_layout = 0; int64_t ticks_per_sec; int boot_device = 'c'; @@ -2098,7 +2100,9 @@ "-m megs set virtual RAM size to megs MB [default=%d]\n" "-nographic disable graphical output and redirect serial I/Os to console\n" #ifdef CONFIG_VNC - "-vnc use vnc instead of sdl\n" + "-vnc port use vnc instead of sdl\n" + "-vncport port use a different port\n" + "-vncconnect host:port do a reverse connect\n" #ifdef CONFIG_SDL "-vnc-and-sdl use vnc and sdl simultaneously\n" #endif @@ -2194,6 +2198,8 @@ QEMU_OPTION_nographic, #ifdef CONFIG_VNC QEMU_OPTION_vnc, + QEMU_OPTION_vncport, + QEMU_OPTION_vncconnect, #ifdef CONFIG_SDL QEMU_OPTION_vnc_and_sdl, #endif @@ -2258,6 +2264,8 @@ { "nographic", 0, QEMU_OPTION_nographic }, #ifdef CONFIG_VNC { "vnc", 0, QEMU_OPTION_vnc }, + { "vncport", HAS_ARG, QEMU_OPTION_vncport }, + { "vncconnect", HAS_ARG, QEMU_OPTION_vncconnect }, #ifdef CONFIG_SDL { "vnc-and-sdl", 0, QEMU_OPTION_vnc_and_sdl }, #endif @@ -2370,6 +2378,8 @@ snapshot = 0; nographic = 0; usevnc = 0; + vncport=0; + vncconnect=NULL; kernel_filename = NULL; kernel_cmdline = ""; has_cdrom = 1; @@ -2464,8 +2474,20 @@ break; #ifdef CONFIG_VNC case QEMU_OPTION_vnc: - usevnc = 1; - break; + usevnc = 1; + break; + case QEMU_OPTION_vncport: + { + const char *p; + p = optarg; + vncport= strtol(optarg, (char **)&p, 0); + } + break; + case QEMU_OPTION_vncconnect: + { + vncconnect=optarg; + } + break; #ifdef CONFIG_SDL case QEMU_OPTION_vnc_and_sdl: usevnc = 2; @@ -2852,7 +2874,7 @@ } else { if (usevnc) { #ifdef CONFIG_VNC - vnc_display_init(ds, (usevnc==2)); + vnc_display_init(ds, (usevnc==2), vncport, vncconnect); #else perror("qemu not configured with vnc support"); #endif diff -Nru a/tools/ioemu/vl.h b/tools/ioemu/vl.h --- a/tools/ioemu/vl.h 2005-05-23 17:01:46 -04:00 +++ b/tools/ioemu/vl.h 2005-05-23 17:01:46 -04:00 @@ -537,7 +537,8 @@ void vga_screen_dump(const char *filename); /* vnc.c */ -void vnc_display_init(DisplayState *ds, int useAlsoSDL); +void vnc_display_init(DisplayState *ds, int useAlsoSDL, + long port, const char* connect); /* cirrus_vga.c */ void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base, diff -Nru a/tools/ioemu/vnc.c b/tools/ioemu/vnc.c --- a/tools/ioemu/vnc.c 2005-05-23 17:01:46 -04:00 +++ b/tools/ioemu/vnc.c 2005-05-23 17:01:46 -04:00 @@ -21,6 +21,15 @@ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. + * + * + * reverse connection setup copied from x11vnc.c + * Copyright (c) 2002-2005 Karl J. Runge <runge@xxxxxxxxxxxxx> + * All rights reserved. + * based on: + * the originial x11vnc.c in libvncserver (Johannes E. Schindelin) + * x0rfbserver, the original native X vnc server (Jens Wagner) + * krfb, the KDE desktopsharing project (Tim Jansen) */ #include "vl.h" @@ -447,8 +456,15 @@ rfbScreenCleanup(screen); } -void vnc_display_init(DisplayState *ds, int useAlsoSDL) + +void vnc_display_init(DisplayState *ds, int useAlsoSDL, + long port, const char* connect) { + int len, rport = 5500; + char host[1024]; + char *p; + rfbClientPtr cl; + if(!keyboard_layout) { fprintf(stderr, "No keyboard language specified\n"); exit(1); @@ -460,6 +476,7 @@ exit(1); } + mouse_magic=init_mouse_magic(); register_savevm("vnc", 0, 1, vnc_save, vnc_load, mouse_magic); @@ -470,6 +487,7 @@ exit(1); } + screen->serverFormat.redShift = 11; screen->serverFormat.greenShift = 5; screen->serverFormat.blueShift = 0; @@ -477,6 +495,11 @@ screen->serverFormat.greenMax = 63; screen->serverFormat.blueMax = 31; + if (port != 0) + screen->port = port; + else + screen->autoPort = TRUE; + if(useAlsoSDL) { ds_sdl=(DisplayState*)malloc(sizeof(DisplayState)); sdl_display_init(ds_sdl,0); @@ -496,6 +519,31 @@ ds->dpy_resize = vnc_resize; ds->dpy_refresh = vnc_refresh; + /* deal with reverse connections */ + if ( connect == NULL || (len = strlen(connect)) < 1) { + return; + } + if ( len > 1024 ) { + fprintf(stderr, "vnc reverse connect name too long\n"); + exit(1); + } + strncpy(host, connect, len); + host[len] = '\0'; + /* extract port, if any */ + if ((p = strchr(host, ':')) != NULL) { + rport = atoi(p+1); + *p = '\0'; + } + cl = rfbReverseConnection(screen, host, rport); + if (cl == NULL) { + fprintf(stderr, "reverse_connect: %s failed\n", connect); + } else { + fprintf(stderr, "reverse_connect: %s/%s OK\n", connect, cl->host); + } + _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |