docs: Add documentation for libvirt driver.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c5baf9c0 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c5baf9c0 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c5baf9c0 Branch: refs/heads/trunk Commit: c5baf9c061fd8b912a49ff4ae0b86313f23212cf Parents: 7012c6d Author: Tomaz Muraus <[email protected]> Authored: Sun Jan 12 22:57:01 2014 +0100 Committer: Tomaz Muraus <[email protected]> Committed: Sun Jan 12 22:57:01 2014 +0100 ---------------------------------------------------------------------- docs/compute/drivers/libvirt.rst | 81 ++++++++++++++++++++ .../compute/libvirt/connect_qemu_kvm.py | 5 ++ .../compute/libvirt/connect_virtualbox.py | 5 ++ 3 files changed, 91 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/c5baf9c0/docs/compute/drivers/libvirt.rst ---------------------------------------------------------------------- diff --git a/docs/compute/drivers/libvirt.rst b/docs/compute/drivers/libvirt.rst new file mode 100644 index 0000000..cd200ba --- /dev/null +++ b/docs/compute/drivers/libvirt.rst @@ -0,0 +1,81 @@ +Libvirt Compute Driver Documentation +==================================== + +.. note:: + + Libvirt driver in current version of Libcloud is still experimental and + doesn't support advanced functionality like creating a node and so on. + +`libvirt`_ is an open source toolkit for managing different hypervisors. It +ca be used to manage Xen, KVM, Vmware ESX, QEMU and many other hypervisors. + +.. figure:: /_static/images/provider_logos/libvirt.png + :align: center + :width: 200 + :target: http://libvirt.org + +For full list of the supported hypervisors, please see the +`Hypervisor drivers <http://libvirt.org/drivers.html#hypervisor>`_ page. + +Requirements +------------ + +To be able to use this driver you need to install libvirt client and +`libvirt-python`_ Python package. + +Libvirt client is available in standard package repositories of most popular +Linux distributions which means you can install it using your distribution's +package manager. + +Example #1 - Ubuntu, Debian, etc. (apt-get): + +.. sourcecode:: bash + + sudo apt-get install libvirt-client + +Example #2 - Fedora, RHEL, etc. (yum): + +.. sourcecode:: bash + + sudo yum install libvirt-client + +Python package can be installed using pip: + +.. sourcecode:: bash + + pip install libvirt-python + +Connecting to a hypervisor +-------------------------- + +To instantiate the driver and connect to a hypervisor, you need to pass ``uri`` +argument to the driver constructor. + +This argument tells the driver which libvirt driver (qemu, xen, virtualbox, +etc.) this connection refers to. For a full list of supported URIs, please +refer to the `Connection URIs <http://libvirt.org/uri.html>` page. + +Example 1 - Connecting to QEMU and KVM hypervisor +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This example shows how to connect to a local QEMU or KVM instance. + +.. literalinclude:: /examples/compute/libvirt/connect_qemu_kvm.py + :language: python + +For more details and information on how to connect to a remote instance, please +see `Connections to QEMU driver <http://libvirt.org/drvqemu.html#uris>`_ page. + +Example 2 - Connecting to Virtualbox hypervisor +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This example shows how to connect to a local Virtualbox instance. + +.. literalinclude:: /examples/compute/libvirt/connect_virtualbox.py + :language: python + +For more details and information on how to connect to a remote instance, please +see `VirtualBox hypervisor driver <http://libvirt.org/drvvbox.html>`_ page. + +.. _`libvirt`: http://libvirt.org +.. _`libvirt-python`: https://pypi.python.org/pypi/libvirt-python http://git-wip-us.apache.org/repos/asf/libcloud/blob/c5baf9c0/docs/examples/compute/libvirt/connect_qemu_kvm.py ---------------------------------------------------------------------- diff --git a/docs/examples/compute/libvirt/connect_qemu_kvm.py b/docs/examples/compute/libvirt/connect_qemu_kvm.py new file mode 100644 index 0000000..775ddd2 --- /dev/null +++ b/docs/examples/compute/libvirt/connect_qemu_kvm.py @@ -0,0 +1,5 @@ +from libcloud.compute.types import Provider +from libcloud.compute.providers import get_driver + +cls = get_driver(Provider.LIBVIRT) +driver = cls(uri='qemu:///system') http://git-wip-us.apache.org/repos/asf/libcloud/blob/c5baf9c0/docs/examples/compute/libvirt/connect_virtualbox.py ---------------------------------------------------------------------- diff --git a/docs/examples/compute/libvirt/connect_virtualbox.py b/docs/examples/compute/libvirt/connect_virtualbox.py new file mode 100644 index 0000000..af2c3de --- /dev/null +++ b/docs/examples/compute/libvirt/connect_virtualbox.py @@ -0,0 +1,5 @@ +from libcloud.compute.types import Provider +from libcloud.compute.providers import get_driver + +cls = get_driver(Provider.LIBVIRT) +driver = cls(uri='vbox:///session')
