2
from charmhelpers.core.hookenv import relation_ids, relation_set
3
from charmhelpers.core.host import apt_install, filter_installed_packages
4
from charmhelpers.contrib.openstack import context, utils
6
#from charmhelpers.contrib.hahelpers.cluster import (
8
# determine_haproxy_port,
12
class ApacheSSLContext(context.ApacheSSLContext):
14
interfaces = ['https']
16
service_namespace = 'nova'
19
# late import to work around circular dependency
20
from nova_cc_utils import determine_ports
21
self.external_ports = determine_ports()
22
return super(ApacheSSLContext, self).__call__()
25
class VolumeServiceContext(context.OSContextGenerator):
31
os_vers = utils.get_os_codename_package('nova-common')
33
if (relation_ids('nova-volume-service') and
34
os_vers in ['essex', 'folsom']):
35
# legacy nova-volume support, only supported in E and F
36
ctxt['volume_service_config'] = 'nova.volume.api.API'
37
install_pkg = filter_installed_packages(['nova-api-os-volume'])
39
apt_install(install_pkg)
40
elif relation_ids('cinder-volume-service'):
41
ctxt['volume_service_config'] = 'nova.volume.cinder.API'
42
# kick all compute nodes to know they should use cinder now.
43
[relation_set(volume_service='cinder', rid=rid)
44
for rid in relation_ids('cloud-compute')]
48
class HAProxyContext(context.OSContextGenerator):
53
Extends the main charmhelpers HAProxyContext with a port mapping
54
specific to this charm.
55
Also used to extend nova.conf context with correct api_listening_ports