WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] merge with xen-unstable.hg

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] merge with xen-unstable.hg
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 09 Aug 2006 22:20:55 +0000
Delivery-date: Wed, 09 Aug 2006 15:26:51 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID fc6c3d866477a2a7454ba032281744b534d78bf8
# Parent  111936ef42911810bc4e9f474130990ad2b6f192
# Parent  15304ad81c5068e0d4115623cf063c62add22407
merge with xen-unstable.hg
---
 tools/examples/xmexample.hvm                     |    4 
 tools/ioemu/patches/domain-timeoffset            |    8 -
 tools/ioemu/patches/series                       |    1 
 tools/ioemu/patches/vnc-display-find-unused      |  101 +++++++++++++++++++++++
 tools/ioemu/patches/xen-support-buffered-ioreqs  |    8 -
 tools/ioemu/patches/xenstore-block-device-config |   45 +++++-----
 tools/ioemu/patches/xenstore-write-vnc-port      |   10 +-
 tools/ioemu/vl.c                                 |   12 ++
 tools/ioemu/vl.h                                 |    2 
 tools/ioemu/vnc.c                                |   17 ++-
 tools/python/xen/xend/image.py                   |    3 
 tools/python/xen/xm/create.py                    |    7 +
 12 files changed, 174 insertions(+), 44 deletions(-)

diff -r 111936ef4291 -r fc6c3d866477 tools/examples/xmexample.hvm
--- a/tools/examples/xmexample.hvm      Wed Aug 09 10:04:43 2006 -0600
+++ b/tools/examples/xmexample.hvm      Wed Aug 09 10:32:23 2006 -0600
@@ -130,6 +130,10 @@ vnc=1
 #vncdisplay=1
 
 #----------------------------------------------------------------------------
+# try to find an unused port for the VNC server, default = 1
+#vncunused=1
+
+#----------------------------------------------------------------------------
 # enable spawning vncviewer for domain's console
 # (only valid when vnc=1), default = 0
 #vncconsole=0
diff -r 111936ef4291 -r fc6c3d866477 tools/ioemu/patches/domain-timeoffset
--- a/tools/ioemu/patches/domain-timeoffset     Wed Aug 09 10:04:43 2006 -0600
+++ b/tools/ioemu/patches/domain-timeoffset     Wed Aug 09 10:32:23 2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/hw/mc146818rtc.c
 Index: ioemu/hw/mc146818rtc.c
 ===================================================================
---- ioemu.orig/hw/mc146818rtc.c        2006-08-08 11:27:33.924822567 +0100
-+++ ioemu/hw/mc146818rtc.c     2006-08-08 11:28:01.929698228 +0100
+--- ioemu.orig/hw/mc146818rtc.c        2006-08-09 15:04:17.857242121 +0100
++++ ioemu/hw/mc146818rtc.c     2006-08-09 15:04:24.588603423 +0100
 @@ -178,10 +178,27 @@
      }
  }
@@ -46,8 +46,8 @@ Index: ioemu/hw/mc146818rtc.c
  static void rtc_copy_date(RTCState *s)
 Index: ioemu/hw/pc.c
 ===================================================================
---- ioemu.orig/hw/pc.c 2006-08-08 11:27:58.117123572 +0100
-+++ ioemu/hw/pc.c      2006-08-08 11:28:01.930698117 +0100
+--- ioemu.orig/hw/pc.c 2006-08-09 15:04:24.316629266 +0100
++++ ioemu/hw/pc.c      2006-08-09 15:04:24.589603328 +0100
 @@ -159,7 +159,7 @@
  }
  
