[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] stubdoms: qemu monitor support



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1245316817 -3600
# Node ID c0d2838fc10f8bb0b004cee3fe7e2b41ff4e2f0e
# Parent  01ad2654815ad69476504a01b8141d95c351524f
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@xxxxxxxxxxxxx>
---
 stubdom/stubdom-dm                  |    5 +++++
 tools/python/xen/xend/XendConfig.py |   18 +++++++++++-------
 tools/python/xen/xend/image.py      |   21 ++++++++++++++++-----
 tools/python/xen/xm/create.py       |    7 ++++---
 4 files changed, 36 insertions(+), 15 deletions(-)

diff -r 01ad2654815a -r c0d2838fc10f stubdom/stubdom-dm
--- a/stubdom/stubdom-dm        Thu Jun 18 10:19:25 2009 +0100
+++ b/stubdom/stubdom-dm        Thu Jun 18 10:20:17 2009 +0100
@@ -56,6 +56,10 @@ do
                serial="$2"
                shift
                ;;
+            -monitor)
+               monitor="$2"
+               shift
+               ;;
        esac
     fi
     case "$1" in
@@ -104,6 +108,7 @@ vncpasswd=`xenstore-read /local/domain/0
 vncpasswd=`xenstore-read /local/domain/0/backend/vfb/$domid/0/vncpasswd 
2>/dev/null`
 test "$vncpasswd" && vfb="$vfb, vncpasswd=$vncpasswd"
 test "$keymap" && vfb="$vfb, keymap=$keymap"
+test "$monitor" && vfb="$vfb, monitor=$monitor"
 test "$serial" && vfb="$vfb, serial=$serial"
 echo "vfb = ['$vfb']" >> /etc/xen/stubdoms/$domname-dm
 
diff -r 01ad2654815a -r c0d2838fc10f tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Thu Jun 18 10:19:25 2009 +0100
+++ b/tools/python/xen/xend/XendConfig.py       Thu Jun 18 10:20:17 2009 +0100
@@ -1434,17 +1434,21 @@ class XendConfig(dict):
                    del dev_info['type']
                    log.debug("iwj dev_type=%s vfb setting dev_info['%s']" %
                                (dev_type, vfb_type))
+                # Create serial backends now, the location value is bogus, but 
does not matter
+                i=0
+                chardev=0
                 if dev_info.get('serial') is not None :
-                    # Create two serial backends now, the location value is 
bogus, but does not matter
-                    cfg = self.console_add('vt100', '0')
+                    chardev = chardev + 1
+                if dev_info.get('monitor') is not None :
+                    chardev = chardev + 1
+                if chardev > 0 :
+                    chardev = chardev + 1
+                while i < chardev :
+                    cfg = self.console_add('vt100', str(i))
                     c_uuid = uuid.createString()
                     target['devices'][c_uuid] = ('console', cfg)
                     target['console_refs'].append(c_uuid)
-                    cfg = self.console_add('vt100', '1')
-                    c_uuid = uuid.createString()
-                    target['devices'][c_uuid] = ('console', cfg)
-                    target['console_refs'].append(c_uuid)
-                
+                    i = i + 1
             elif dev_type == 'console':
                 if 'console_refs' not in target:
                     target['console_refs'] = []
diff -r 01ad2654815a -r c0d2838fc10f tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Thu Jun 18 10:19:25 2009 +0100
+++ b/tools/python/xen/xend/image.py    Thu Jun 18 10:20:17 2009 +0100
@@ -286,6 +286,11 @@ class ImageHandler:
             if dev_type == 'vfb':
                 if 'keymap' in dev_info:
                     keymap = dev_info.get('keymap',{})
+                if 'monitor' in dev_info:
+                    ret.append("-serial")
+                    ret.append(dev_info.get('monitor',{}))
+                    ret.append("-monitor")
+                    ret.append("null")
                 if 'serial' in dev_info:
                     ret.append("-serial")
                     ret.append(dev_info.get('serial',{}))
@@ -717,7 +722,7 @@ class LinuxImageHandler(ImageHandler):
         ret = ImageHandler.parseDeviceModelArgs(self, vmConfig)
         # Equivalent to old xenconsoled behaviour. Should make
         # it configurable in future
-        ret = ret + ["-serial", "pty"]
+        ret = ["-serial", "pty"] + ret
         return ret
 
     def getDeviceModelArgs(self, restore = False):
@@ -749,10 +754,16 @@ class HVMImageHandler(ImageHandler):
 
         if not self.display :
             self.display = ''
-        # Do not store sdl and opengl qemu cli options
-        self.vm.storeVm(("image/dmargs", " ".join([ x for x in self.dmargs
-                        if x != "-sdl"
-                        and x != "-disable-opengl" ])),
+
+        store_dmargs = self.dmargs[:]
+        store_dmargs.remove('-sdl')
+        store_dmargs.remove('-disable-opengl')
+        try :
+            midx = store_dmargs.index('-monitor')
+            store_dmargs[midx + 1] = 'pty'
+        except ValueError :
+            pass
+        self.vm.storeVm(("image/dmargs", " ".join(store_dmargs)),
                         ("image/device-model", self.device_model),
                         ("image/display", self.display))
         self.vm.permissionsVm("image/dmargs", { 'dom': self.vm.getDomid(), 
'read': True } )
diff -r 01ad2654815a -r c0d2838fc10f tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Thu Jun 18 10:19:25 2009 +0100
+++ b/tools/python/xen/xm/create.py     Thu Jun 18 10:20:17 2009 +0100
@@ -354,7 +354,7 @@ gopts.var('irq', val='IRQ',
          For example 'irq=7'.
          This option may be repeated to add more than one IRQ.""")
 
-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",
+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",
           fn=append_value, default=[],
           use="""Make the domain a framebuffer backend.
           Both sdl=1 and vnc=1 can be enabled at the same time.
@@ -367,7 +367,8 @@ gopts.var('vfb', val="vnc=1,sdl=1,vncunu
           given DISPLAY and XAUTHORITY, which default to the current user's
           ones.  OpenGL will be used by default unless opengl is set to 0.
           keymap overrides the XendD configured default layout file.
-         Serial adds a second serial support to qemu.""")
+         Serial adds a second serial support to qemu.
+          Monitor adds a backend for the stubdom monitor.""")
 
 gopts.var('vif', 
val="type=TYPE,mac=MAC,bridge=BRIDGE,ip=IPADDR,script=SCRIPT," + \
           "backend=DOM,vifname=NAME,rate=RATE,model=MODEL,accel=ACCEL",
@@ -815,7 +816,7 @@ def configure_vfbs(config_devs, vals):
         for (k,v) in d.iteritems():
             if not k in [ 'vnclisten', 'vncunused', 'vncdisplay', 'display',
                           'videoram', 'xauthority', 'sdl', 'vnc', 'vncpasswd',
-                          'opengl', 'keymap', 'serial' ]:
+                          'opengl', 'keymap', 'serial', 'monitor' ]:
                 err("configuration option %s unknown to vfbs" % k)
             config.append([k,v])
         if not d.has_key("keymap"):

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.