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] Spawn vncviewer from qemu-dm.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Spawn vncviewer from qemu-dm.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Jul 2006 19:40:21 +0000
Delivery-date: Fri, 14 Jul 2006 12:43:59 -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 chris@xxxxxxxxxxxxxxxxxxxxxxxx
# Node ID ecb8ff1fcf1fc24561c8bd272a58828592d90806
# Parent  ccf11affc5450df201c566eaf1487fd48b288a5b
Spawn vncviewer from qemu-dm.
- add vncviewer option to qemu-dm to spawn a vncviewer process.
- add the `vncconsole' config parameter which enables qemu-dm's vncviewer
  option.

Based on a patch from: Don Dugger <donald.d.dugger@xxxxxxxxx>
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
---
 tools/examples/xmexample.hvm            |    5 +-
 tools/ioemu/patches/series              |    1 
 tools/ioemu/patches/vnc-start-vncviewer |   69 ++++++++++++++++++++++++++++++++
 tools/ioemu/vl.c                        |   10 ++++
 tools/ioemu/vl.h                        |    1 
 tools/ioemu/vnc.c                       |   22 ++++++++++
 tools/python/xen/xend/image.py          |   21 +--------
 tools/python/xen/xm/create.py           |   31 ++++++++------
 8 files changed, 128 insertions(+), 32 deletions(-)

diff -r ccf11affc545 -r ecb8ff1fcf1f tools/examples/xmexample.hvm
--- a/tools/examples/xmexample.hvm      Fri Jul 14 15:59:24 2006 +0100
+++ b/tools/examples/xmexample.hvm      Fri Jul 14 18:53:27 2006 +0100
@@ -134,8 +134,9 @@ vnc=1
 #vncdisplay=1
 
 #----------------------------------------------------------------------------
-# enable spawning vncviewer(only valid when vnc=1), default = 1
-vncviewer=1
+# enable spawning vncviewer for domain's console
+# (only valid when vnc=1), default = 0
+#vncconsole=0
 
 #----------------------------------------------------------------------------
 # no graphics, use serial port
diff -r ccf11affc545 -r ecb8ff1fcf1f tools/ioemu/patches/series
--- a/tools/ioemu/patches/series        Fri Jul 14 15:59:24 2006 +0100
+++ b/tools/ioemu/patches/series        Fri Jul 14 18:53:27 2006 +0100
@@ -30,3 +30,4 @@ acpi-poweroff-support
 acpi-poweroff-support
 vnc-cleanup
 vnc-fixes
+vnc-start-vncviewer
diff -r ccf11affc545 -r ecb8ff1fcf1f tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Fri Jul 14 15:59:24 2006 +0100
+++ b/tools/ioemu/vl.c  Fri Jul 14 18:53:27 2006 +0100
@@ -121,6 +121,7 @@ int bios_size;
 int bios_size;
 static DisplayState display_state;
 int nographic;
+int vncviewer;
 const char* keyboard_layout = NULL;
 int64_t ticks_per_sec;
 int boot_device = 'c';
@@ -4801,6 +4802,7 @@ void help(void)
 #endif
            "-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"
            "-timeoffset     time offset (in seconds) from local time\n"
            "\n"
            "During emulation, the following keys are useful:\n"
@@ -4889,6 +4891,7 @@ enum {
     QEMU_OPTION_usbdevice,
     QEMU_OPTION_smp,
     QEMU_OPTION_vnc,
+    QEMU_OPTION_vncviewer,
 
     QEMU_OPTION_d,
     QEMU_OPTION_vcpus,
@@ -4964,6 +4967,7 @@ const QEMUOption qemu_options[] = {
     { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
     { "smp", HAS_ARG, QEMU_OPTION_smp },
     { "vnc", HAS_ARG, QEMU_OPTION_vnc },
+    { "vncviewer", 0, QEMU_OPTION_vncviewer },
     
     /* temporary options */
     { "usb", 0, QEMU_OPTION_usb },
@@ -5294,6 +5298,7 @@ int main(int argc, char **argv)
 #endif
     snapshot = 0;
     nographic = 0;
+    vncviewer = 0;
     kernel_filename = NULL;
     kernel_cmdline = "";
 #ifdef TARGET_PPC
@@ -5663,6 +5668,9 @@ int main(int argc, char **argv)
                    exit(1);
                }
                break;
+            case QEMU_OPTION_vncviewer:
+                vncviewer++;
+                break;
             case QEMU_OPTION_domainname:
                 strncat(domain_name, optarg, sizeof(domain_name) - 20);
                 break;
@@ -5881,6 +5889,8 @@ int main(int argc, char **argv)
         dumb_display_init(ds);
     } else if (vnc_display != -1) {
        vnc_display_init(ds, vnc_display);
+       if (vncviewer)
+           vnc_start_viewer(vnc_display);
     } else {
 #if defined(CONFIG_SDL)
         sdl_display_init(ds, full_screen);
diff -r ccf11affc545 -r ecb8ff1fcf1f tools/ioemu/vl.h
--- a/tools/ioemu/vl.h  Fri Jul 14 15:59:24 2006 +0100
+++ b/tools/ioemu/vl.h  Fri Jul 14 18:53:27 2006 +0100
@@ -732,6 +732,7 @@ void cocoa_display_init(DisplayState *ds
 
 /* vnc.c */
 void vnc_display_init(DisplayState *ds, int display);
+int vnc_start_viewer(int port);
 
 /* ide.c */
 #define MAX_DISKS 4
diff -r ccf11affc545 -r ecb8ff1fcf1f tools/ioemu/vnc.c
--- a/tools/ioemu/vnc.c Fri Jul 14 15:59:24 2006 +0100
+++ b/tools/ioemu/vnc.c Fri Jul 14 18:53:27 2006 +0100
@@ -999,3 +999,25 @@ void vnc_display_init(DisplayState *ds, 
 
     vnc_dpy_resize(vs->ds, 640, 400);
 }
+
+int vnc_start_viewer(int port)
+{
+    int pid;
+    char s[16];
+
+    sprintf(s, ":%d", port);
+
+    switch (pid = fork()) {
+    case -1:
+       fprintf(stderr, "vncviewer failed fork\n");
+       exit(1);
+
+    case 0:    /* child */
+       execlp("vncviewer", "vncviewer", s, 0);
+       fprintf(stderr, "vncviewer execlp failed\n");
+       exit(1);
+
+    default:
+       return pid;
+    }
+}
diff -r ccf11affc545 -r ecb8ff1fcf1f tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Fri Jul 14 15:59:24 2006 +0100
+++ b/tools/python/xen/xend/image.py    Fri Jul 14 18:53:27 2006 +0100
@@ -208,6 +208,7 @@ class HVMImageHandler(ImageHandler):
             raise VmError("hvm: missing device model")
         self.display = sxp.child_value(imageConfig, 'display')
         self.xauthority = sxp.child_value(imageConfig, 'xauthority')
+        self.vncconsole = sxp.child_value(imageConfig, 'vncconsole')
 
         self.vm.storeVm(("image/dmargs", " ".join(self.dmargs)),
                         ("image/device-model", self.device_model),
@@ -335,11 +336,7 @@ class HVMImageHandler(ImageHandler):
             return
         # Execute device model.
         #todo: Error handling
-        # XXX RN: note that the order of args matter!
         args = [self.device_model]
-        vnc = self.vncParams()
-        if len(vnc):
-            args = args + vnc
         args = args + ([ "-d",  "%d" % self.vm.getDomid(),
                   "-m", "%s" % (self.vm.getMemoryTarget() / 1024)])
         args = args + self.dmargs
@@ -348,23 +345,11 @@ class HVMImageHandler(ImageHandler):
             env['DISPLAY'] = self.display
         if self.xauthority:
             env['XAUTHORITY'] = self.xauthority
+        if self.vncconsole:
+            args = args + ([ "-vncviewer" ])
         log.info("spawning device models: %s %s", self.device_model, args)
         self.pid = os.spawnve(os.P_NOWAIT, self.device_model, args, env)
         log.info("device model pid: %d", self.pid)
-
-    def vncParams(self):
-        # see if a vncviewer was specified
-        # XXX RN: bit of a hack. should unify this, maybe stick in config space
-        vncconnect=[]
-        args = self.cmdline
-        if args:
-            arg_list = string.split(args)
-            for arg in arg_list:
-                al = string.split(arg, '=')
-                if al[0] == "VNC_VIEWER":
-                    vncconnect=["-vncconnect", "%s" % al[1]]
-                    break
-        return vncconnect
 
     def destroy(self):
         self.unregister_shutdown_watch();
diff -r ccf11affc545 -r ecb8ff1fcf1f tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Fri Jul 14 15:59:24 2006 +0100
+++ b/tools/python/xen/xm/create.py     Fri Jul 14 18:53:27 2006 +0100
@@ -109,6 +109,12 @@ gopts.var('vncviewer', val='no|yes',
           The address of the vncviewer is passed to the domain on the kernel 
command
           line using 'VNC_SERVER=<host>:<port>'. The port used by vnc is 5500 
+ DISPLAY.
           A display value with a free port is chosen if possible.
+          Only valid when vnc=1.
+          """)
+
+gopts.var('vncconsole', val='no|yes',
+          fn=set_bool, default=None,
+          use="""Spawn a vncviewer process for the domain's graphical console.
           Only valid when vnc=1.
           """)
 
@@ -625,7 +631,7 @@ def configure_hvm(config_image, vals):
     """
     args = [ 'device_model', 'pae', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
              'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'audio',
-             'vnc', 'vncdisplay', 'vncviewer', 'sdl', 'display',
+             'vnc', 'vncdisplay', 'vncconsole', 'sdl', 'display',
              'acpi', 'apic', 'xauthority', 'usb', 'usbdevice' ]
     for a in args:
         if (vals.__dict__[a]):
@@ -854,17 +860,18 @@ def preprocess_vnc(vals):
     """If vnc was specified, spawn a vncviewer in listen mode
     and pass its address to the domain on the kernel command line.
     """
-    if not (vals.vnc and vals.vncviewer) or vals.dryrun: return
-    vnc_display = choose_vnc_display()
-    if not vnc_display:
-        warn("No free vnc display")
-        return
-    print 'VNC=', vnc_display
-    vnc_port = spawn_vnc(vnc_display)
-    if vnc_port > 0:
-        vnc_host = get_host_addr()
-        vnc = 'VNC_VIEWER=%s:%d' % (vnc_host, vnc_port)
-        vals.extra = vnc + ' ' + vals.extra
+    if vals.dryrun: return
+    if vals.vncviewer:
+        vnc_display = choose_vnc_display()
+        if not vnc_display:
+            warn("No free vnc display")
+            return
+        print 'VNC=', vnc_display
+        vnc_port = spawn_vnc(vnc_display)
+        if vnc_port > 0:
+            vnc_host = get_host_addr()
+            vnc = 'VNC_VIEWER=%s:%d' % (vnc_host, vnc_port)
+            vals.extra = vnc + ' ' + vals.extra
     
 def preprocess(vals):
     if not vals.kernel and not vals.bootloader:
diff -r ccf11affc545 -r ecb8ff1fcf1f tools/ioemu/patches/vnc-start-vncviewer
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ioemu/patches/vnc-start-vncviewer   Fri Jul 14 18:53:27 2006 +0100
@@ -0,0 +1,105 @@
+Index: ioemu/vnc.c
+===================================================================
+--- ioemu.orig/vnc.c   2006-07-14 18:29:36.810169908 +0100
++++ ioemu/vnc.c        2006-07-14 18:30:17.437628819 +0100
+@@ -999,3 +999,25 @@
+ 
+     vnc_dpy_resize(vs->ds, 640, 400);
+ }
++
++int vnc_start_viewer(int port)
++{
++    int pid;
++    char s[16];
++
++    sprintf(s, ":%d", port);
++
++    switch (pid = fork()) {
++    case -1:
++      fprintf(stderr, "vncviewer failed fork\n");
++      exit(1);
++
++    case 0:   /* child */
++      execlp("vncviewer", "vncviewer", s, 0);
++      fprintf(stderr, "vncviewer execlp failed\n");
++      exit(1);
++
++    default:
++      return pid;
++    }
++}
+Index: ioemu/vl.c
+===================================================================
+--- ioemu.orig/vl.c    2006-07-14 18:29:36.809170020 +0100
++++ ioemu/vl.c 2006-07-14 18:30:17.435629043 +0100
+@@ -121,6 +121,7 @@
+ int bios_size;
+ static DisplayState display_state;
+ int nographic;
++int vncviewer;
+ const char* keyboard_layout = NULL;
+ int64_t ticks_per_sec;
+ int boot_device = 'c';
+@@ -4801,6 +4802,7 @@
+ #endif
+            "-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"
+            "-timeoffset     time offset (in seconds) from local time\n"
+            "\n"
+            "During emulation, the following keys are useful:\n"
+@@ -4889,6 +4891,7 @@
+     QEMU_OPTION_usbdevice,
+     QEMU_OPTION_smp,
+     QEMU_OPTION_vnc,
++    QEMU_OPTION_vncviewer,
+ 
+     QEMU_OPTION_d,
+     QEMU_OPTION_vcpus,
+@@ -4964,6 +4967,7 @@
+     { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
+     { "smp", HAS_ARG, QEMU_OPTION_smp },
+     { "vnc", HAS_ARG, QEMU_OPTION_vnc },
++    { "vncviewer", 0, QEMU_OPTION_vncviewer },
+     
+     /* temporary options */
+     { "usb", 0, QEMU_OPTION_usb },
+@@ -5294,6 +5298,7 @@
+ #endif
+     snapshot = 0;
+     nographic = 0;
++    vncviewer = 0;
+     kernel_filename = NULL;
+     kernel_cmdline = "";
+ #ifdef TARGET_PPC
+@@ -5663,6 +5668,9 @@
+                   exit(1);
+               }
+               break;
++            case QEMU_OPTION_vncviewer:
++                vncviewer++;
++                break;
+             case QEMU_OPTION_domainname:
+                 strncat(domain_name, optarg, sizeof(domain_name) - 20);
+                 break;
+@@ -5881,6 +5889,8 @@
+         dumb_display_init(ds);
+     } else if (vnc_display != -1) {
+       vnc_display_init(ds, vnc_display);
++      if (vncviewer)
++          vnc_start_viewer(vnc_display);
+     } else {
+ #if defined(CONFIG_SDL)
+         sdl_display_init(ds, full_screen);
+Index: ioemu/vl.h
+===================================================================
+--- ioemu.orig/vl.h    2006-07-14 18:29:36.810169908 +0100
++++ ioemu/vl.h 2006-07-14 18:30:17.436628931 +0100
+@@ -732,6 +732,7 @@
+ 
+ /* vnc.c */
+ void vnc_display_init(DisplayState *ds, int display);
++int vnc_start_viewer(int port);
+ 
+ /* ide.c */
+ #define MAX_DISKS 4

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Spawn vncviewer from qemu-dm., Xen patchbot-unstable <=