def __call__(self): """ Extends the main charmhelpers HAProxyContext with a port mapping specific to this charm. Also used to extend glance-api.conf context with correct bind_port """ haproxy_port = determine_haproxy_port(9292) api_port = determine_api_port(9292) ctxt = {"service_ports": {"glance_api": [haproxy_port, api_port]}, "bind_port": api_port} return ctxt
def __call__(self): ''' Extends the main charmhelpers HAProxyContext with a port mapping specific to this charm. Also used to extend cinder.conf context with correct api_listening_port ''' haproxy_port = determine_haproxy_port(config('bind-port')) api_port = determine_api_port(config('bind-port')) ctxt = { 'service_ports': {'swift_api': [haproxy_port, api_port]}, } return ctxt
def __call__(self): if isinstance(self.external_ports, basestring): self.external_ports = [self.external_ports] if not self.external_ports or not https(): return {} self.configure_cert() self.enable_modules() ctxt = {"namespace": self.service_namespace, "private_address": unit_get("private-address"), "endpoints": []} for ext_port in self.external_ports: if peer_units() or is_clustered(): int_port = determine_haproxy_port(ext_port) else: int_port = determine_api_port(ext_port) portmap = (int(ext_port), int(int_port)) ctxt["endpoints"].append(portmap) return ctxt
def __call__(self): if isinstance(self.external_ports, basestring): self.external_ports = [self.external_ports] if (not self.external_ports or not https()): return {} self.configure_cert() self.enable_modules() ctxt = { 'namespace': self.service_namespace, 'private_address': unit_get('private-address'), 'endpoints': [] } for ext_port in self.external_ports: if peer_units() or is_clustered(): int_port = determine_haproxy_port(ext_port) else: int_port = determine_api_port(ext_port) portmap = (int(ext_port), int(int_port)) ctxt['endpoints'].append(portmap) return ctxt
def __call__(self): ''' Extends the main charmhelpers HAProxyContext with a port mapping specific to this charm. Also used to extend nova.conf context with correct api_listening_ports ''' from nova_cc_utils import api_port ctxt = super(HAProxyContext, self).__call__() # determine which port api processes should bind to, depending # on existence of haproxy + apache frontends compute_api = determine_api_port(api_port('nova-api-os-compute')) ec2_api = determine_api_port(api_port('nova-api-ec2')) s3_api = determine_api_port(api_port('nova-objectstore')) nvol_api = determine_api_port(api_port('nova-api-os-volume')) neutron_api = determine_api_port(api_port('neutron-server')) # to be set in nova.conf accordingly. listen_ports = { 'osapi_compute_listen_port': compute_api, 'ec2_listen_port': ec2_api, 's3_listen_port': s3_api, } port_mapping = { 'nova-api-os-compute': [ determine_haproxy_port(api_port('nova-api-os-compute')), compute_api, ], 'nova-api-ec2': [ determine_haproxy_port(api_port('nova-api-ec2')), ec2_api, ], 'nova-objectstore': [ determine_haproxy_port(api_port('nova-objectstore')), s3_api, ], } if relation_ids('nova-volume-service'): port_mapping.update({ 'nova-api-ec2': [ determine_haproxy_port(api_port('nova-api-ec2')), nvol_api], }) listen_ports['osapi_volume_listen_port'] = nvol_api if neutron.network_manager() in ['neutron', 'quantum']: port_mapping.update({ 'neutron-server': [ determine_haproxy_port(api_port('neutron-server')), neutron_api] }) # quantum/neutron.conf listening port, set separte from nova's. ctxt['neutron_bind_port'] = neutron_api # for haproxy.conf ctxt['service_ports'] = port_mapping # for nova.conf ctxt['listen_ports'] = listen_ports return ctxt