1
from charmhelpers.core.hookenv import (
7
from charmhelpers.contrib.openstack.context import (
9
ApacheSSLContext as SSLContext,
12
from charmhelpers.contrib.hahelpers.cluster import (
14
determine_haproxy_port,
18
class ImageServiceContext(OSContextGenerator):
19
interfaces = ['image-service']
22
if not relation_ids('image-service'):
24
return { 'glance_api_version': config('glance-api-version') }
27
class CephContext(OSContextGenerator):
32
Used to generate template context to be added to cinder.conf in the
33
presence of a ceph relation.
35
if not relation_ids('ceph'):
37
service = service_name()
39
'volume_driver': 'cinder.volume.driver.RBDDriver',
40
# ensure_ceph_pool() creates pool based on service name.
47
class HAProxyContext(OSContextGenerator):
52
Extends the main charmhelpers HAProxyContext with a port mapping
53
specific to this charm.
54
Also used to extend cinder.conf context with correct api_listening_port
56
haproxy_port = determine_haproxy_port(config('api-listening-port'))
57
api_port = determine_api_port(config('api-listening-port'))
60
'service_ports': {'cinder_api': [haproxy_port, api_port]},
61
'osapi_volume_listen_port': api_port,
66
class ApacheSSLContext(SSLContext):
67
interfaces = ['https']
68
external_ports = [8776]
69
service_namespace = 'cinder'
72
# late import to work around circular dependency
73
from cinder_utils import service_enabled
74
if not service_enabled('cinder-api'):
76
return super(ApacheSSLContext, self).__call__()