@@ -117,8 +117,8 @@ Index: ioemu/hw/pc.c
  QEMUMachine pc_machine = {
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-08-08 11:28:01.787714069 +0100
-+++ ioemu/vl.c 2006-08-08 11:28:01.933697782 +0100
+--- ioemu.orig/vl.c    2006-08-09 15:04:24.457615869 +0100
++++ ioemu/vl.c 2006-08-09 15:04:24.592603043 +0100
 @@ -163,6 +163,8 @@
  
  int xc_handle;
@@ -174,8 +174,8 @@ Index: ioemu/vl.c
      if (usb_enabled) {
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-08-08 11:28:01.517744187 +0100
-+++ ioemu/vl.h 2006-08-08 11:28:01.934697671 +0100
+--- ioemu.orig/vl.h    2006-08-09 15:04:24.321628791 +0100
++++ ioemu/vl.h 2006-08-09 15:04:24.593602948 +0100
 @@ -575,7 +575,7 @@
                                   int boot_device,
               DisplayState *ds, const char **fd_filename, int snapshot,
diff -r 111936ef4291 -r fc6c3d866477 tools/ioemu/patches/series
--- a/tools/ioemu/patches/series        Wed Aug 09 10:04:43 2006 -0600
+++ b/tools/ioemu/patches/series        Wed Aug 09 10:32:23 2006 -0600
@@ -34,6 +34,7 @@ vnc-start-vncviewer
 vnc-start-vncviewer
 vnc-title-domain-name
 vnc-access-monitor-vt
+vnc-display-find-unused
 xenstore-block-device-config
 xenstore-write-vnc-port
 qemu-allow-disable-sdl
diff -r 111936ef4291 -r fc6c3d866477 
tools/ioemu/patches/xen-support-buffered-ioreqs
--- a/tools/ioemu/patches/xen-support-buffered-ioreqs   Wed Aug 09 10:04:43 
2006 -0600
+++ b/tools/ioemu/patches/xen-support-buffered-ioreqs   Wed Aug 09 10:32:23 
2006 -0600
@@ -1,8 +1,8 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-08-08 14:33:30.000000000 +0100
-+++ ioemu/vl.c 2006-08-08 14:43:34.000000000 +0100
-@@ -5834,6 +5834,7 @@
+--- ioemu.orig/vl.c    2006-08-09 15:04:25.583508863 +0100
++++ ioemu/vl.c 2006-08-09 15:04:26.034465993 +0100
+@@ -5838,6 +5838,7 @@
      unsigned long nr_pages;
      xen_pfn_t *page_array;
      extern void *shared_page;
@@ -10,7 +10,7 @@ Index: ioemu/vl.c
  
      char qemu_dm_logfilename[64];
  
-@@ -6378,12 +6379,17 @@
+@@ -6388,12 +6389,17 @@
  
      phys_ram_base = xc_map_foreign_batch(xc_handle, domid,
                                           PROT_READ|PROT_WRITE, page_array,
@@ -31,8 +31,8 @@ Index: ioemu/vl.c
                                         page_array[nr_pages - 1]);
 Index: ioemu/target-i386-dm/helper2.c
 ===================================================================
---- ioemu.orig/target-i386-dm/helper2.c        2006-08-08 14:33:30.000000000 
+0100
-+++ ioemu/target-i386-dm/helper2.c     2006-08-09 10:03:40.558744653 +0100
+--- ioemu.orig/target-i386-dm/helper2.c        2006-08-09 15:04:24.105649313 
+0100
++++ ioemu/target-i386-dm/helper2.c     2006-08-09 15:04:26.040465422 +0100
 @@ -76,6 +76,10 @@
  
  shared_iopage_t *shared_page = NULL;
diff -r 111936ef4291 -r fc6c3d866477 
tools/ioemu/patches/xenstore-block-device-config
--- a/tools/ioemu/patches/xenstore-block-device-config  Wed Aug 09 10:04:43 
2006 -0600
+++ b/tools/ioemu/patches/xenstore-block-device-config  Wed Aug 09 10:32:23 
2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/Makefile.target
 Index: ioemu/Makefile.target
 ===================================================================
---- ioemu.orig/Makefile.target 2006-08-07 17:42:27.802386071 +0100
-+++ ioemu/Makefile.target      2006-08-07 17:42:28.683289358 +0100
+--- ioemu.orig/Makefile.target 2006-08-09 15:04:24.795583755 +0100
++++ ioemu/Makefile.target      2006-08-09 15:04:25.373528824 +0100
 @@ -358,6 +358,7 @@
  VL_OBJS+= cirrus_vga.o mixeng.o parallel.o acpi.o piix_pci.o
  VL_OBJS+= usb-uhci.o
@@ -13,7 +13,7 @@ Index: ioemu/xenstore.c
 Index: ioemu/xenstore.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/xenstore.c   2006-08-07 17:42:28.684289249 +0100
++++ ioemu/xenstore.c   2006-08-09 15:04:25.374528729 +0100
 @@ -0,0 +1,187 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General
@@ -204,9 +204,9 @@ Index: ioemu/xenstore.c
 +}
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-08-07 17:42:28.393320909 +0100
-+++ ioemu/vl.c 2006-08-07 17:42:28.687288922 +0100
-@@ -5242,9 +5242,11 @@
+--- ioemu.orig/vl.c    2006-08-09 15:04:25.312534622 +0100
++++ ioemu/vl.c 2006-08-09 15:04:25.377528443 +0100
+@@ -5243,9 +5243,11 @@
             "Standard options:\n"
             "-M machine      select emulated machine (-M ? for list)\n"
             "-fda/-fdb file  use 'file' as floppy disk 0/1 image\n"
@@ -218,7 +218,7 @@ Index: ioemu/vl.c
             "-boot [a|c|d]   boot on floppy (a), hard disk (c) or CD-ROM (d)\n"
           "-snapshot       write to temporary files instead of disk image 
files\n"
  #ifdef TARGET_I386
-@@ -5370,11 +5372,13 @@
+@@ -5372,11 +5374,13 @@
      QEMU_OPTION_M,
      QEMU_OPTION_fda,
      QEMU_OPTION_fdb,
@@ -232,7 +232,7 @@ Index: ioemu/vl.c
      QEMU_OPTION_boot,
      QEMU_OPTION_snapshot,
  #ifdef TARGET_I386
-@@ -5445,11 +5449,13 @@
+@@ -5448,11 +5452,13 @@
      { "M", HAS_ARG, QEMU_OPTION_M },
      { "fda", HAS_ARG, QEMU_OPTION_fda },
      { "fdb", HAS_ARG, QEMU_OPTION_fdb },
@@ -246,7 +246,7 @@ Index: ioemu/vl.c
      { "boot", HAS_ARG, QEMU_OPTION_boot },
      { "snapshot", 0, QEMU_OPTION_snapshot },
  #ifdef TARGET_I386
-@@ -5797,10 +5803,16 @@
+@@ -5801,10 +5807,16 @@
  #ifdef CONFIG_GDBSTUB
      int use_gdbstub, gdbstub_port;
  #endif
@@ -265,7 +265,7 @@ Index: ioemu/vl.c
      const char *kernel_filename, *kernel_cmdline;
      DisplayState *ds = &display_state;
      int cyls, heads, secs, translation;
-@@ -5861,8 +5873,10 @@
+@@ -5865,8 +5877,10 @@
      initrd_filename = NULL;
      for(i = 0; i < MAX_FD; i++)
          fd_filename[i] = NULL;
@@ -276,8 +276,8 @@ Index: ioemu/vl.c
      ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;
      vga_ram_size = VGA_RAM_SIZE;
      bios_size = BIOS_SIZE;
-@@ -5875,11 +5889,13 @@
-     vncviewer = 0;
+@@ -5880,11 +5894,13 @@
+     vncunused = 0;
      kernel_filename = NULL;
      kernel_cmdline = "";
 +#ifndef CONFIG_DM
@@ -290,7 +290,7 @@ Index: ioemu/vl.c
      cyls = heads = secs = 0;
      translation = BIOS_ATA_TRANSLATION_AUTO;
      pstrcpy(monitor_device, sizeof(monitor_device), "vc");
-@@ -5912,7 +5928,11 @@
+@@ -5917,7 +5933,11 @@
              break;
          r = argv[optind];
          if (r[0] != '-') {
@@ -302,7 +302,7 @@ Index: ioemu/vl.c
          } else {
              const QEMUOption *popt;
  
-@@ -5956,6 +5976,7 @@
+@@ -5961,6 +5981,7 @@
              case QEMU_OPTION_initrd:
                  initrd_filename = optarg;
                  break;
@@ -310,7 +310,7 @@ Index: ioemu/vl.c
              case QEMU_OPTION_hda:
              case QEMU_OPTION_hdb:
              case QEMU_OPTION_hdc:
-@@ -5968,6 +5989,7 @@
+@@ -5973,6 +5994,7 @@
                          cdrom_index = -1;
                  }
                  break;
@@ -318,7 +318,7 @@ Index: ioemu/vl.c
              case QEMU_OPTION_snapshot:
                  snapshot = 1;
                  break;
-@@ -6020,11 +6042,13 @@
+@@ -6025,11 +6047,13 @@
              case QEMU_OPTION_append:
                  kernel_cmdline = optarg;
                  break;
@@ -332,7 +332,7 @@ Index: ioemu/vl.c
              case QEMU_OPTION_boot:
                  boot_device = optarg[0];
                  if (boot_device != 'a' && 
-@@ -6274,12 +6298,18 @@
+@@ -6284,12 +6308,18 @@
          }
      }
  
