Skip to content

Commit 9cb1f6c

Browse files
committed
Update documentation
Fixes #69 Fixes #50
1 parent 8f7d81f commit 9cb1f6c

File tree

7 files changed

+101
-112
lines changed

7 files changed

+101
-112
lines changed

doc/source/conf.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,20 @@
1616
import sys
1717

1818
sys.path.insert(0, os.path.abspath('../..'))
19+
sys.path.insert(0, os.path.abspath('../'))
20+
sys.path.insert(0, os.path.abspath('./'))
1921
# -- General configuration ----------------------------------------------------
2022

2123
# Add any Sphinx extension module names here, as strings. They can be
2224
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
2325
extensions = [
2426
'sphinx.ext.autodoc',
25-
#'sphinx.ext.intersphinx',
26-
#'oslosphinx'
27+
'oslo_config.sphinxconfiggen',
28+
'oslo_config.sphinxext',
2729
]
2830

29-
# autodoc generation is a bit aggressive and a nuisance when doing heavy
30-
# text edit cycles.
31-
# execute "export SPHINX_DEBUG=1" in your terminal to disable
31+
config_generator_config_file = '../../etc/caso/caso-config-generator.conf'
32+
sample_config_basename = 'static/caso'
3233

3334
# The suffix of source filenames.
3435
source_suffix = '.rst'

doc/source/configuration-file.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cASO configuration file
2+
=======================
3+
4+
.. show-options::
5+
:split-namespaces:
6+
7+
caso
8+
oslo.config
9+
oslo.log

doc/source/configuration.rst

Lines changed: 70 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,49 @@ Configuration
1919
OpenStack Configuration
2020
=======================
2121

22-
Publishing benchmark information
23-
--------------------------------
22+
Apart from configuring cASO, several actions need to be performed in your
23+
OpenStack installation in order to be able to extract accounting records.
24+
25+
User credentials (required)
26+
---------------------------
27+
28+
In the next section you will configure an OpenStack Keystone credentials in
29+
order to extract the records. The cASO user has to be a member of each of the
30+
projects (another option is to convert that user in an administrator, but the
31+
former option is a safer approach) for which it is extracting the accounting.
32+
Otherwise, ``cASO`` will not be able to get the usages and will fail.
33+
34+
In order to do so, we are going to setup a new role ``accounting`` a new user
35+
``accounting``, adding it to each of the projects with that role::
36+
37+
openstack role create accounting
38+
openstack user create --password <password> accounting
39+
# For each of the projects, add the user with the accounting role
40+
openstack role add --user accounting --project <project> accounting
41+
42+
Moreover, this user needs access to Keystone so as to extract the users
43+
information. In this case, we can can grant the user just the rights for
44+
listing the users adding the appropriate rules in your
45+
``/etc/keystone/policy.json`` as follows. Replace the line::
46+
47+
"identity:list_users": "rule:admin_required",
48+
49+
with::
50+
51+
"identity:list_users": "rule:admin_required or role:accounting",
52+
53+
Recent Keystone versions leverage a ``/etc/keystone/policy-yaml`` file, if this
54+
is your case, substitute the line::
55+
56+
"identity:list_users": "rule:admin_required"
57+
58+
with::
59+
60+
"identity:list_users": "rule:admin_required or role:accounting"
61+
62+
63+
Publishing benchmark information for OpenStack flavors (optional)
64+
-----------------------------------------------------------------
2465

2566
Starting with the V0.4 of the accounting record it is possible to publish
2667
benchmark information. In order to do so, you need to add this information to
@@ -30,13 +71,13 @@ are two different values that need to be added to the flavor:
3071
* The benchmark name, indicated with the ``accounting:benchmark_name`` flavor property.
3172
* The benchmark value, indicated with the ``accounting:benchmark_value`` flavor property.
3273

33-
So, if you are using HEPSPEC06 and the benchmark value is ``99`` for the flavor
34-
``m1.foo`` you should set this as follows::
74+
For example, if you are using HEPSPEC06 and the benchmark value is ``99`` for
75+
the flavor ``m1.foo``, the benchmark information is configured as follows::
3576

36-
openstack flavor set --property benchmark_name="HEPSPEC06" --property accounting:benchmark_value=99 m1.foo
77+
openstack flavor set --property accounting:benchmark_name="HEPSPEC06" --property accounting:benchmark_value=99 m1.foo
3778

