Skip to contentSkip to conversation

Make Xend use consoled and xc_console

PATCH In review Anthony Liguori 2 participants 3 messages Aug 3, 2005 – Aug 19, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make Xend use consoled and xc_console

The attached patch removes all of the console handling code from Xend and changes xm to simply exec /usr/libexec/xen/xc_console.

I've done a pretty good amount of testing and this seems to clear up all of the Xend console issues in bugzilla.

This is a pretty big change to Xend though with a lot of deleted code so I'd appreciate if people more familiar with the Xend codebase could look through it critically.

In addition to the patch, the following files are no longer used:

tools/python/xen/util/console_client.py
tools/python/xen/xend/XendConsole.py
tools/python/xen/xend/server/SrvConsole.py
tools/python/xen/xend/server/SrvConsoleDir.py
tools/python/xen/xend/server/console.py

Regards,

Anthony Liguori

#1 lore raw

Sorry, forgot patch.

Quoted 16 lines · Anthony Liguori

The attached patch removes all of the console handling code from Xend and changes xm to simply exec /usr/libexec/xen/xc_console.

I've done a pretty good amount of testing and this seems to clear up all of the Xend console issues in bugzilla.

This is a pretty big change to Xend though with a lot of deleted code so I'd appreciate if people more familiar with the Xend codebase could look through it critically.

In addition to the patch, the following files are no longer used:

tools/python/xen/util/console_client.py
tools/python/xen/xend/XendConsole.py
tools/python/xen/xend/server/SrvConsole.py
tools/python/xen/xend/server/SrvConsoleDir.py
tools/python/xen/xend/server/console.py

Regards,

Quoted 9 lines

Anthony Liguori

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

tools/Makefile +1 -1
diff -r 60c4cd9ebaa1 tools/Makefile
@@ -13,7 +13,7 @@
 #SUBDIRS += pygrub
 SUBDIRS += firmware
 SUBDIRS += security
-#SUBDIRS += consoled
+SUBDIRS += consoled
 
 .PHONY: all install clean check check_clean ioemu eioemuinstall ioemuclean
 
tools/misc/xend +2 -0
diff -r 60c4cd9ebaa1 tools/misc/xend
@@ -130,6 +130,8 @@
         return status >> 8
     elif sys.argv[1] == 'start':
         start_xcs()
+        if os.fork() == 0:
+            os.execvp('/usr/sbin/consoled', ['/usr/sbin/consoled']);
         return daemon.start()
     elif sys.argv[1] == 'trace_start':
         start_xcs()
tools/python/xen/xend/XendClient.py +1 -16
diff -r 60c4cd9ebaa1 tools/python/xen/xend/XendClient.py
@@ -5,9 +5,7 @@
 Supports inet or unix connection to xend.
 
 This API is the 'control-plane' for xend.
-The 'data-plane' is done separately. For example, consoles
-are accessed via sockets on xend, but the list of consoles
-is accessible via this API.
+The 'data-plane' is done separately.
 """
 import os
 import sys
@@ -145,9 +143,6 @@
 
     def domainurl(self, id=''):
         return self.url.relative('domain/' + str(id))
-
-    def consoleurl(self, id=''):
-        return self.url.relative('console/' + str(id))
 
     def deviceurl(self, id=''):
         return self.url.relative('device/' + str(id))
@@ -317,16 +312,6 @@
                              {'op'      : 'device_configure',
                               'idx'     : idx,
                               'config'  : fileof(config) })
-
-    def xend_consoles(self):
-        return self.xendGet(self.consoleurl())
-
-    def xend_console(self, id):
-        return self.xendGet(self.consoleurl(id))
-
-    def xend_console_disconnect(self, id):
-        return self.xendPost(self.consoleurl(id),
-                             {'op'      : 'disconnect'})
 
     def xend_vnets(self):
         return self.xendGet(self.vneturl())
tools/python/xen/xend/XendDomainInfo.py +1 -40

97 lines not on this page · raw message

tools/python/xen/xend/XendRoot.py +0 -19
diff -r 60c4cd9ebaa1 tools/python/xen/xend/XendRoot.py
@@ -69,12 +69,6 @@
 
     """Default path the unix-domain server listens at."""
     xend_unix_path_default = '/var/lib/xend/xend-socket'
-
-    """Default interface address xend listens at for consoles."""
-    console_address_default   = 'localhost'
-
-    """Default port xend serves consoles at. """
-    console_port_base_default = '9600'
 
     dom0_min_mem_default = '0'
 
@@ -302,19 +296,6 @@
         """
         return self.get_config_value("xend-unix-path", self.xend_unix_path_default)
 