@@ -351,7 +351,7 @@ Index: ioemu/vl.c
      if (!linux_boot && 
          hd_filename[0] == '\0' && 
          (cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') &&
-@@ -6293,6 +6323,7 @@
+@@ -6303,6 +6333,7 @@
          else
              boot_device = 'd';
      }
@@ -359,7 +359,7 @@ Index: ioemu/vl.c
  
      setvbuf(stdout, NULL, _IOLBF, 0);
      
-@@ -6407,6 +6438,7 @@
+@@ -6417,6 +6448,7 @@
  
  #endif /* !CONFIG_DM */
  
@@ -367,7 +367,7 @@ Index: ioemu/vl.c
      /* we always create the cdrom drive, even if no disk is there */
      bdrv_init();
      if (cdrom_index >= 0) {
-@@ -6433,6 +6465,7 @@
+@@ -6443,6 +6475,7 @@
              }
          }
      }
@@ -375,7 +375,7 @@ Index: ioemu/vl.c
  
      /* we always create at least one floppy disk */
      fd_table[0] = bdrv_new("fda");
-@@ -6511,6 +6544,8 @@
+@@ -6521,6 +6554,8 @@
          }
      }
  
@@ -386,8 +386,8 @@ Index: ioemu/vl.c
                    kernel_filename, kernel_cmdline, initrd_filename,
 Index: ioemu/monitor.c
 ===================================================================
