Files
xen/tools/python/scripts
Keir Fraser 11e1149fe0 tools: Always use sane upstream (`native') python paths
Previously, by default we would install our python modules into
/usr/lib/python/xen, for example /usr/lib/python/xen/__init__.py.
Upstream python's standard install location (a) includes the Python
version number and (b) puts things in site-packages by default.

Our best conjecture for the reason for this was an attempt to make the
installs portable between different python versions.  However, that
doesn't work because compiled python modules (.pyc), and C python
extensions corresponding to one version of python, are not compatible
across different versions of python.

This is why upstream include the version number.

site-packages is the standard location for locally-installed packages
and is automatically included on the python search path.

In this change, we abandon our own unusual python path setup:

 * Invoke setup.py in an entirely standard manner.  We pass
   PREFIX and DESTDIR using the appropriate options provided by
   setup.py for those purposes (adding them to setup.py calls
   which were previously lacking them).

 * Since the installation locations are now on the standard
   python path, we no longer need to add anything to the path
   in any of our python utilities.  Therefore remove all that
   code from every python script.  (Many of these scripts
   unconditionally added /usr/lib/python and /usr/lib64/python which
   is wrong even in the old world.)

 * There is no longer any special `Xen python path'.  xen-python-path
   is no longer needed.  It is no longer called by anything in our
   tree.  However since out-of-tree callers may still invoke it, we
   retain it.  It now prints a fixed string referring to a directory
   which does not to exist; callers (who use it to augment their
   python path) will thus add a nonexistent directory to their python
   path which is harmless.

 * Remove various workarounds including use of setup.py --home
   (which is intended for something completely different).

 * Remove tests for the XEN_PYTHON_NATIVE_INSTALL build-time
   environment variable.  The new behaviour is the behaviour which we
   should have had if this variable had been set.  That is, it is now
   as if this variable was always set but also bugs in the resulting
   install have been fixed.

This should be a proper fix for the bug addressed by c/s 19515.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-04-08 19:13:04 +01:00
..
…

Xen API Test
============

xapi.py is a simple command line tool to test the functionality of a
domain lifecycle supporting, Xen API talking version of Xend.

Creating a VM is slightly more work under the Xen API. The differences
with this and xm is:

1. None of the devices are created during vm-create. You must use
   vbd-create and vif-create to attach a new device to the VM.

2. VM's that are created using vm-create will not start by
   default. You must use vm-start to "start" the domain.

3. VM's that are created using vm-create will not be removed on
   shutdown. You must remove it using vm-delete.

Example Configuration Files
---------------------------

xapi.py uses a simple python configuration file similar to xm in the
face of the lack of any other reasonable format.

All the fields are directly mapped to the arguments that are in the
Xen API constructore for the respective classes.

xapi.domcfg.py: example configuration for a paravirtualised domain.
xapi.vbdcfg.py: example configuration for a file based block device.
xapi.vifcfg.py: example configuration for a simple bridged network
                device.

Example Session
---------------

xapi.py vm-list
xapi.py vm-create xapi.domcfg.py
xapi.py vbd-create <DomainName> xapi.vbdcfg.py
xapi.py vif-create <DomainName> xapi.vifcfg.py

Notes
-----

Currently lacking:

1. Any real authentication. XendAuthSessions need to be filled in with
   a proper authentication implementation either using PAM or other
   means.