Skip to contentSkip to conversation

Console Daemon

PATCH In review Anthony Liguori 3 participants 6 messages Jul 26, 2005 – Aug 2, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Console Daemon

Howdy,

This is the first patch to move the console code out of Xend and into a separate daemon. In this patch I've included the daemon and a front-end. I've also have the console code removed from Xend locally but I wanted to clarify a few things first before submitting that.

Here's how it works:

1) Daemon sits on control channel (via xcs) waiting for console messages
2) Buffers all console data received
3) Publishes the location of a tty that can be used for reading in /console/<domid>/tty
4) Reads a value from the store to determine what the limit of console data should be (/console/<domid>/limit) to prevent DoS attacks

Using it is quite simple, just run consoled and use the xc_console program to connect to the console. It uses syslog for logging.

My current Xend patch just removes all of the console handling code from Xend and executes /usr/libexec/xen/xc_console with the right domid for the xm console command. I choose to use an external program instead of the existing console_client.py because I already had the code and thought it would be useful to have an exec'able program so we could drop privileges. Happy to use the console_client.py code though if that's desired.

The only current issue is that I'd like to store the tty info in <home>/console/tty since it's just another device. However, Xend uses UUIDs so figuring out the home path is difficult. Are we going to stick with this home path convention? It would be a lot nicer if we used domids in the home path so that we could easily lookup info without having to search the whole /domain directory. We can still keep UUIDs within the home path. I'll add that to my patch if that's agreeable.

It will be easy to modify consoled to support the new kernel console driver when it's ready too.

Regards,

Anthony Liguori

tools/Makefile +1 -0
diff -r 48aed1403fe3 tools/Makefile
@@ -13,6 +13,7 @@
 SUBDIRS += pygrub
 SUBDIRS += firmware
 SUBDIRS += policy
+SUBDIRS += consoled
 
 .PHONY: all install clean check check_clean ioemu eioemuinstall ioemuclean
 
tools/Rules.mk +2 -0
diff -r 48aed1403fe3 tools/Rules.mk
@@ -4,6 +4,8 @@
 
 XEN_XC             = $(XEN_ROOT)/tools/python/xen/lowlevel/xc
 XEN_LIBXC          = $(XEN_ROOT)/tools/libxc
+XEN_XCS            = $(XEN_ROOT)/tools/xcs
+XEN_XENSTORE       = $(XEN_ROOT)/tools/xenstore
 
 ifeq ($(XEN_TARGET_ARCH),x86_32)
 CFLAGS  += -m32 -march=i686
tools/consoled/Makefile new file +48 -0

48 lines not on this page · raw message

tools/consoled/io.c new file +328 -0

328 lines not on this page · raw message

tools/consoled/io.h new file +26 -0
diff -r 48aed1403fe3 tools/consoled/io.h
@@ -0,0 +1,26 @@
+/*\
+ *  Copyright (C) International Business Machines  Corp., 2005
+ *  Author(s): Anthony Liguori <[email protected]>
+ *
+ *  Xen Console Daemon
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; under version 2 of the License.
+ * 
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ * 
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+\*/
+
+#ifndef CONSOLED_IO_H
+#define CONSOLED_IO_H
+
+void handle_io(void);
+
+#endif
tools/consoled/main.c new file +93 -0

93 lines not on this page · raw message

tools/consoled/utils.c new file +251 -0

251 lines not on this page · raw message

tools/consoled/utils.h new file +47 -0

47 lines not on this page · raw message

tools/consoled/xc_console.c new file +236 -0

236 lines not on this page · raw message

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

#1 lore raw
Quoted 7 lines · Anthony Liguori

Howdy,

This is the first patch to move the console code out of Xend and into a separate daemon. In this patch I've included the daemon and a front-end. I've also have the console code removed from Xend locally but I wanted to clarify a few things first before submitting that.

Anthony, there is a small bug in xc_console.c::console_loop()

--
if (len == 0 && len == -1) {
--

And is there a better name than xc_console?

that is great to see this code out. i am waiting to see the full patch.

regards,
aq

#2 lore raw
Quoted 12 lines · aq

On 7/26/05, Anthony Liguori <[email protected]> wrote:

Anthony, there is a small bug in xc_console.c::console_loop()

--
if (len == 0 && len == -1) {
--

And is there a better name than xc_console?

Fixed locally. Thanks aq!

Regards,

Anthony Liguori

Quoted 8 lines

that is great to see this code out. i am waiting to see the full patch.

regards,
aq

#3 lore raw
In reply to Anthony Liguori
Quoted 2 lines · Anthony Liguori

This is the first patch to move the console code out of Xend and into a separate daemon. In this patch I've included the daemon and a front-end. I've also have the console code removed from Xend locally but I wanted to clarify a few things first before submitting that.

I checked in consoled. Can you send any further fixes, and code to plumb through xend?

Is it possible to make it configurable where console i/o goes (e.g., tcp socket as an option instead of tty?).

-- Keir

#4 lore raw
Quoted 10 lines · Keir Fraser
Quoted 2 lines · Anthony Liguori

This is the first patch to move the console code out of Xend and into a separate daemon. In this patch I've included the daemon and a front-end. I've also have the console code removed from Xend locally but I wanted to clarify a few things first before submitting that.

I checked in consoled. Can you send any further fixes, and code to plumb through xend?

Is it possible to make it configurable where console i/o goes (e.g., tcp socket as an option instead of tty?).

We can make it listen on tcp sockets by default or we can add another layer to expose the tty's as tcp sockets. I prefer the later. Thoughts?

Regards,

Anthony Liguori

Quoted 3 lines

-- Keir

#5 lore raw
In reply to Anthony Liguori
Quoted 1 line · Anthony Liguori

My current Xend patch just removes all of the console handling code from Xend and executes /usr/libexec/xen/xc_console with the right domid for the xm console command. I choose to use an external program instead of the existing console_client.py because I already had the code and thought it would be useful to have an exec'able program so we could drop privileges. Happy to use the console_client.py code though if that's desired.

You can exec the python interpreter?

-- Keir