38-
Using different keys
39-
~~~~~~~~~~~~~~~~~~~~
79+
Using different keys to specify bechmark information
80+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4081

4182
If you do not want to use cASO's default flavor properties ``accounting:benchmark_name`` and
4283
``accounting:benchmark_value`` (for example because you are using different benchmark types
@@ -52,48 +93,12 @@ the ``benchmark_name_key`` ``benchkark_value_key`` in the configuration file.
5293
properties in cASO's configuration file, please include the complete name
5394
(i.e. ``scope:property``).
5495

55-
56-
User credentials
57-
----------------
58-
59-
The user configured in the previous section has to be a member of each of the
60-
project (another option is to convert that user in an administrator, but the
61-
former option is a safer approach) for which it is extracting the accounting.
62-
Otherwise, ``cASO`` will not be able to get the usages and will fail::
63-
64-
openstack role create accounting
65-
openstack user create --password <password> accounting
66-
# For each of the projects, add the user with the accounting role
67-
openstack role add --user accounting --project <project> accounting
68-
69-
Also, this user needs access to Keystone so as to extract the users
70-
information.
71-
72-
* If you are using the V2 identity API, you have to give admin rights to the
73-
``accounting`` user, editing the ``/etc/keystone/policy.json`` file and
74-
replacing the line::
75-
76-
"admin_required": "role:admin or is_admin:1 or",
77-
78-
with::
79-
80-
"admin_required": "role:admin or is_admin:1 or role:accounting",
81-
82-
* If you are using the V3 identity API you can grant the user just the rights
83-
for listing the users adding the appropriate rules in the
84-
``/etc/keystone/policy.json`` as follows. Replace the line::
85-
86-
"identity:list_users": "rule:admin_required",
87-
88-
with::
89-
90-
"identity:list_users": "rule:admin_required or role:accounting",
91-
9296
cASO configuration
9397
==================
9498

9599
``cASO`` uses a config file (default at ``/etc/caso/caso.conf``) with several
96-
sections. A sample file is available at ``etc/caso/caso.conf.sample``.
100+
sections. A sample file is available at
101+
:download:`etc/caso/caso.conf.sample <static/caso.conf.sample>`.
97102

98103
``[DEFAULT]`` section
99104
---------------------
@@ -114,19 +119,23 @@ of every option. You should check at least the following options:
114119
* ``messengers`` (list, default: ``noop``). List of the messengers to publish
115120
data to. Records will be pushed to all these messengers, in order. Valid
116121
messengers shipped with cASO are:
117-
* ``ssm`` for publishing APEL V0.4 records.
118-
* ``logstash`` for publishing to Logstash.
119-
* ``noop`` do nothing at all.
122+
123+
* ``ssm`` for publishing APEL V0.4 records.
124+
* ``logstash`` for publishing to Logstash.
125+
* ``noop`` do nothing at all.
126+
120127
Note that there might be other messengers available in the system if they are
121128
registered into the ``caso.messenger`` entry point namespace.
122129
* ``mapping_file`` (default: ``/etc/caso/voms.json``). File containing the
123130
mapping from VOs to local projects as configured in Keystone-VOMS, in the
124131
form::
132+
125133
{
126134
"VO": {
127135
"projects": ["foo", "bar"],
128136
}
129137
}
138+
130139
* ``benchmark_name_key`` and ``benchmark_value_key``. These two configuration
131140
options are used by ``cASO`` to retrieve the benchmark information form the
132141
OpenStack flavors.
@@ -141,7 +150,6 @@ authentication, so that it is possible to use any authentication plugin that is
141150
available there (so starting on version 1.0 of cASO it is possible to use the
142151
Keystone V3 API).
143152

144-
145153
.. important::
146154
You need to specify the ``auth_type`` that you want to use (normally
147155
``v3password`` is a good choice.
@@ -168,3 +176,16 @@ messenger. Available options:
168176

169177
* ``host`` (default: ``localhost``), host of Logstash server.
170178
* ``port`` (default: ``5000``), Logstash server port.
179+
180+
Other cASO configuration options
181+
--------------------------------
182+
183+
For an exhaustive list of the defined options, please check the following page:
184+
185+
.. toctree::
186+
:maxdepth: 1
187+
:titlesonly:
188+
189+
configuration-file
190+
191+

doc/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ Contents:
3333

3434
installation
3535
configuration
36+
configuration-file
3637
usage

doc/source/installation.rst

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ Pre-requisites
2424

2525
If you are planning to use ``cASO`` for generating accounting records for EGI,
2626
you will need a valid APEL/SSM configuration. Follow the documentation
27-
available at the `EGI FedCloud wiki
28-
<https://wiki.egi.eu/wiki/Fedcloud-tf:WorkGroups:Scenario4#Publishing_Records>`_
27+
available at the `EGI.eu Federated Cloud documentation
28+
<https://egi-federated-cloud.readthedocs.io/en/latest/federation.html#apel-and-accounting-portal>`_
29+
in order to set it up.
2930

3031
Installation
3132
------------
@@ -35,53 +36,17 @@ repositories and packages provided in the EGI AppDB:
3536

3637
https://appdb.egi.eu/store/software/caso
3738

38-
3939
Manual installation
4040
*******************
4141

42-
At the command line::
43-
44-
$ pip install caso
45-
46-
Or, if you have virtualenvwrapper installed::
47-
48-
$ mkvirtualenv caso
49-
$ pip install caso
50-
51-
CentOS 6
52-
^^^^^^^^
53-
54-
On CentOS 6, you can use Software Collections to install Python 2.7::
55-
56-
$ yum -y install centos-release-SCL
57-
$ yum -y install python27
58-
59-
There are also some dependencies of the packages used by ``cASO`` that need to
60-
be installed (``gcc``, ``libffi-devel`` and ``openssl-devel``)::
61-
62-
$ yum -y install gcc libffi-devel openssl-devel
63-
64-
You can then install ``pip`` for that version of Python and use that to install
65-
``cASO``::
66-
67-
$ scl enable python27 bash
68-
$ easy_install-2.7 pip
69-
$ pip install caso
70-
$ exit # this terminates bash with the SCL python2.7
71-
72-
In this case you can later on use ``caso-extract`` with the following command
73-
line::
74-
75-
$ scl enable python27 caso-extract
76-
77-
Alternatively, if you want to use a virtualenv::
42+
Even the reccomended method is to use a package from the EGI AppDB, it is
43+
possible to install it from the `Python Pacakge Index
44+
<https://pypi.org/project/caso/>`_ as follows::
7845

79-
$ scl enable python27 bash
80-
$ virtualenv caso
81-
$ . caso/bin/activate
8246
$ pip install caso
83-
$ exit # this terminates bash with the SCL python2.7
8447

85-
Running from the virtualenv::
48+
Or you can install it on a virtualenv::
8649

87-
$ scl enable python27 caso/bin/caso-extract
50+
$ virtualenv --python python3 caso
51+
$ source caso/bin/activate
52+
(caso) $ pip install caso

doc/source/usage.rst

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ of time. If not time zone is specified, UTC will be used.
4343
Available options
4444
=================
4545

46+
Apart from other options, the following ones are the ones that specify how to
47+
extract accountig records:
48+
4649
.. option:: --config-dir DIR
4750

4851
Path to a config directory to pull `*.conf` files from. This file set is
@@ -61,6 +64,7 @@ Available options
6164

6265
If set to true, the logging level will be set to DEBUG
6366
instead of the default INFO level.
67+
6468
.. option:: --dry-run, --dry_run
6569

6670
Extract records but do not push records to SSM. This will not update the last
@@ -90,21 +94,9 @@ Available options
9094

9195
List of projects to extract accounting records from.
9296

93-
9497
Running as a cron job
9598
---------------------
9699

97100
The best way of running ``cASO`` is via a cron job like the following::
98101

99102
10 * * * * caso-extract
100-
101-
Migration from OSSSM
102-
--------------------
103-
104-
If you had a previous installation of osssm, you can migrate to ``cASO``
105-
following these steps:
106-
107-
#. Remove the previous osssm installation (e.g. remove ``apel-ssm-openstack`` rpm).
108-
#. Remove any cron jobs related to ``osssm.extract`` or ``osssm.push``, a single
109-
cron job as described above is enough. You should keep the cron job that executes
110-
``ssmsend``, this is still needed to send the records to the accounting database.

etc/caso/caso-config-generator.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
output_file = etc/caso/caso.conf.sample
33
wrap_width = 79
44
namespace = caso
5-
namespace = caso.config
65
namespace = oslo.log
6+
namespace = oslo.config

0 commit comments

Comments
 (0)