root / doc / devnotes.rst @ cfa2b7a0
History | View | Annotate | Download (4.7 kB)
1 |
Developer notes |
---|---|
2 |
=============== |
3 |
|
4 |
.. highlight:: shell-example |
5 |
|
6 |
Build dependencies |
7 |
------------------ |
8 |
|
9 |
Most dependencies from :doc:`install-quick`, plus (for Python): |
10 |
|
11 |
- `GNU make <http://www.gnu.org/software/make/>`_ |
12 |
- `GNU tar <http://www.gnu.org/software/tar/>`_ |
13 |
- `Gzip <http://www.gnu.org/software/gzip/>`_ |
14 |
- `pandoc <http://johnmacfarlane.net/pandoc/>`_ |
15 |
- `python-sphinx <http://sphinx.pocoo.org/>`_ |
16 |
(tested with version 0.6.1) |
17 |
- `graphviz <http://www.graphviz.org/>`_ |
18 |
- the `en_US.UTF-8` locale must be enabled on the system |
19 |
- `pylint <http://www.logilab.org/857>`_ and its associated |
20 |
dependencies |
21 |
- `pep8 <https://github.com/jcrocholl/pep8/>`_ |
22 |
|
23 |
Note that for pylint, at the current moment the following versions |
24 |
must be used:: |
25 |
|
26 |
$ pylint --version |
27 |
pylint 0.21.1, |
28 |
astng 0.20.1, common 0.50.3 |
29 |
|
30 |
To generate unittest coverage reports (``make coverage``), `coverage |
31 |
<http://pypi.python.org/pypi/coverage>`_ needs to be installed. |
32 |
|
33 |
For Haskell development, again all things from the quick install |
34 |
document, plus: |
35 |
|
36 |
- `haddock <http://www.haskell.org/haddock/>`_, documentation |
37 |
generator (equivalent to epydoc for Python) |
38 |
- `HsColour <http://hackage.haskell.org/package/hscolour>`_, again |
39 |
used for documentation (it's source-code pretty-printing) |
40 |
- `hlint <http://community.haskell.org/~ndm/hlint/>`_, a source code |
41 |
linter (equivalent to pylint for Python), recommended version 1.8 or |
42 |
above (tested with 1.8.15) |
43 |
- the `QuickCheck <http://hackage.haskell.org/package/QuickCheck>`_ |
44 |
library, version 2.x |
45 |
- ``hpc``, which comes with the compiler, so you should already have |
46 |
it |
47 |
- `shelltestrunner <http://joyful.com/shelltestrunner>`_, used for |
48 |
running unit-tests |
49 |
|
50 |
Under Debian Wheezy or later, these can be installed (on top of the |
51 |
required ones from the quick install document) via:: |
52 |
|
53 |
$ apt-get install libghc-quickcheck2-dev hscolour hlint |
54 |
|
55 |
Or alternatively via ``cabal``:: |
56 |
|
57 |
$ cabal install quickcheck hscolour hlint shelltestrunner |
58 |
|
59 |
|
60 |
Configuring for development |
61 |
--------------------------- |
62 |
|
63 |
Run the following command (only use ``PYTHON=...`` if you need to use a |
64 |
different python version):: |
65 |
|
66 |
$ ./autogen.sh && \ |
67 |
./configure --prefix=/usr/local --sysconfdir=/etc --localstatedir=/var |
68 |
|
69 |
Note that doing development on a machine which already has Ganeti |
70 |
installed is problematic, as ``PYTHONPATH`` behaviour can be confusing |
71 |
(see Issue 170 for a bit of history/details; in general it works if |
72 |
the installed and developed versions are very similar, and/or if |
73 |
PYTHONPATH is customised correctly). As such, in general it's |
74 |
recommended to use a "clean" machine for ganeti development. |
75 |
|
76 |
Haskell development notes |
77 |
------------------------- |
78 |
|
79 |
There are a few things which can help writing or debugging the Haskell |
80 |
code. |
81 |
|
82 |
You can run the Haskell linter :command:`hlint` via:: |
83 |
|
84 |
$ make hlint |
85 |
|
86 |
This is not enabled by default (as the htools component is |
87 |
optional). The above command will generate both output on the terminal |
88 |
and, if any warnings are found, also an HTML report at |
89 |
``doc/hs-lint.html``. |
90 |
|
91 |
When writing or debugging TemplateHaskell code, it's useful to see |
92 |
what the splices are converted to. This can be done via:: |
93 |
|
94 |
$ make HEXTRA="-ddump-splices" |
95 |
|
96 |
Due to the way TemplateHaskell works, it's not straightforward to |
97 |
build profiling code. The recommended way is to run ``make hs-prof``, |
98 |
or alternatively the manual sequence is:: |
99 |
|
100 |
$ make clean |
101 |
$ make htools/htools HEXTRA="-osuf .o" |
102 |
$ rm htools/htools |
103 |
$ make htools/htools HEXTRA="-osuf .prof_o -prof -auto-all" |
104 |
|
105 |
This will build the binary twice, per the TemplateHaskell |
106 |
documentation, the second one with profiling enabled. |
107 |
|
108 |
|
109 |
Packaging notes |
110 |
=============== |
111 |
|
112 |
Ganeti is mostly developed and tested on `Debian |
113 |
<http://www.debian.org/>`_-based distributions, while still keeping |
114 |
adaptability to other Linux distributions in mind. |
115 |
|
116 |
The ``doc/examples/`` directory contains a number of potentially useful |
117 |
scripts and configuration files. Some of them might need adjustment |
118 |
before use. |
119 |
|
120 |
``daemon-util`` |
121 |
--------------- |
122 |
|
123 |
This script, in the source code as ``daemons/daemon-util.in``, is used |
124 |
to start/stop Ganeti and do a few other things related to system |
125 |
daemons. It is recommended to use ``daemon-util`` also from the system's |
126 |
init scripts. That way the code starting and stopping daemons is shared |
127 |
and future changes have to be made in only one place. |
128 |
|
129 |
``daemon-util`` reads extra arguments from variables (``*_ARGS``) in |
130 |
``/etc/default/ganeti``. When modifying ``daemon-util``, keep in mind to |
131 |
not remove support for the ``EXTRA_*_ARGS`` variables for starting |
132 |
daemons. Some parts of Ganeti use them to pass additional arguments when |
133 |
starting a daemon. |
134 |
|
135 |
The ``reload_ssh_keys`` function can be adjusted to use another command |
136 |
for reloading the OpenSSH daemon's host keys. |
137 |
|
138 |
.. vim: set textwidth=72 : |