ia64/xen-unstable

changeset 19791:c0d2838fc10f

stubdoms: qemu monitor support

Add support for the qemu monitor in a stubdom, the same way the
emulated serial support was added few days ago. The stubdom exports
the monitor as a pty and minios opens a console frontend; qemu in dom0
provides the correspondent backend for this additional pv console that
happens to be the qemu monitor.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 18 10:20:17 2009 +0100 (2009-06-18)
parents 01ad2654815a
children 407e2e7dca5b
files stubdom/stubdom-dm tools/python/xen/xend/XendConfig.py tools/python/xen/xend/image.py tools/python/xen/xm/create.py
line diff
     1.1 --- a/stubdom/stubdom-dm	Thu Jun 18 10:19:25 2009 +0100
     1.2 +++ b/stubdom/stubdom-dm	Thu Jun 18 10:20:17 2009 +0100
     1.3 @@ -56,6 +56,10 @@ do
     1.4  		serial="$2"
     1.5  		shift
     1.6  		;;
     1.7 +            -monitor)
     1.8 +		monitor="$2"
     1.9 +		shift
    1.10 +		;;
    1.11  	esac
    1.12      fi
    1.13      case "$1" in
    1.14 @@ -104,6 +108,7 @@ test $vnc != 0 && vfb="$vfb, vnc=$vnc, v
    1.15  vncpasswd=`xenstore-read /local/domain/0/backend/vfb/$domid/0/vncpasswd 2>/dev/null`
    1.16  test "$vncpasswd" && vfb="$vfb, vncpasswd=$vncpasswd"
    1.17  test "$keymap" && vfb="$vfb, keymap=$keymap"
    1.18 +test "$monitor" && vfb="$vfb, monitor=$monitor"
    1.19  test "$serial" && vfb="$vfb, serial=$serial"
    1.20  echo "vfb = ['$vfb']" >> /etc/xen/stubdoms/$domname-dm
    1.21  
     2.1 --- a/tools/python/xen/xend/XendConfig.py	Thu Jun 18 10:19:25 2009 +0100
     2.2 +++ b/tools/python/xen/xend/XendConfig.py	Thu Jun 18 10:20:17 2009 +0100
     2.3 @@ -1434,17 +1434,21 @@ class XendConfig(dict):
     2.4  		    del dev_info['type']
     2.5  		    log.debug("iwj dev_type=%s vfb setting dev_info['%s']" %
     2.6  				(dev_type, vfb_type))
     2.7 +                # Create serial backends now, the location value is bogus, but does not matter
     2.8 +                i=0
     2.9 +                chardev=0
    2.10                  if dev_info.get('serial') is not None :
    2.11 -                    # Create two serial backends now, the location value is bogus, but does not matter
    2.12 -                    cfg = self.console_add('vt100', '0')
    2.13 +                    chardev = chardev + 1
    2.14 +                if dev_info.get('monitor') is not None :
    2.15 +                    chardev = chardev + 1
    2.16 +                if chardev > 0 :
    2.17 +                    chardev = chardev + 1
    2.18 +                while i < chardev :
    2.19 +                    cfg = self.console_add('vt100', str(i))
    2.20                      c_uuid = uuid.createString()
    2.21                      target['devices'][c_uuid] = ('console', cfg)
    2.22                      target['console_refs'].append(c_uuid)
    2.23 -                    cfg = self.console_add('vt100', '1')
    2.24 -                    c_uuid = uuid.createString()
    2.25 -                    target['devices'][c_uuid] = ('console', cfg)
    2.26 -                    target['console_refs'].append(c_uuid)
    2.27 -                
    2.28 +                    i = i + 1
    2.29              elif dev_type == 'console':
    2.30                  if 'console_refs' not in target:
    2.31                      target['console_refs'] = []
     3.1 --- a/tools/python/xen/xend/image.py	Thu Jun 18 10:19:25 2009 +0100
     3.2 +++ b/tools/python/xen/xend/image.py	Thu Jun 18 10:20:17 2009 +0100
     3.3 @@ -286,6 +286,11 @@ class ImageHandler:
     3.4              if dev_type == 'vfb':
     3.5                  if 'keymap' in dev_info:
     3.6                      keymap = dev_info.get('keymap',{})
     3.7 +                if 'monitor' in dev_info:
     3.8 +                    ret.append("-serial")
     3.9 +                    ret.append(dev_info.get('monitor',{}))
    3.10 +                    ret.append("-monitor")
    3.11 +                    ret.append("null")
    3.12                  if 'serial' in dev_info:
    3.13                      ret.append("-serial")
    3.14                      ret.append(dev_info.get('serial',{}))
    3.15 @@ -717,7 +722,7 @@ class LinuxImageHandler(ImageHandler):
    3.16          ret = ImageHandler.parseDeviceModelArgs(self, vmConfig)
    3.17          # Equivalent to old xenconsoled behaviour. Should make
    3.18          # it configurable in future
    3.19 -        ret = ret + ["-serial", "pty"]
    3.20 +        ret = ["-serial", "pty"] + ret
    3.21          return ret
    3.22  
    3.23      def getDeviceModelArgs(self, restore = False):
    3.24 @@ -749,10 +754,16 @@ class HVMImageHandler(ImageHandler):
    3.25  
    3.26          if not self.display :
    3.27              self.display = ''
    3.28 -        # Do not store sdl and opengl qemu cli options
    3.29 -        self.vm.storeVm(("image/dmargs", " ".join([ x for x in self.dmargs
    3.30 -                        if x != "-sdl"
    3.31 -                        and x != "-disable-opengl" ])),
    3.32 +
    3.33 +        store_dmargs = self.dmargs[:]
    3.34 +        store_dmargs.remove('-sdl')
    3.35 +        store_dmargs.remove('-disable-opengl')
    3.36 +        try :
    3.37 +            midx = store_dmargs.index('-monitor')
    3.38 +            store_dmargs[midx + 1] = 'pty'
    3.39 +        except ValueError :
    3.40 +            pass
    3.41 +        self.vm.storeVm(("image/dmargs", " ".join(store_dmargs)),
    3.42                          ("image/device-model", self.device_model),
    3.43                          ("image/display", self.display))
    3.44          self.vm.permissionsVm("image/dmargs", { 'dom': self.vm.getDomid(), 'read': True } )
     4.1 --- a/tools/python/xen/xm/create.py	Thu Jun 18 10:19:25 2009 +0100
     4.2 +++ b/tools/python/xen/xm/create.py	Thu Jun 18 10:20:17 2009 +0100
     4.3 @@ -354,7 +354,7 @@ gopts.var('irq', val='IRQ',
     4.4           For example 'irq=7'.
     4.5           This option may be repeated to add more than one IRQ.""")
     4.6  
     4.7 -gopts.var('vfb', val="vnc=1,sdl=1,vncunused=1,vncdisplay=N,vnclisten=ADDR,display=DISPLAY,xauthority=XAUTHORITY,vncpasswd=PASSWORD,opengl=1,keymap=FILE,serial=FILE",
     4.8 +gopts.var('vfb', val="vnc=1,sdl=1,vncunused=1,vncdisplay=N,vnclisten=ADDR,display=DISPLAY,xauthority=XAUTHORITY,vncpasswd=PASSWORD,opengl=1,keymap=FILE,serial=FILE,monitor=FILE",
     4.9            fn=append_value, default=[],
    4.10            use="""Make the domain a framebuffer backend.
    4.11            Both sdl=1 and vnc=1 can be enabled at the same time.
    4.12 @@ -367,7 +367,8 @@ gopts.var('vfb', val="vnc=1,sdl=1,vncunu
    4.13            given DISPLAY and XAUTHORITY, which default to the current user's
    4.14            ones.  OpenGL will be used by default unless opengl is set to 0.
    4.15            keymap overrides the XendD configured default layout file.
    4.16 -	  Serial adds a second serial support to qemu.""")
    4.17 +	  Serial adds a second serial support to qemu.
    4.18 +          Monitor adds a backend for the stubdom monitor.""")
    4.19  
    4.20  gopts.var('vif', val="type=TYPE,mac=MAC,bridge=BRIDGE,ip=IPADDR,script=SCRIPT," + \
    4.21            "backend=DOM,vifname=NAME,rate=RATE,model=MODEL,accel=ACCEL",
    4.22 @@ -815,7 +816,7 @@ def configure_vfbs(config_devs, vals):
    4.23          for (k,v) in d.iteritems():
    4.24              if not k in [ 'vnclisten', 'vncunused', 'vncdisplay', 'display',
    4.25                            'videoram', 'xauthority', 'sdl', 'vnc', 'vncpasswd',
    4.26 -                          'opengl', 'keymap', 'serial' ]:
    4.27 +                          'opengl', 'keymap', 'serial', 'monitor' ]:
    4.28                  err("configuration option %s unknown to vfbs" % k)
    4.29              config.append([k,v])
    4.30          if not d.has_key("keymap"):