-    def get_console_address(self):
-        """Get the address xend listens at for its console ports.
-        This defaults to 'localhost', allowing only the localhost to connect
-        to the console ports.  Setting this to the empty string, allows all
-        hosts to connect.
-        """
-        return self.get_config_value('console-address', self.console_address_default)
-
-    def get_console_port_base(self):
-        """Get the base port number used to generate console ports for domains.
-        """
-        return self.get_config_int('console-port-base', self.console_port_base_default)
-
     def get_block_script(self, type):
         return self.get_config_value('block-%s' % type, '')
 
tools/python/xen/xend/server/SrvDomain.py +0 -10
diff -r 60c4cd9ebaa1 tools/python/xen/xend/server/SrvDomain.py
@@ -4,7 +4,6 @@
 
 from xen.xend import sxp
 from xen.xend import XendDomain
-from xen.xend import XendConsole
 from xen.xend import PrettyPrint
 from xen.xend.Args import FormFn
 
@@ -18,7 +17,6 @@
         SrvDir.__init__(self)
         self.dom = dom
         self.xd = XendDomain.instance()
-        self.xconsole = XendConsole.instance()
 
     def op_configure(self, op, req):
         """Configure an existing domain.
@@ -208,14 +206,6 @@
             self.print_path(req)
             #self.ls()
             req.write('<p>%s</p>' % self.dom)
-            if self.dom.console:
-                cinfo = self.dom.console
-                cid = str(cinfo.console_port)
-                #todo: Local xref: need to know server prefix.
-                req.write('<p><a href="/xend/console/%s">Console %s</a></p>'
-                          % (cid, cid))
-                req.write('<p><a href="%s">Connect to console</a></p>'
-                          % cinfo.uri())
             if self.dom.config:
                 req.write("<code><pre>")
                 PrettyPrint.prettyprint(self.dom.config, out=req)
tools/python/xen/xend/server/SrvRoot.py +0 -1
diff -r 60c4cd9ebaa1 tools/python/xen/xend/server/SrvRoot.py
@@ -15,7 +15,6 @@
     subdirs = [
         ('node',    'SrvNode'       ),
         ('domain',  'SrvDomainDir'  ),
-        ('console', 'SrvConsoleDir' ),
         ('vnet',    'SrvVnetDir'    ),
         ]
 
tools/python/xen/xend/server/SrvServer.py +1 -1
diff -r 60c4cd9ebaa1 tools/python/xen/xend/server/SrvServer.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 # Copyright (C) 2004 Mike Wray <[email protected]>
 
-"""Example xend HTTP and console server.
+"""Example xend HTTP
 
    Can be accessed from a browser or from a program.
    Do 'python SrvServer.py' to run the server.
tools/python/xen/xend/server/event.py +0 -8
diff -r 60c4cd9ebaa1 tools/python/xen/xend/server/event.py
@@ -128,16 +128,8 @@
     def op_pretty(self, name, req):
         self.pretty = 1
 
-    def op_console_disconnect(self, name, req):
-        id = sxp.child_value(req, 'id')
-        if not id:
-            raise XendError('Missing console id')
-        id = int(id)
-        self.daemon.console_disconnect(id)
-
     def op_info(self, name, req):
         val = ['info']
-        #val += self.daemon.consoles()
         #val += self.daemon.blkifs()
         #val += self.daemon.netifs()
         #val += self.daemon.usbifs()
tools/python/xen/xend/server/messages.py +0 -10
diff -r 60c4cd9ebaa1 tools/python/xen/xend/server/messages.py
@@ -16,16 +16,6 @@
 See below.
 """
 msg_formats = {}
-
-#============================================================================
-# Console message types.
-#============================================================================
-
-CMSG_CONSOLE  = 0
-
-console_formats = { 'console_data': (CMSG_CONSOLE, 0) }
-
-msg_formats.update(console_formats)
 
 #============================================================================
 # Block interface message types.
tools/python/xen/xm/create.py +8 -21
diff -r 60c4cd9ebaa1 tools/python/xen/xm/create.py
@@ -7,6 +7,7 @@
 import string
 import sys
 import socket
+import commands
 
 import xen.lowlevel.xc
 
@@ -16,8 +17,6 @@
 from xen.xend.XendBootloader import bootloader
 from xen.xend import XendRoot; xroot = XendRoot.instance()
 from xen.util import blkif
-
-from xen.util import console_client
 
 from xen.xm.opts import *
 
@@ -144,10 +143,6 @@
           fn=set_float, default=None,
           use="""Set the new domain's cpu weight.
           WEIGHT is a float that controls the domain's share of the cpu.""")