---- ioemu.orig/monitor.c       2006-08-07 17:42:27.132461888 +0100
-+++ ioemu/monitor.c    2006-08-07 17:42:28.688288814 +0100
+--- ioemu.orig/monitor.c       2006-08-09 15:04:24.105649313 +0100
++++ ioemu/monitor.c    2006-08-09 15:04:25.379528253 +0100
 @@ -24,6 +24,7 @@
  #include "vl.h"
  #include "disas.h"
@@ -416,8 +416,8 @@ Index: ioemu/monitor.c
      int i;
 Index: ioemu/block.c
 ===================================================================
---- ioemu.orig/block.c 2006-08-07 17:42:21.704076241 +0100
-+++ ioemu/block.c      2006-08-07 17:42:28.689288705 +0100
+--- ioemu.orig/block.c 2006-08-09 15:04:17.487277167 +0100
++++ ioemu/block.c      2006-08-09 15:04:25.379528253 +0100
 @@ -758,6 +758,7 @@
  static void raw_close(BlockDriverState *bs)
  {
@@ -428,8 +428,8 @@ Index: ioemu/block.c
  
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-08-07 17:42:28.394320800 +0100
-+++ ioemu/vl.h 2006-08-07 17:42:28.689288705 +0100
+--- ioemu.orig/vl.h    2006-08-09 15:04:25.313534527 +0100
++++ ioemu/vl.h 2006-08-09 15:04:25.380528158 +0100
 @@ -1184,6 +1184,8 @@
  void term_print_help(void);
  void monitor_readline(const char *prompt, int is_password,
@@ -455,8 +455,8 @@ Index: ioemu/vl.h
  extern char domain_name[];
 Index: ioemu/hw/ide.c
 ===================================================================
---- ioemu.orig/hw/ide.c        2006-08-07 17:42:27.552414361 +0100
-+++ ioemu/hw/ide.c     2006-08-07 17:42:28.691288487 +0100
+--- ioemu.orig/hw/ide.c        2006-08-09 15:04:24.524609503 +0100
++++ ioemu/hw/ide.c     2006-08-09 15:04:25.381528063 +0100
 @@ -1158,6 +1158,7 @@
          } else {
              ide_atapi_cmd_error(s, SENSE_NOT_READY, 
diff -r 111936ef4291 -r fc6c3d866477 tools/ioemu/patches/xenstore-write-vnc-port
--- a/tools/ioemu/patches/xenstore-write-vnc-port       Wed Aug 09 10:04:43 
2006 -0600
+++ b/tools/ioemu/patches/xenstore-write-vnc-port       Wed Aug 09 10:32:23 
2006 -0600
@@ -1,7 +1,7 @@ Index: ioemu/xenstore.c
 Index: ioemu/xenstore.c
 ===================================================================
---- ioemu.orig/xenstore.c      2006-08-07 17:42:28.684289249 +0100
-+++ ioemu/xenstore.c   2006-08-07 17:42:28.891266728 +0100
+--- ioemu.orig/xenstore.c      2006-08-09 15:04:25.374528729 +0100
++++ ioemu/xenstore.c   2006-08-09 15:04:25.579509243 +0100
 @@ -185,3 +185,31 @@
      free(image);
      free(vec);
@@ -36,10 +36,10 @@ Index: ioemu/xenstore.c
 +}
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-08-07 17:42:28.687288922 +0100
-+++ ioemu/vl.c 2006-08-07 17:42:28.894266401 +0100
-@@ -6501,6 +6501,7 @@
-       vnc_display_init(ds, vnc_display);
+--- ioemu.orig/vl.c    2006-08-09 15:04:25.377528443 +0100
++++ ioemu/vl.c 2006-08-09 15:04:25.583508863 +0100
+@@ -6511,6 +6511,7 @@
+       vnc_display = vnc_display_init(ds, vnc_display, vncunused);
        if (vncviewer)
            vnc_start_viewer(vnc_display);
 +      xenstore_write_vncport(vnc_display);
@@ -48,8 +48,8 @@ Index: ioemu/vl.c
          sdl_display_init(ds, full_screen);
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-08-07 17:42:28.689288705 +0100
-+++ ioemu/vl.h 2006-08-07 17:42:28.895266293 +0100
+--- ioemu.orig/vl.h    2006-08-09 15:04:25.380528158 +0100
++++ ioemu/vl.h 2006-08-09 15:04:25.584508768 +0100
 @@ -1203,6 +1203,7 @@
  int xenstore_fd(void);
  void xenstore_process_event(void *opaque);
diff -r 111936ef4291 -r fc6c3d866477 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Wed Aug 09 10:04:43 2006 -0600
+++ b/tools/ioemu/vl.c  Wed Aug 09 10:32:23 2006 -0600
@@ -121,6 +121,7 @@ static DisplayState display_state;
 static DisplayState display_state;
 int nographic;
 int vncviewer;
+int vncunused;
 const char* keyboard_layout = NULL;
 int64_t ticks_per_sec;
 int boot_device = 'c';
@@ -5344,6 +5345,7 @@ void help(void)
            "-loadvm file    start right away with a saved state (loadvm in 
monitor)\n"
           "-vnc display    start a VNC server on display\n"
            "-vncviewer      start a vncviewer process for this domain\n"
+           "-vncunused      bind the VNC server to an unused port\n"
            "-timeoffset     time offset (in seconds) from local time\n"
            "-acpi           disable or enable ACPI of HVM domain \n"
            "\n"
@@ -5435,6 +5437,7 @@ enum {
     QEMU_OPTION_timeoffset,
     QEMU_OPTION_acpi,
     QEMU_OPTION_vncviewer,
+    QEMU_OPTION_vncunused,
 };
 
 typedef struct QEMUOption {
@@ -5512,6 +5515,7 @@ const QEMUOption qemu_options[] = {
     { "smp", HAS_ARG, QEMU_OPTION_smp },
     { "vnc", HAS_ARG, QEMU_OPTION_vnc },
     { "vncviewer", 0, QEMU_OPTION_vncviewer },
+    { "vncunused", 0, QEMU_OPTION_vncunused },
     
     /* temporary options */
     { "usb", 0, QEMU_OPTION_usb },
@@ -5888,6 +5892,7 @@ int main(int argc, char **argv)
     snapshot = 0;
     nographic = 0;
     vncviewer = 0;
+    vncunused = 0;
     kernel_filename = NULL;
     kernel_cmdline = "";
 #ifndef CONFIG_DM
@@ -6295,6 +6300,11 @@ int main(int argc, char **argv)
             case QEMU_OPTION_vncviewer:
                 vncviewer++;
                 break;
+            case QEMU_OPTION_vncunused:
+                vncunused++;
+                if (vnc_display == -1)
+                    vnc_display = -2;
+                break;
             }
         }
     }
@@ -6504,7 +6514,7 @@ int main(int argc, char **argv)
     if (nographic) {
         dumb_display_init(ds);
     } else if (vnc_display != -1) {
-       vnc_display_init(ds, vnc_display);
+       vnc_display = vnc_display_init(ds, vnc_display, vncunused);
        if (vncviewer)
            vnc_start_viewer(vnc_display);
        xenstore_write_vncport(vnc_display);
diff -r 111936ef4291 -r fc6c3d866477 tools/ioemu/vl.h
--- a/tools/ioemu/vl.h  Wed Aug 09 10:04:43 2006 -0600
+++ b/tools/ioemu/vl.h  Wed Aug 09 10:32:23 2006 -0600
@@ -784,7 +784,7 @@ void cocoa_display_init(DisplayState *ds
 void cocoa_display_init(DisplayState *ds, int full_screen);
 
 /* vnc.c */
-void vnc_display_init(DisplayState *ds, int display);
+int vnc_display_init(DisplayState *ds, int display, int find_unused);
 int vnc_start_viewer(int port);
 
 /* ide.c */
diff -r 111936ef4291 -r fc6c3d866477 tools/ioemu/vnc.c
--- a/tools/ioemu/vnc.c Wed Aug 09 10:04:43 2006 -0600
+++ b/tools/ioemu/vnc.c Wed Aug 09 10:32:23 2006 -0600
@@ -1183,7 +1183,7 @@ static void vnc_listen_read(void *opaque
     }
 }
 
-void vnc_display_init(DisplayState *ds, int display)
+int vnc_display_init(DisplayState *ds, int display, int find_unused)
 {
     struct sockaddr_in addr;
     int reuse_addr, ret;
@@ -1213,10 +1213,6 @@ void vnc_display_init(DisplayState *ds, 
        fprintf(stderr, "Could not create socket\n");
        exit(1);
     }
-
-    addr.sin_family = AF_INET;
-    addr.sin_port = htons(5900 + display);
-    memset(&addr.sin_addr, 0, sizeof(addr.sin_addr));
 
     reuse_addr = 1;
     ret = setsockopt(vs->lsock, SOL_SOCKET, SO_REUSEADDR,
@@ -1226,7 +1222,16 @@ void vnc_display_init(DisplayState *ds, 
        exit(1);
     }
 
+ retry:
+    addr.sin_family = AF_INET;
+    addr.sin_port = htons(5900 + display);
+    memset(&addr.sin_addr, 0, sizeof(addr.sin_addr));
+
     if (bind(vs->lsock, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
+       if (find_unused && errno == EADDRINUSE) {
+           display++;
+           goto retry;
+       }
        fprintf(stderr, "bind() failed\n");
        exit(1);
     }
@@ -1247,6 +1252,8 @@ void vnc_display_init(DisplayState *ds, 
     vs->ds->dpy_refresh = vnc_dpy_refresh;
 
     vnc_dpy_resize(vs->ds, 640, 400);
+
+    return display;
 }
 
 int vnc_start_viewer(int port)
diff -r 111936ef4291 -r fc6c3d866477 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Wed Aug 09 10:04:43 2006 -0600
+++ b/tools/python/xen/xend/image.py    Wed Aug 09 10:32:23 2006 -0600
@@ -307,6 +307,7 @@ class HVMImageHandler(ImageHandler):
         vnc = sxp.child_value(config, 'vnc')
         vncdisplay = sxp.child_value(config, 'vncdisplay',
                                      int(self.vm.getDomid()))
+        vncunused = sxp.child_value(config, 'vncunused')
         sdl = sxp.child_value(config, 'sdl')
         ret = []
         nographic = sxp.child_value(config, 'nographic')
@@ -315,6 +316,8 @@ class HVMImageHandler(ImageHandler):
             return ret
         if vnc:
             ret = ret + ['-vnc', '%d' % vncdisplay, '-k', 'en-us']
+        if vncunused:
+            ret += ['-vncunused']
         return ret
 
     def createDeviceModel(self):
diff -r 111936ef4291 -r fc6c3d866477 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Wed Aug 09 10:04:43 2006 -0600
+++ b/tools/python/xen/xm/create.py     Wed Aug 09 10:32:23 2006 -0600
@@ -411,6 +411,11 @@ gopts.var('vncdisplay', val='',
 gopts.var('vncdisplay', val='',
           fn=set_value, default=None,
           use="""VNC display to use""")
+
+gopts.var('vncunused', val='',
+          fn=set_bool, default=1,
+          use="""Try to find an unused port for the VNC server.
+          Only valid when vnc=1.""")
 
 gopts.var('sdl', val='',
           fn=set_value, default=None,
@@ -627,7 +632,7 @@ def configure_hvm(config_image, vals):
     """
     args = [ 'device_model', 'pae', 'vcpus', 'boot', 'fda', 'fdb',
              'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw',
-             'vnc', 'vncdisplay', 'vncconsole', 'sdl', 'display',
+             'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'sdl', 'display',
              'acpi', 'apic', 'xauthority', 'usb', 'usbdevice' ]
     for a in args:
         if (vals.__dict__[a]):
diff -r 111936ef4291 -r fc6c3d866477 tools/ioemu/patches/vnc-display-find-unused
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ioemu/patches/vnc-display-find-unused       Wed Aug 09 10:32:23 
2006 -0600
@@ -0,0 +1,128 @@
+Index: ioemu/vnc.c
+===================================================================
+--- ioemu.orig/vnc.c   2006-08-09 14:44:44.721942535 +0100
++++ ioemu/vnc.c        2006-08-09 14:52:37.262165292 +0100
+@@ -1183,7 +1183,7 @@
+     }
+ }
+ 
+-void vnc_display_init(DisplayState *ds, int display)
++int vnc_display_init(DisplayState *ds, int display, int find_unused)
+ {
+     struct sockaddr_in addr;
+     int reuse_addr, ret;
+@@ -1214,10 +1214,6 @@
+       exit(1);
+     }
+ 
+-    addr.sin_family = AF_INET;
+-    addr.sin_port = htons(5900 + display);
+-    memset(&addr.sin_addr, 0, sizeof(addr.sin_addr));
+-
+     reuse_addr = 1;
+     ret = setsockopt(vs->lsock, SOL_SOCKET, SO_REUSEADDR,
+                    (const char *)&reuse_addr, sizeof(reuse_addr));
+@@ -1226,7 +1222,16 @@
+       exit(1);
+     }
+ 
++ retry:
++    addr.sin_family = AF_INET;
++    addr.sin_port = htons(5900 + display);
++    memset(&addr.sin_addr, 0, sizeof(addr.sin_addr));
++
+     if (bind(vs->lsock, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
++      if (find_unused && errno == EADDRINUSE) {
++          display++;
++          goto retry;
++      }
+       fprintf(stderr, "bind() failed\n");
+       exit(1);
+     }
+@@ -1247,6 +1252,8 @@
+     vs->ds->dpy_refresh = vnc_dpy_refresh;
+ 
+     vnc_dpy_resize(vs->ds, 640, 400);
++
++    return display;
+ }
+ 
+ int vnc_start_viewer(int port)
+Index: ioemu/vl.c
+===================================================================
+--- ioemu.orig/vl.c    2006-08-09 14:44:44.721942535 +0100
++++ ioemu/vl.c 2006-08-09 14:52:06.783905832 +0100
+@@ -121,6 +121,7 @@
+ static DisplayState display_state;
+ int nographic;
+ int vncviewer;
++int vncunused;
+ const char* keyboard_layout = NULL;
+ int64_t ticks_per_sec;
+ int boot_device = 'c';
+@@ -5342,6 +5343,7 @@
+            "-loadvm file    start right away with a saved state (loadvm in 
monitor)\n"
+          "-vnc display    start a VNC server on display\n"
+            "-vncviewer      start a vncviewer process for this domain\n"
++           "-vncunused      bind the VNC server to an unused port\n"
+            "-timeoffset     time offset (in seconds) from local time\n"
+            "-acpi           disable or enable ACPI of HVM domain \n"
+            "\n"
+@@ -5431,6 +5433,7 @@
+     QEMU_OPTION_timeoffset,
+     QEMU_OPTION_acpi,
+     QEMU_OPTION_vncviewer,
++    QEMU_OPTION_vncunused,
+ };
+ 
+ typedef struct QEMUOption {
+@@ -5506,6 +5509,7 @@
+     { "smp", HAS_ARG, QEMU_OPTION_smp },
+     { "vnc", HAS_ARG, QEMU_OPTION_vnc },
+     { "vncviewer", 0, QEMU_OPTION_vncviewer },
++    { "vncunused", 0, QEMU_OPTION_vncunused },
+     
+     /* temporary options */
+     { "usb", 0, QEMU_OPTION_usb },
+@@ -5873,6 +5877,7 @@
+     snapshot = 0;
+     nographic = 0;
+     vncviewer = 0;
++    vncunused = 0;
+     kernel_filename = NULL;
+     kernel_cmdline = "";
+ #ifdef TARGET_PPC
+@@ -6270,6 +6275,11 @@
+             case QEMU_OPTION_vncviewer:
+                 vncviewer++;
+                 break;
++            case QEMU_OPTION_vncunused:
++                vncunused++;
++                if (vnc_display == -1)
++                    vnc_display = -2;
++                break;
+             }
+         }
+     }
+@@ -6465,7 +6475,7 @@
+     if (nographic) {
+         dumb_display_init(ds);
+     } else if (vnc_display != -1) {
+-      vnc_display_init(ds, vnc_display);
++      vnc_display = vnc_display_init(ds, vnc_display, vncunused);
+       if (vncviewer)
+           vnc_start_viewer(vnc_display);
+     } else {
+Index: ioemu/vl.h
+===================================================================
+--- ioemu.orig/vl.h    2006-08-09 14:44:44.721942535 +0100
++++ ioemu/vl.h 2006-08-09 14:52:06.783905832 +0100
+@@ -784,7 +784,7 @@
+ void cocoa_display_init(DisplayState *ds, int full_screen);
+ 
+ /* vnc.c */
+-void vnc_display_init(DisplayState *ds, int display);
++int vnc_display_init(DisplayState *ds, int display, int find_unused);
+ int vnc_start_viewer(int port);
+ 
+ /* ide.c */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog