openstack-manuals/doc/training-guides/sources/cinder/development.environment.xml
Don Domingo 3e1100a70a Applied conventions for "e.g."
As per convention, we should avoid using "e.g." (we should use "for
example" instead). Found and replaced them accordingly; didn't touch
instances that looked copy-pasted from stdout.

Change-Id: I45aae1a30b872f916744a6a33f6888abe8cf6eb0
Partial-Bug: #1217503
2014-01-20 19:59:27 +01:00

146 lines
6.0 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="5.0"
xml:id="development.environment">
<title>Development.Environment</title>
<section xml:id="header">
<title>Header</title>
<para>
..
Copyright 2010-2011 United States Government as represented by the
Administrator of the National Aeronautics and Space Administration.
All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
</para>
</section>
<section xml:id="Setting-Up-a-Development-Environment">
<title>Setting-Up-A-Development-Environment</title>
<para>
====================================
This page describes how to setup a working Python development
environment that can be used in developing cinder on Ubuntu, Fedora or
Mac OS X. These instructions assume you're already familiar with
git. Refer to GettingTheCode_ for additional information.
.. _GettingTheCode: http://wiki.openstack.org/GettingTheCode
Following these instructions will allow you to run the cinder unit
tests. If you want to be able to run cinder (i.e., launch VM instances),
you will also need to install libvirt and at least one of the
`supported hypervisors`_. Running cinder is currently only supported on
Linux, although you can run the unit tests on Mac OS X. See
:doc:`../quickstart` for how to get a working version of OpenStack
Compute running as quickly as possible.
.. _supported hypervisors: http://wiki.openstack.org/HypervisorSupportMatrix
</para>
</section>
<section xml:id="Virtual-environments">
<title>Virtual-Environments</title>
<para>
--------------------
Cinder development uses `virtualenv [http://pypi.python.org/pypi/virtualenv]`__ to track and manage Python
dependencies while in development and testing. This allows you to
install all of the Python package dependencies in a virtual
environment or "virtualenv" (a special subdirectory of your cinder
directory), instead of installing the packages at the system level.
.. note::
Virtualenv is useful for running the unit tests, but is not
typically used for full integration testing or production usage.
</para>
</section>
<section xml:id="Linux-Systems">
<title>Linux-Systems</title>
<para>
-------------
.. note::
This section is tested for Cinder on Ubuntu (12.04-64) and
Fedora-based (RHEL 6.1) distributions. Feel free to add notes and
change according to your experiences or operating system.
Install the prerequisite packages.
On Ubuntu::
sudo apt-get install python-dev libssl-dev python-pip git-core libmysqlclient-dev libpq-dev
On Fedora-based distributions like Fedora, RHEL, CentOS and Scientific Linux::
sudo yum install python-devel openssl-devel python-pip git libmysqlclient-dev libqp-dev
</para>
</section>
<section xml:id="Mac-OS-X-Systems">
<title>Mac-Os-X-Systems</title>
<para>
----------------
Install virtualenv::
sudo easy_install virtualenv
Check the version of OpenSSL you have installed::
openssl version
If you have installed OpenSSL 1.0.0a, which can happen when installing a
MacPorts package for OpenSSL, you will see an error when running
``cinder.tests.auth_unittest.AuthTestCase.test_209_can_generate_x509``.
The stock version of OpenSSL that ships with Mac OS X 10.6 (OpenSSL 0.9.8l)
or Mac OS X 10.7 (OpenSSL 0.9.8r) works fine with cinder.
</para>
</section>
<section xml:id="Getting-the-code">
<title>Getting-The-Code</title>
<para>
----------------
Grab the code from GitHub::
git clone https://github.com/openstack/cinder.git
cd cinder
</para>
</section>
<section xml:id="Running-unit-tests">
<title>Running-Unit-Tests</title>
<para>
------------------
The unit tests will run by default inside a virtualenv in the ``.venv``
directory. Run the unit tests by doing::
./run_tests.sh
The first time you run them, you will be asked if you want to create a virtual
environment (hit "y")::
No virtual environment found...create one? (Y/n)
See :doc:`unit_tests` for more details.
.. _virtualenv:
</para>
</section>
<section xml:id="Manually-installing-and-using-the-virtualenv">
<title>Manually-Installing-And-Using-The-Virtualenv</title>
<para>
--------------------------------------------
You can manually install the virtual environment instead of having
``run_tests.sh`` do it for you::
python tools/install_venv.py
This will install all of the Python packages listed in the
``requirements.txt`` file into your virtualenv. There will also be some
additional packages (pip, setuptools) that are installed
by the ``tools/install_venv.py`` file into the virutalenv.
If all goes well, you should get a message something like this::
Cinder development environment setup is complete.
To activate the Cinder virtualenv for the extent of your current shell session
you can run::
$ source .venv/bin/activate
Or, if you prefer, you can run commands in the virtualenv on a case by case
basis by running::
$ tools/with_venv.sh [your command]
</para>
</section>
<section xml:id="Contributing-Your-Work">
<title>Contributing-Your-Work</title>
<para>
----------------------
Once your work is complete you may wish to contribute it to the project. Add
your name and email address to the ``Authors`` file, and also to the ``.mailmap``
file if you use multiple email addresses. Your contributions can not be merged
into trunk unless you are listed in the Authors file. Cinder uses the Gerrit
code review system. For information on how to submit your branch to Gerrit,
see GerritWorkflow_.
</para>
</section>
</section>