-
-gopts.var('console', val='PORT',
-          fn=set_int, default=None,
-          use="Console port to use. Default is 9600 + domain id.")
 
 gopts.var('restart', val='onreboot|always|never',
           fn=set_value, default=None,
@@ -471,8 +466,6 @@
         config.append(['backend', ['netif']])
     if vals.restart:
         config.append(['restart', vals.restart])
-    if vals.console:
-        config.append(['console', vals.console])
 
     if vals.bootloader:
         run_bootloader(opts, config, vals)
@@ -620,8 +613,8 @@
 
     @param opts:   options
     @param config: configuration
-    @return: domain id, console port
-    @rtype:  (int, int)
+    @return: domain id
+    @rtype:  int
     """
 
     try:
@@ -634,19 +627,13 @@
         opts.err(str(ex))
 
     dom = sxp.child_value(dominfo, 'name')
-    console_info = sxp.child(dominfo, 'console')
-    if console_info:
-        console_port = int(sxp.child_value(console_info, 'console_port'))
-    else:
-        console_port = None
 
     if not opts.vals.paused:
         if server.xend_domain_unpause(dom) < 0:
             server.xend_domain_destroy(dom)
             opts.err("Failed to unpause domain %s" % dom)
-    opts.info("Started domain %s, console on port %d"
-              % (dom, console_port))
-    return (dom, console_port)
+    opts.info("Started domain %s" % (dom))
+    return int(sxp.child_value(dominfo, 'id'))
 
 def get_dom0_alloc():
     """Return current allocation memory of dom0 (in MB). Return 0 on error"""
@@ -709,10 +696,10 @@
         if dom0_min_mem != 0:
             balloon_out(dom0_min_mem, opts)
 
-        (dom, console) = make_domain(opts, config)
+        dom = make_domain(opts, config)
         if opts.vals.console_autoconnect:
-            path = "/var/lib/xend/console-%s" % console
-            console_client.connect('localhost', console, path=path)
+            cmd = "/usr/libexec/xen/xc_console %d" % dom
+            os.execvp('/usr/libexec/xen/xc_console', cmd.split())
         
 if __name__ == '__main__':
     main(sys.argv)
tools/python/xen/xm/main.py +7 -38

81 lines not on this page · raw message

tools/python/xen/util/console_client.py deleted +0 -108

108 lines not on this page · raw message

tools/python/xen/xend/XendConsole.py deleted +0 -44

44 lines not on this page · raw message

tools/python/xen/xend/server/SrvConsole.py deleted +0 -41

41 lines not on this page · raw message

tools/python/xen/xend/server/SrvConsoleDir.py deleted +0 -59

59 lines not on this page · raw message

tools/python/xen/xend/server/console.py deleted +0 -391

391 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

PATCH 1/1 mini-os updated

In reply to Anthony Liguori

Mini-os updated to use the new timer interface.

Cheers
Gregor

# HG changeset patch
# User [email protected]
# Node ID 3068565f6a32fde5fe1c11d44fd08d876d2b633f # Parent 082a537ff4dec66574788126b3b047ef76e59803 Mini-os updated to use the new time interface.

extras/mini-os/include/time.h +8 -2
diff -r 082a537ff4de -r 3068565f6a32 extras/mini-os/include/time.h
@@ -28,7 +28,7 @@
  * of real time into system time 
  */
 typedef s64 s_time_t;
-#define NOW()                   ((s_time_t)get_s_time())
+#define NOW()                   ((s_time_t)monotonic_clock())
 #define SECONDS(_s)             (((s_time_t)(_s))  * 1000000000UL )
 #define TENTHS(_ts)             (((s_time_t)(_ts)) * 100000000UL )
 #define HUNDREDTHS(_hs)         (((s_time_t)(_hs)) * 10000000UL )
@@ -36,7 +36,8 @@
 #define MICROSECS(_us)          (((s_time_t)(_us)) * 1000UL )
 #define Time_Max                ((s_time_t) 0x7fffffffffffffffLL)
 #define FOREVER                 Time_Max
-
+#define NSEC_TO_USEC(_nsec)     (_nsec / 1000UL)
+#define NSEC_TO_SEC(_nsec)      (_nsec / 1000000000ULL)
 
 /* wall clock time  */
 typedef long time_t;
@@ -44,6 +45,11 @@
 struct timeval {
 	time_t		tv_sec;		/* seconds */
 	suseconds_t	tv_usec;	/* microseconds */
+};
+
+struct timespec {
+    time_t      ts_sec;
+    long        ts_nsec;
 };
 
 
extras/mini-os/kernel.c +0 -14
diff -r 082a537ff4de -r 3068565f6a32 extras/mini-os/kernel.c
@@ -132,20 +132,6 @@
     i = 0;
     for ( ; ; ) 
     {      
-        if(i >= 1000)         
-        {
-            {
-                unsigned long saved;
-                __asm__ ("movl %%esp, %0"
-                         :"=r"(saved)  /* y is output operand */
-                            /* x is input operand */);
-//                        :"a"); /* %eax is clobbered register */
-                printk("ESP=0x%lx\n", saved);
-            }
-            
-            printk("1000 bloks\n");
-            i=0;            
-        }
 //        HYPERVISOR_yield();
         block(1);
         i++;
extras/mini-os/time.c +137 -121

303 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel