Skip to content

Commit 968462a

Browse files
alexcos78aidaph
authored andcommitted
Support for multi-region + documentation
1 parent 9ea7179 commit 968462a

File tree

3 files changed

+60
-1
lines changed

3 files changed

+60
-1
lines changed

caso/extract/nova.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@
3232

3333
CONF = cfg.CONF
3434

35+
opts = [
36+
cfg.StrOpt('region_name',
37+
default=None,
38+
help='OpenStack Region to use. This option will force cASO to '
39+
'extract records from a specific OpenStack Region, in '
40+
'there are several defined in the OpenStack site. '
41+
'Defaults to None.')
42+
]
43+
44+
CONF.register_opts(opts)
45+
3546
CONF.import_opt("site_name", "caso.extract.base")
3647
CONF.import_opt("benchmark_name_key", "caso.extract.base")
3748
CONF.import_opt("benchmark_value_key", "caso.extract.base")
@@ -44,8 +55,10 @@ def __init__(self):
4455
super(OpenStackExtractor, self).__init__()
4556

4657
def _get_nova_client(self, project):
58+
region_name = CONF.region_name
4759
session = keystone_client.get_session(CONF, project)
48-
return novaclient.client.Client(2, session=session)
60+
return novaclient.client.Client(2, session=session,
61+
region_name=region_name)
4962

5063
def _get_glance_client(self, project):
5164
session = keystone_client.get_session(CONF, project)

doc/source/multi-region.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
============
2+
cASO multi-region support
3+
============
4+
5+
* In case the monitored projects rely on a specific region, define the
6+
following variable in the /etc/caso/caso.conf
7+
8+
.. code-block:: bash
9+
10+
[DEFAULT]
11+
region_name = <REGION>
12+
13+
14+
* In case the monitored Project(s) rely on different regions, prepare different
15+
files /etc/caso/caso-<REGION>.conf
16+
17+
.. code-block:: bash
18+
19+
[DEFAULT]
20+
region_name = <REGION>
21+
22+
23+
* List the Project(s) in the /etc/caso/voms.json as from the documentation
24+
25+
.. code-block:: JSON
26+
27+
{
28+
"Project1": {
29+
"projects": ["Project1"]
30+
},
31+
"Project2": {
32+
"projects": ["Project2"]
33+
}
34+
}
35+
36+
* Execute caso-extract for each Project (and related REGION) to be monitored (Project1-REGION1, Project2-REGION2)
37+
38+
.. code-block:: bash
39+
40+
/usr/bin/caso-extract --projects "Project1" --config-file /etc/caso/caso-<REGION1>.conf
41+
/usr/bin/caso-extract --projects "Project2" --config-file /etc/caso/caso-<REGION2>.conf
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
features:
3+
- |
4+
Add multi-region support in order to extract information from several
5+
regions through different configuration files.

0 commit comments

Comments
 (0)