library.xen 3.8 KB
Newer Older
D
Daniel Veillard 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14

          About a libxen library
	  ======================

Functional description:
-----------------------

  Small C library to be able to control Xen Linux guest, i.e.
    provide the following operations for Xen guest domains running Linux
    from domain 0 code linked to the library (running as root):
     - start
     - stop
     - suspend
     - resume
15
     - monitor
D
Daniel Veillard 已提交
16 17
  More advanced features should be allowed as future extensions, but
  are not expected to be provided in first shipment.
18

D
Daniel Veillard 已提交
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
  Open enough Licence that customers can link their apps to it (LGPL)

  Small and contained enough that we can use it as a way to
  provide API and ABI stability in spite if the evolution of Xen
  existing API and hypervisor calls.

The current state of Xen userland:
----------------------------------

  the existing Xen 3.0 userland code is mostly based on tiny C functions
using direct hypervisor calls (or /proc/xen/ interfaces) and a lot of
Python code on top driving the hypervisor.
  The C code is relatively hairy, functions with 10 parameters or more
are not uncommon, and it is very low level usually without comment about
the function or its arguments. They are usually only called once in the
whole tree by the python bindings. In essence it looks like the Xen project
35 36
was not implemented with the idea of reusing that part of the code by
applications.
D
Daniel Veillard 已提交
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
  Indeed most of the userland code coming with Xen is built on Python,
like xend the xen daemon running on domain 0 or the xenstored daemon which
manage the state of the domains launched.

Rebuilding a library ?:
-----------------------

  Providing a library at the C level to drive domain execution is in a
very large part a rimplementation of existing code but in a different way
and somehow with different goals for the code. The existing Licence (GPL)
makes it uneasy, we can't copy GPL code to put it in a LGPL'ed library,
and rewriting everything while looking at the Xen code will inevitably
lead to code similarities especially with this kind of system code. Plus
we will still need to run xend and probably xenstored to not diverge
completely from Xen existing code base.

The IBM way:
------------

  Here is supposition about code that I can't instanciate except by looking
57
at said code but it looks that IBM also needed a C programmatic API to
D
Daniel Veillard 已提交
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
manage the Xen domain definitions. Their solution was to build (Rusty
Russell did this) an LGPL C API connecting directly to the xenstore
daemon (./tools/xenstore/*). In a way this is quite more fragile as it depends
on the whole existing stack of the Xen code, but it isolate the API
from the implementation details of the current Xen source (API in
./tools/xenstore/xs.h). The goal seems to be more about testing and controlling
the xen store daemon, but it shows a different approach to decouple client
API/ABI from the Xen existing code.

Open question:
---------------

  To what extent should libxen be a rewrite or an isolation layer around
some of the existing code ?

  Rewrite:

    Pros:
     - avoid the GPL Licence problem potentially more users
     - allow do build a cleaner more stable layer
78
     - the existing code is frightening
D
Daniel Veillard 已提交
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
    Cons:
     - awful lot of work debugging very hard
     - will still require existing Xen code to be running
     - splitting interfaces is hard politically and lower the
       Open Source efforts toward the project

  Wrappers on top of existing code:

    Pros:
     - much smaller code rewrite
     - benefits from the bugfixes injected by other patchers upstream
    Cons:
     - Licence constraint GPL only for apps
     - API/ABI isolation may not be easier in that way

  Potentially the API could be implemented as a layer on top of the existing
libxc C code library and then progressively migrating out the existing
96
dependence to Xen code as the interfaces stabilize.
D
Daniel Veillard 已提交
97 98 99 100

Daniel Veillard <veillard@redhat.com>

Mon Oct 24 18:40:19 CEST 2005