Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big GLUE 2.1 rebase #99

Merged
merged 191 commits into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
191 commits
Select commit Hold shift + click to select a range
e7dbca4
compute_template: start preparing for glue 2.1
gwarf Mar 2, 2017
155339e
compute_template: update existing classes
gwarf Mar 3, 2017
b3f6aaa
Import updated clouddomain.glue21
gwarf Mar 3, 2017
c58ceb6
compute_template: small cleaning
gwarf Mar 3, 2017
f3a66b0
compute.glue21: rename template
gwarf Mar 3, 2017
21f43b3
Removed
gwarf Mar 3, 2017
763e4cd
clouddomain.glue21: comment DN that needs to yet available information
gwarf Mar 3, 2017
c8423ef
clouddomain.glue21: comment not yet working code
gwarf Mar 3, 2017
6d46efa
tempates: Mako uses ## for comments
gwarf Mar 3, 2017
ed82831
compute.glue21: add empty lines between images and templates
gwarf Mar 3, 2017
afcddff
Import storage.glue21 based on storage.ldif
gwarf Mar 6, 2017
aea2d71
storage.glue21: comment until starting implementation
gwarf Mar 6, 2017
013b6d1
clouddomain.glue21: comment until implementation time
gwarf Mar 6, 2017
19e8c0b
compute.glue21: use variables for compute_service_id and compute_serv…
gwarf Mar 6, 2017
51f391c
compute.glue21: typo
gwarf Mar 6, 2017
6058669
compute.glue21: start adding a compute share.
gwarf Mar 6, 2017
0103824
Drop useless file
gwarf Mar 6, 2017
a32488f
Import headers.glue21
gwarf Mar 6, 2017
e7ea6a9
clouddomain.glue21: clean empty lines
gwarf Mar 6, 2017
640ddc9
provider: start adding support for retrieving static share configuration
gwarf Mar 6, 2017
798871b
core.py: make shares available to the compute template
gwarf Mar 6, 2017
e9543e8
static.py: no need for a prefix
gwarf Mar 6, 2017
d2bfb85
compute.glue21: use shares retrieved from static conf.
gwarf Mar 6, 2017
5c92871
data.py: add shares
gwarf Mar 9, 2017
adabe10
test_core.py: add shares.
gwarf Mar 9, 2017
d644d57
static.py: fix indentation
gwarf Mar 9, 2017
1a3ba67
core.py: move share later to allow tests to pass
gwarf Mar 9, 2017
303637c
compute.glue21: reworked shares support.
gwarf Mar 9, 2017
0172823
core.py: query project-specific list of images and templates.
gwarf Mar 14, 2017
3617c54
compute.glue21: templates and images are now share-related.
gwarf Mar 14, 2017
efdf8b8
compute.ldf: Collect template and images from all shares
gwarf Mar 14, 2017
49ba5c3
compute.ldf: remove empty line
gwarf Mar 14, 2017
1d9508c
compute.glue21: update GLUE2CloudComputingService attributes.
gwarf Mar 14, 2017
5c0c407
core.py: fix style-related errors.
gwarf Mar 14, 2017
f77fa83
compute.glue21: start adding support for Policy and misc cleaning.
gwarf Mar 14, 2017
3a75305
compute.glue21: ensure there is one space after the comments.
gwarf Mar 14, 2017
93c3f47
static.py: add a membership field to the shares
gwarf Mar 16, 2017
5ff645c
compute.glue21: iterate over mempership to get Mapping Policies.
gwarf Mar 16, 2017
ea06636
compute.glue21: simplify/clean template.
gwarf Mar 17, 2017
91cf9a5
openstack provider: store native IDs in the templates and images dicts
gwarf Mar 17, 2017
517cb53
compute.glue21: Add Endpoint OCCI type and native images and template…
gwarf Mar 17, 2017
8805faf
compute.glue21: creat a dict for OCCI endpoints.
gwarf Mar 17, 2017
60f20bb
compute.glue21: create a dict for native endpoints.
gwarf Mar 17, 2017
39187bb
sample.openstack.xml: add shares example
gwarf Mar 17, 2017
553b14e
compute.glue21: simplify and separate endpoints management.
gwarf Mar 20, 2017
f48139c
sample.openstack.xml: update endpoint technology and default middlewa…
gwarf Mar 20, 2017
0ca3d4c
compute.glue21: add timestamp to entities. Misc fixes.
gwarf Mar 20, 2017
655d407
compute.glue21: add validity and remove unused OtherInfo.
gwarf Mar 20, 2017
50380ad
compute.glue21: update GocDB link, add endpoint name.
gwarf Mar 20, 2017
4829e2f
openstack provider: retrieve endpoint api version dynamically
gwarf Mar 21, 2017
a53e959
compute.glue21: frop commented/depreaced entry
gwarf Mar 21, 2017
91373ed
openstack|static providers: use different middleware info for each ki…
gwarf Mar 21, 2017
5ceeee4
openstack provider: retrieve and display instances
gwarf Mar 22, 2017
0b91c83
compute.glue21: fix some formating quirks
gwarf Mar 22, 2017
82bb010
openstack provider: extract and improve endpoint version retrieval.
gwarf Mar 22, 2017
c1d25e6
compute.glue21: display max/min memory and CPU (from templates)
gwarf Mar 22, 2017
18d3f44
openstack provider: flake8 conformance fix.
gwarf Mar 22, 2017
87214f0
tests: start fixing tests
gwarf Mar 22, 2017
5b65712
openstack provider: pass insecure paramter to keystone client.
gwarf Mar 23, 2017
edfb3d1
compute.glue21: clean / reorganize some attributes for images and tem…
gwarf Mar 23, 2017
95e6d01
compute.glue21: document status of missing image attributes
gwarf Mar 24, 2017
f332d49
providers: no more make API calls fore each instance
gwarf Mar 24, 2017
14cd5e9
providers/glue21: prepare for displaying more image information
gwarf Mar 24, 2017
62de28c
yaml conf samples: update capabilities list
gwarf Mar 24, 2017
bc7d7a8
Add more site-wide information for glue 2.1.
gwarf Mar 24, 2017
226758d
yaml conf samples: add security.accounting capacity.
gwarf Mar 24, 2017
c9e7366
Reorganize and update site-wide information for glue 2.1.
gwarf Mar 24, 2017
ac5edf9
compute.glue21: link to gocdb web interface for downtime
gwarf Mar 24, 2017
7ff1a4f
compute.glue21: add missing quote
gwarf Mar 24, 2017
6434d4e
compute.glue21: fix GLUE2EndpointInterfaceName
gwarf Mar 24, 2017
d143392
static.py: add a network_info field to the shares
gwarf Mar 24, 2017
5250d1b
compute.glue21: display network_info and purge unused fields.
gwarf Mar 24, 2017
49ec5da
yaml conf samples: synchronize/clean examples.
gwarf Mar 24, 2017
5b3602a
compute.glue21: display network_info for templates.
gwarf Mar 24, 2017
f26e142
templates: retrieve and display ephemeral and disk information
gwarf Mar 24, 2017
8694ad9
compute.glue21: comment UserDomainForeignKey.
gwarf Mar 24, 2017
405d599
compute.glue21: add empty lines to separate policies.
gwarf Mar 24, 2017
1765188
Add some FIXME for linking shares to endpoints.
gwarf Mar 24, 2017
c0b28ad
compute.glue21: fix ServiceType
gwarf Mar 27, 2017
c304e93
compute.glue21: no need for ServicePEncingVM number
gwarf Mar 27, 2017
7bede47
compute.glue21: finalize ComputingService conf
gwarf Mar 27, 2017
9229bd0
compute.glue21: update tple and image ids for OCCI.
gwarf Mar 27, 2017
01a6a86
compute.glue21: simplify complexity :).
gwarf Mar 27, 2017
921f208
compute.glue21: add API URL for OpenStack.
gwarf Mar 27, 2017
10ffa37
compute.glue21: no need for GLUE2PolicyUserDomainForeignKey
gwarf Mar 27, 2017
f5f8133
Link endpoints to a specific share/OpenStack project
gwarf Mar 28, 2017
ebee58d
Take VirtualDiskFormat from conf.
gwarf Mar 28, 2017
6285e39
Synchronize samples
gwarf Mar 28, 2017
ef18b88
Take NetowrkIn and NetworkOut from conf.
gwarf Mar 28, 2017
a004f9b
Synchronize samples
gwarf Mar 28, 2017
37a3e3f
compute endpoints: retrieve and display cert issuer and trusted cas
gwarf Mar 28, 2017
fd2f392
OpenStack: Use Keystone endpoint SSL information for all endpoints.
gwarf Mar 30, 2017
d8f7598
openstack provider: make insecure requests to OCCI endpoint if asked.
gwarf Mar 30, 2017
1e8f416
openstack provider: extract DN from the X509Name.
gwarf Mar 30, 2017
f62b572
openstack: add short documentation to internal functions.
gwarf Mar 30, 2017
4f8f7ad
Flake8 conformance
gwarf Mar 30, 2017
20d8502
compute endpoints: accelerators are optionnal
gwarf Mar 30, 2017
0473db1
openstack: _get_dn returns DN without quotes.
gwarf Mar 30, 2017
98756fe
compute endpoints: set min/max/total accelerators to 0 and allways di…
gwarf Mar 31, 2017
7eda867
compute.glue21: make ShareInstanceMaxAccelerators fallback on site-wi…
gwarf Mar 31, 2017
aa65612
compute.glue21: network, accelerators and cpu virt types are optional.
gwarf Apr 3, 2017
551b236
compute.glue21: add Failover, LiveMigration and VMBackupRestore from …
gwarf Apr 3, 2017
26a3ab1
static provider: allow to configure max_vm
gwarf Apr 3, 2017
5f783a8
providers: rename get_shares to get_compute_shares
gwarf Apr 3, 2017
8faacb1
providers: use parent implementation of get_compute_shares
gwarf Apr 3, 2017
ac23c0d
compute.glue21: set Share Max VM from static conf
gwarf Apr 3, 2017
5a9c0be
compute.glue21: drop uneeded ExecutionEnvironmentForeignKey
gwarf Apr 3, 2017
92b7d5e
openstack provider: retrieve quotas and use defaults from conf file
gwarf Apr 4, 2017
9e01358
compute.glue21: drop uneeded GLUE2ShareResourceForeignKey
gwarf Apr 5, 2017
dd05692
openstack: store and use os_tenant_id to retrieve quotas.
gwarf Apr 5, 2017
bf1bd75
compute.glue21: add accelearators and make some attributes optional
gwarf Jun 1, 2017
f02b55b
static provider: add all possible image attributes
gwarf Jun 1, 2017
10d1402
openstack: update image attributes.
gwarf Jun 1, 2017
f07fd5e
compute.glue21: image_default_username was dropped
gwarf Jun 1, 2017
590a209
compute.glue21: add missing : on the if lines
gwarf Jun 1, 2017
05918fd
compute.glue21: *_ram and *_cpu are optional
gwarf Jun 1, 2017
9ba244c
compute.glue21: endpoint_url was renamed to compute_endpoint_url
gwarf Jun 1, 2017
64c2567
Display optional informaiton about image in/out traffic.
gwarf Jun 1, 2017
38519cc
Display AccessInfo (default to none, credentials have to be injected …
gwarf Jun 1, 2017
99b2693
compute.glue21: default on UNKNOWN for image size
gwarf Jun 1, 2017
33f72a1
Display optional Contextualization format.
gwarf Jun 1, 2017
18d89d8
Display optional software list for each image.
gwarf Jun 1, 2017
56c9343
compute.glue21: fix latest attributes
gwarf Jun 1, 2017
ef03e0b
static provider: fix indentation.
gwarf Jun 2, 2017
07fbaae
static provider: endpoints should not be in the shares conf.
gwarf Jun 6, 2017
f9328c2
fix and skip some failing unit tests
alvarolopez Jun 13, 2017
2cfd4d7
Play nice with provider's imports
alvarolopez Jun 12, 2017
2acade2
OpenStack: Stop using old nova authentiation and switch to keystoneauth1
alvarolopez Jun 13, 2017
0e429e0
Let providers' methods accept kwargs
alvarolopez Jun 13, 2017
1a3aaf3
OpenStack: rescope project only when needed
alvarolopez Jun 13, 2017
ba4ec75
compute_template: start preparing for glue 2.1
gwarf Mar 2, 2017
d2d09ca
compute_template: update existing classes
gwarf Mar 3, 2017
184a95e
Import updated clouddomain.glue21
gwarf Mar 3, 2017
b0dbe61
compute_template: small cleaning
gwarf Mar 3, 2017
bd4d984
Removed
gwarf Mar 3, 2017
212ff94
clouddomain.glue21: comment DN that needs to yet available information
gwarf Mar 3, 2017
9e5acef
clouddomain.glue21: comment not yet working code
gwarf Mar 3, 2017
090fa7c
tempates: Mako uses ## for comments
gwarf Mar 3, 2017
fbcc01d
clouddomain.glue21: comment until implementation time
gwarf Mar 6, 2017
de5147f
clouddomain.glue21: clean empty lines
gwarf Mar 6, 2017
45e005b
compute.ldf: Collect template and images from all shares
gwarf Mar 14, 2017
28d5673
compute.ldf: remove empty line
gwarf Mar 14, 2017
77d4fee
core.py: fix style-related errors.
gwarf Mar 14, 2017
cbb0a27
compute.glue21: start adding support for Policy and misc cleaning.
gwarf Mar 14, 2017
db1defa
compute.glue21: ensure there is one space after the comments.
gwarf Mar 14, 2017
6059796
compute.glue21: iterate over mempership to get Mapping Policies.
gwarf Mar 16, 2017
4f3e688
compute.glue21: simplify/clean template.
gwarf Mar 17, 2017
5159299
compute.glue21: creat a dict for OCCI endpoints.
gwarf Mar 17, 2017
b4de596
sample.openstack.xml: add shares example
gwarf Mar 17, 2017
93ef28d
compute.glue21: simplify and separate endpoints management.
gwarf Mar 20, 2017
acfdff4
compute.glue21: add timestamp to entities. Misc fixes.
gwarf Mar 20, 2017
3575ed6
compute.glue21: add validity and remove unused OtherInfo.
gwarf Mar 20, 2017
2e90247
compute.glue21: update GocDB link, add endpoint name.
gwarf Mar 20, 2017
699977d
openstack provider: retrieve endpoint api version dynamically
gwarf Mar 21, 2017
8d5bce3
openstack provider: retrieve and display instances
gwarf Mar 22, 2017
d73f638
compute.glue21: display max/min memory and CPU (from templates)
gwarf Mar 22, 2017
f323b4c
compute.glue21: display network_info and purge unused fields.
gwarf Mar 24, 2017
d7f031e
compute.glue21: comment UserDomainForeignKey.
gwarf Mar 24, 2017
8d8792a
compute.glue21: add empty lines to separate policies.
gwarf Mar 24, 2017
e60afa4
Add some FIXME for linking shares to endpoints.
gwarf Mar 24, 2017
404017e
compute.glue21: finalize ComputingService conf
gwarf Mar 27, 2017
aa45453
compute.glue21: simplify complexity :).
gwarf Mar 27, 2017
45ad347
compute.glue21: no need for GLUE2PolicyUserDomainForeignKey
gwarf Mar 27, 2017
68b4d7a
Link endpoints to a specific share/OpenStack project
gwarf Mar 28, 2017
72aa050
Synchronize samples
gwarf Mar 28, 2017
9e6251f
compute endpoints: retrieve and display cert issuer and trusted cas
gwarf Mar 28, 2017
dd48a4d
openstack provider: make insecure requests to OCCI endpoint if asked.
gwarf Mar 30, 2017
8bb2ab2
openstack: add short documentation to internal functions.
gwarf Mar 30, 2017
8c45f8c
compute endpoints: accelerators are optionnal
gwarf Mar 30, 2017
9b2aa68
compute.glue21: make ShareInstanceMaxAccelerators fallback on site-wi…
gwarf Mar 31, 2017
4e1fa6a
openstack provider: retrieve quotas and use defaults from conf file
gwarf Apr 4, 2017
e499b55
compute.glue21: list endpoints outside of share to avoid duplicates
gwarf Jun 14, 2017
3916988
compute.glue21: images, templates and policies are specific to an end…
gwarf Jun 15, 2017
8a2cf4e
sample yaml: do not set virtual_disk_formats by default, update doc.
gwarf Jun 26, 2017
294699a
compute.glue21: hide not yet used attributes.
gwarf Jun 26, 2017
1ce8982
sample yaml: use undefined as default for network_in.
gwarf Jun 26, 2017
0c41db4
Fix rebase/merge inconsistencies
gwarf Aug 29, 2018
c98f21a
Fix openstack tests (and related code when needed).
gwarf Aug 29, 2018
6845bbc
test_openstack: no more needed to import unittest as tests were fixed.
gwarf Aug 30, 2018
84a7965
openstack provider: remove useless empty line in get_templates, for c…
gwarf Aug 30, 2018
b4c111d
openstack: refactor to please codeclimate
gwarf Aug 30, 2018
24cc47f
openstack: make _default_if_none static
gwarf Aug 30, 2018
c6490ec
Proper support for keystoneauth1 plugins (#4)
enolfc Sep 3, 2018
8bb4102
Cloud info rename (#6)
enolfc Sep 14, 2018
b483959
Avoid importing OS libs without try/except (#7)
enolfc Sep 19, 2018
1232629
core.py: iterate over values as keys are not used
gwarf Sep 27, 2018
e012939
Opennebula support (#8)
enolfc Sep 27, 2018
f0f5623
Fix core tests (#9)
enolfc Oct 2, 2018
02a9bf1
tox: fix modulename for cobertura
gwarf Oct 16, 2018
c5f194d
Jenkinsfile: main cloud-info-provider package should be built too.
gwarf Oct 16, 2018
6b18e0b
tox: fix remaining modulename for cobertura
gwarf Oct 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pipeline {
sh 'mkdir -p ~/rpmbuild/{SOURCES,SPECS}'
sh 'cp dist/cloud_info_provider*.tar.gz ~/rpmbuild/SOURCES/'
sh 'cp rpm/cloud-info-provider*.spec ~/rpmbuild/SPECS/'
//sh 'rpmbuild -ba ~/rpmbuild/SPECS/cloud-info-provider.spec'
sh 'rpmbuild -ba ~/rpmbuild/SPECS/cloud-info-provider.spec'
sh 'rpmbuild -ba ~/rpmbuild/SPECS/cloud-info-provider-openstack.spec'
sh 'rpmbuild -ba ~/rpmbuild/SPECS/cloud-info-provider-opennebula.spec'
sh 'cp ~/rpmbuild/SRPMS/*.rpm ~/rpmbuild/RPMS/noarch/*.rpm ${WORKSPACE}/rpm/'
Expand Down
22 changes: 0 additions & 22 deletions cloud_info/providers/__init__.py

This file was deleted.

File renamed without changes.
111 changes: 69 additions & 42 deletions cloud_info/core.py → cloud_info_provider/core.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import argparse
import os.path

from cloud_info import exceptions
from cloud_info import importutils
from cloud_info_provider import exceptions
from cloud_info_provider import importutils

import mako.exceptions
import mako.template

SUPPORTED_MIDDLEWARE = {
'openstack': 'cloud_info.providers.openstack.OpenStackProvider',
'opennebula': 'cloud_info.providers.opennebula.OpenNebulaProvider',
'indigoon': 'cloud_info.providers.opennebula.IndigoONProvider',
'opennebularocci': 'cloud_info.providers.opennebula.'
'openstack': 'cloud_info_provider.providers.openstack.OpenStackProvider',
'opennebula': 'cloud_info_provider.providers.opennebula.'
'OpenNebulaProvider',
'indigoon': 'cloud_info_provider.providers.opennebula.IndigoONProvider',
'opennebularocci': 'cloud_info_provider.providers.opennebula.'
'OpenNebulaROCCIProvider',
'static': 'cloud_info.providers.static.StaticProvider',
'static': 'cloud_info_provider.providers.static.StaticProvider',
}


Expand Down Expand Up @@ -45,26 +47,12 @@ def load_templates(self):
'%s.%s' % (tpl, template_extension))
self.templates_files[tpl] = template_file

def _get_info_from_providers(self, method, provider_opts=None):
# XXX Temporarily update dynamic provider parameters
# XXX Required to be able to pass a custom project to the provider
# XXX to retrieve project-specific templates and images
if provider_opts:
opts = self.opts
d = vars(opts)
for k, v in provider_opts.items():
d[k] = v

provider_cls = importutils.import_class(
SUPPORTED_MIDDLEWARE[opts.middleware]
)
self.dynamic_provider = provider_cls(opts)

def _get_info_from_providers(self, method, **provider_kwargs):
info = {}
for i in (self.static_provider, self.dynamic_provider):
if not i:
continue
result = getattr(i, method)()
result = getattr(i, method)(**provider_kwargs)
info.update(result)
return info

Expand All @@ -73,7 +61,10 @@ def _format_template(self, template, info, extra={}):
info.update(extra)
t = self.templates_files[template]
tpl = mako.template.Template(filename=t)
return tpl.render(attributes=info)
try:
return tpl.render(attributes=info)
except Exception:
return mako.exceptions.text_error_template().render()


class StorageBDII(BaseBDII):
Expand Down Expand Up @@ -109,32 +100,68 @@ def __init__(self, opts):
self.templates = ['compute']

def render(self):
endpoints = self._get_info_from_providers('get_compute_endpoints')

if not endpoints.get('endpoints'):
return ''
info = {}

# Retrieve global site information
# XXX Validate if really project agnostic
# XXX Here it uses the "default" project from the CLI parameters
site_info = self._get_info_from_providers('get_site_info')
static_compute_info = dict(endpoints, **site_info)
static_compute_info.pop('endpoints')

templates = self._get_info_from_providers('get_templates')
images = self._get_info_from_providers('get_images')
# Get shares / projects and related images and templates
shares = self._get_info_from_providers('get_compute_shares')

for url, endpoint in endpoints['endpoints'].items():
endpoint.update(static_compute_info)
for share in shares.values():
kwargs = share.copy()

for template_id, template in templates.items():
template.update(static_compute_info)
endpoints = self._get_info_from_providers('get_compute_endpoints',
**kwargs)

for image_id, image in images.items():
image.update(static_compute_info)
if not endpoints.get('endpoints'):
return ''

# Collect static information for endpoints
static_compute_info = dict(endpoints, **site_info)
static_compute_info.pop('endpoints')

# Add same static information to all endpoints
for endpoint in endpoints['endpoints'].values():
endpoint.update(static_compute_info)

images = self._get_info_from_providers('get_images',
**kwargs)

templates = self._get_info_from_providers('get_templates',
**kwargs)

instances = self._get_info_from_providers('get_instances',
**kwargs)

quotas = self._get_info_from_providers('get_compute_quotas',
**kwargs)

for template in templates.values():
template.update(static_compute_info)

for image in images.values():
image.update(static_compute_info)

share['images'] = images
share['templates'] = templates
share['instances'] = instances
share['endpoints'] = endpoints
share['quotas'] = quotas

# XXX Avoid creating a new list
endpoints = {endpoint_id: endpoint for share_id, share in
shares.items() for endpoint_id,
endpoint in share['endpoints'].items()}

# XXX Avoid redoing what was done in the previous shares loop
static_compute_info = dict(endpoints, **site_info)
static_compute_info.pop('endpoints')

info = {}
info.update({'endpoints': endpoints})
info.update({'static_compute_info': static_compute_info})
info.update({'templates': templates})
info.update({'images': images})
info.update({'shares': shares})

return self._format_template('compute', info)

Expand Down
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions cloud_info_provider/providers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class BaseProvider(object):
def __init__(self, opts):
self.opts = opts

def get_site_info(self, **kwargs):
return {}

def get_images(self, **kwargs):
return {}

def get_templates(self, **kwargs):
return {}

def get_instances(self, **kwargs):
return {}

def get_compute_shares(self, **kwargs):
return {}

def get_compute_quotas(self, **kwargs):
return {}

def get_compute_endpoints(self, **kwargs):
return {}

def get_storage_endpoints(self, **kwargs):
return {}

@staticmethod
def populate_parser(parser):
'''Populate the argparser 'parser' with the needed options.'''
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import os
import string

from cloud_info import exceptions
from cloud_info import providers
from cloud_info import utils
from cloud_info_provider import exceptions
from cloud_info_provider import providers
from cloud_info_provider.providers import ssl_utils
from cloud_info_provider import utils

try:
import defusedxml.ElementTree
Expand Down Expand Up @@ -74,7 +75,7 @@ def _get_one_documents(self, document_type):
self.on_auth, -3, -1, -1, document_type)
return self._handle_response(response)

def get_images(self):
def get_images(self, **kwargs):
template = {
'image_name': None,
'image_description': None,
Expand All @@ -88,9 +89,13 @@ def get_images(self):
}
defaults = self.static.get_image_defaults(prefix=True)
img_schema = defaults.get('image_schema', 'template')
group_name = kwargs.get('project', None)

templates = {}
# TODO(enolfc): cache the templates instead of always calling this?
for tpl_id, tpl in self._get_one_templates().items():
if group_name and group_name != tpl.get('gname'):
continue
aux_tpl = template.copy()
aux_tpl.update(defaults)

Expand Down Expand Up @@ -176,7 +181,7 @@ class IndigoONProvider(OpenNebulaBaseProvider):
def __init__(self, opts):
super(IndigoONProvider, self).__init__(opts)

def get_templates(self):
def get_templates(self, **kwargs):
template = {
'template_id': None,
'template_name': None,
Expand Down Expand Up @@ -218,7 +223,7 @@ def get_templates(self):
templates[tpl_id] = aux_tpl
return templates

def get_images(self):
def get_images(self, **kwargs):
image = {
'image_name': None,
'image_id': None,
Expand Down Expand Up @@ -266,9 +271,29 @@ def __init__(self, opts):
msg = ('ERROR, You must provide a rocci_template_dir '
'via --rocci-template-dir')
raise exceptions.OpenNebulaProviderException(msg)
self.ca_info = {}
super(OpenNebulaROCCIProvider, self).__init__(opts)

def get_templates(self):
def _get_endpoint_ca_information(self, url, **kwargs):
if url not in self.ca_info:
ca_info = ssl_utils.get_endpoint_ca_information(url, **kwargs)
self.ca_info[url] = ca_info
return self.ca_info[url]

def get_compute_endpoints(self, **kwargs):
epts = dict()
static_epts = self.static.get_compute_endpoints(**kwargs)
for url, static_ept in static_epts['endpoints'].items():
ept = static_ept.copy()
ca_info = self._get_endpoint_ca_information(url)
ept.update({
'endpoint_trusted_cas': ca_info['trusted_cas'],
'endpoint_issuer': ca_info['issuer'],
})
epts[url] = ept
return {'endpoints': epts}

def get_templates(self, **kwargs):
"""Get flavors from rOCCI-server configuration."""
template = {
'template_id': None,
Expand All @@ -282,7 +307,8 @@ def get_templates(self):
template.update(self.static.get_template_defaults(prefix=True))

if self.rocci_remote_templates:
templates = self.remote_templates(template)
group_name = kwargs.get('project', None)
templates = self.remote_templates(template, group_name)
else:
templates = self.local_templates(template)

Expand Down Expand Up @@ -318,12 +344,15 @@ def local_templates(self, template):

return templates

def remote_templates(self, template):
def remote_templates(self, template, group_name):
document_type = 999 # TODO(bparak): configurable?

templates = {}
# TODO(enolfc): cache info from ONE?
for doc_id, doc in self._get_one_documents(document_type).items():
document = json.loads(doc['template']['body'])
if group_name and group_name != doc.get('gname'):
continue

aux = template.copy()
aux.update({
Expand Down
Loading