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

[Xen-devel] [PATCH] qemu monitor support in stubdoms



Hi all,
this patch adds 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>

---

diff -r a330c9935bc8 stubdom/stubdom-dm
--- a/stubdom/stubdom-dm        Tue Jun 16 18:19:15 2009 +0100
+++ b/stubdom/stubdom-dm        Tue Jun 16 19:03:21 2009 +0100
@@ -56,6 +56,10 @@
                serial="$2"
                shift
                ;;
+            -monitor)
+               monitor="$2"
+               shift
+               ;;
        esac
     fi
     case "$1" in
@@ -104,6 +108,7 @@
 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 a330c9935bc8 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Tue Jun 16 18:19:15 2009 +0100
+++ b/tools/python/xen/xend/XendConfig.py       Tue Jun 16 19:03:21 2009 +0100
@@ -1433,17 +1433,21 @@
                    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 a330c9935bc8 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Tue Jun 16 18:19:15 2009 +0100
+++ b/tools/python/xen/xend/image.py    Tue Jun 16 19:03:21 2009 +0100
@@ -286,6 +286,11 @@
             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 @@
         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 @@
 
         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 a330c9935bc8 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Tue Jun 16 18:19:15 2009 +0100
+++ b/tools/python/xen/xm/create.py     Tue Jun 16 19:03:21 2009 +0100
@@ -352,7 +352,7 @@
          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.
@@ -365,7 +365,8 @@
           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",
@@ -816,7 +817,7 @@
         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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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