[libvirt] [PATCH v2 5/6] util: Add helpers for safe domain console operations
eblake at redhat.com
Wed Dec 14 00:31:45 UTC 2011
On 12/07/2011 11:08 AM, Peter Krempa wrote:
> This patch adds a set of functions used in creating console streams for
> domains using PTYs and ensures mutualy exculsive access to the PTYs.
s/mutualy exculsive/mutually exclusive/
> If mutualy exclusive access is not used, two clients may open the same
> console, which results into corruption on both clients as both of them
> race to read data from the PTY.
> Two approaches are used to ensure this:
> 1) Internal data structure holding open PTYs.
> This is used internaly and enables the user to forcibly
> terminate another console connection eg. when somebody leaves
> the console open on another host.
> 2) UUCP style lock files:
> This uses UUCP lock files according to the FHS
> ( http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLOCKLOCKFILES )
Looks like I've got some reading to do.
> to check if other programs (like minicom) are not using the pty
> device of the console.
> This feature is disabled by default and may be enabled using
> configure parameter
> or --with-console-lock-files=auto (which tries to infer the
> location from OS used (currently only linux).
> On usual linux systems, normal users may not write to the
> /var/lock directory containing the locks. This poses problems
> while in session mode. If the current user has no access to the
> lockfile directory, check for presence of the file is still
> done, but no lock file is created. This does NOT result into an
> * configure.ac
> - add option to enable UUCP style PTY file locks
> * src/Makefile.am
> - add new files to be built with util module
> * src/libvirt_private.syms
> - add private symbol definition
> * src/util/domain_safe_console.c
> - implementation of safe console handling
> * src/util/domain_safe_console.h
> - header files
> configure.ac | 37 +++-
> src/Makefile.am | 5 +-
> src/libvirt_private.syms | 6 +
> src/util/domain_safe_console.c | 399 ++++++++++++++++++++++++++++++++++++++++
> src/util/domain_safe_console.h | 28 +++
> 5 files changed, 466 insertions(+), 9 deletions(-)
> create mode 100644 src/util/domain_safe_console.c
> create mode 100644 src/util/domain_safe_console.h
I've run out of time to finish my review of this today, but the idea
Eric Blake eblake at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 620 bytes
Desc: OpenPGP digital signature
More information about the libvir-list