ia64/xen-unstable

changeset 18511:beb28a3975bd

xm: Remove obsolete mechanism using vncviewer -listen

Without this patch, vncviewer processes remain as follows.
This patch fixes it.

> # pgrep -fl vnc
> 4303 vncviewer -log *:stdout:0 -listen 5501
> 5089 vncviewer -log *:stdout:0 -listen 5502
> 5763 vncviewer -log *:stdout:0 -listen 5503

details:
Since 21dd1fdb73d8 there have been (as far as I can see) three
separate mechanisms for achieving a VNC display:
1. xm spawns vncviewer after getting vnc display info
from qemu-dm via xenstore (introduced in 21dd1fdb73d8)
2. xm spawns vncviewer -listen and qemu-dm connects to it
3. qemu-dm spawns vncviewer (!)

The latter two are rather strange - No.3 is very strange indeed.
So I decided that rather than try to get No.2 or No.3 on track for
going into qemu upstream, No.2 and No.3 would be dropped.
After discussion on xen-devel the mechanism No.1 was introduced,
above.

No.1 is controlled by the --spawn-vncviewer (and --vncviewer-autopass)
command line options to xm, by analogy with the -c option.

Nos.2 and 3 are controlled by elements of the domain configuration
file - and their code still remains. So if you turn all of the vnc
options on you can get several vncviewers (although only one of them
will work).

This patch removes the support for the passive connection mode No.2
After all ioemu-remote will never connect to such a vncviewer.
The options to engage this functionality were already removed from
the example config files by Keir in 18241:bf4ef45e6a38.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Sep 17 13:11:40 2008 +0100 (2008-09-17)
parents 7424f989fe01
children 366c78ff361b
files tools/python/xen/xm/create.py tools/python/xen/xm/new.py
line diff
     1.1 --- a/tools/python/xen/xm/create.py	Wed Sep 17 13:10:36 2008 +0100
     1.2 +++ b/tools/python/xen/xm/create.py	Wed Sep 17 13:11:40 2008 +0100
     1.3 @@ -1116,39 +1116,7 @@ def choose_vnc_display():
     1.4          if port in ports: continue
     1.5          return d
     1.6      return None
     1.7 -vncpid = None
     1.8 -
     1.9 -def spawn_vnc(display):
    1.10 -    """Spawns a vncviewer that listens on the specified display.  On success,
    1.11 -    returns the port that the vncviewer is listening on and sets the global
    1.12 -    vncpid.  On failure, returns 0.  Note that vncviewer is daemonized.
    1.13 -    """
    1.14 -    vncargs = (["vncviewer", "-log", "*:stdout:0",
    1.15 -            "-listen", "%d" % (VNC_BASE_PORT + display) ])
    1.16 -    global vncpid
    1.17 -    vncpid = utils.daemonize("vncviewer", vncargs)
    1.18 -    if vncpid == 0:
    1.19 -        return 0
    1.20 -
    1.21 -    return VNC_BASE_PORT + display
    1.22  
    1.23 -def preprocess_vnc(vals):
    1.24 -    """If vnc was specified, spawn a vncviewer in listen mode
    1.25 -    and pass its address to the domain on the kernel command line.
    1.26 -    """
    1.27 -    if vals.dryrun: return
    1.28 -    if vals.vncviewer:
    1.29 -        vnc_display = choose_vnc_display()
    1.30 -        if not vnc_display:
    1.31 -            warn("No free vnc display")
    1.32 -            return
    1.33 -        print 'VNC=', vnc_display
    1.34 -        vnc_port = spawn_vnc(vnc_display)
    1.35 -        if vnc_port > 0:
    1.36 -            vnc_host = get_host_addr()
    1.37 -            vnc = 'VNC_VIEWER=%s:%d' % (vnc_host, vnc_port)
    1.38 -            vals.extra = vnc + ' ' + vals.extra
    1.39 -    
    1.40  def preprocess(vals):
    1.41      preprocess_disk(vals)
    1.42      preprocess_pci(vals)
    1.43 @@ -1156,7 +1124,6 @@ def preprocess(vals):
    1.44      preprocess_ioports(vals)
    1.45      preprocess_ip(vals)
    1.46      preprocess_nfs(vals)
    1.47 -    preprocess_vnc(vals)
    1.48      preprocess_vtpm(vals)
    1.49      preprocess_access_control(vals)
    1.50      preprocess_cpuid(vals, 'cpuid')
    1.51 @@ -1193,23 +1160,10 @@ def make_domain(opts, config):
    1.52      try:
    1.53          dominfo = server.xend.domain.create(config)
    1.54      except xmlrpclib.Fault, ex:
    1.55 -        import signal
    1.56 -        if vncpid:
    1.57 -            os.kill(vncpid, signal.SIGKILL)
    1.58          if ex.faultCode == xen.xend.XendClient.ERROR_INVALID_DOMAIN:
    1.59              err("the domain '%s' does not exist." % ex.faultString)
    1.60          else:
    1.61              err("%s" % ex.faultString)
    1.62 -    except Exception, ex:
    1.63 -        # main.py has good error messages that let the user know what failed.
    1.64 -        # unless the error is a create.py specific thing, it should be handled
    1.65 -        # at main. The purpose of this general-case 'Exception' handler is to
    1.66 -        # clean up create.py specific processes/data but since create.py does
    1.67 -        # not know what to do with the error, it should pass it up.
    1.68 -        import signal
    1.69 -        if vncpid:
    1.70 -            os.kill(vncpid, signal.SIGKILL)
    1.71 -        raise
    1.72  
    1.73      dom = sxp.child_value(dominfo, 'name')
    1.74  
     2.1 --- a/tools/python/xen/xm/new.py	Wed Sep 17 13:10:36 2008 +0100
     2.2 +++ b/tools/python/xen/xm/new.py	Wed Sep 17 13:11:40 2008 +0100
     2.3 @@ -37,17 +37,11 @@ def make_unstarted_domain(opts, config):
     2.4      try:
     2.5          server.xend.domain.new(config)
     2.6      except xmlrpclib.Fault, ex:
     2.7 -        import signal
     2.8 -        if vncpid:
     2.9 -            os.kill(vncpid, signal.SIGKILL)
    2.10          if ex.faultCode == XendClient.ERROR_INVALID_DOMAIN:
    2.11              err("the domain '%s' does not exist." % ex.faultString)
    2.12          else:
    2.13              err("%s" % ex.faultString)
    2.14      except Exception, ex:
    2.15 -        import signal
    2.16 -        if vncpid:
    2.17 -            os.kill(vncpid, signal.SIGKILL)
    2.18          err(str(ex))
    2.19  
    2.20