[hopem] Sync charm-helpers and add support for neutron_url in nova.conf
This commit is contained in:
parent
eb9ada081a
commit
edcc9282e0
@ -29,6 +29,7 @@ from charmhelpers.contrib.hahelpers.cluster import (
|
|||||||
determine_apache_port,
|
determine_apache_port,
|
||||||
determine_api_port,
|
determine_api_port,
|
||||||
https,
|
https,
|
||||||
|
is_clustered
|
||||||
)
|
)
|
||||||
|
|
||||||
from charmhelpers.contrib.hahelpers.apache import (
|
from charmhelpers.contrib.hahelpers.apache import (
|
||||||
@ -250,11 +251,13 @@ class CephContext(OSContextGenerator):
|
|||||||
unit=unit))
|
unit=unit))
|
||||||
auth = relation_get('auth', rid=rid, unit=unit)
|
auth = relation_get('auth', rid=rid, unit=unit)
|
||||||
key = relation_get('key', rid=rid, unit=unit)
|
key = relation_get('key', rid=rid, unit=unit)
|
||||||
|
use_syslog = str(config('use-syslog')).lower()
|
||||||
|
|
||||||
ctxt = {
|
ctxt = {
|
||||||
'mon_hosts': ' '.join(mon_hosts),
|
'mon_hosts': ' '.join(mon_hosts),
|
||||||
'auth': auth,
|
'auth': auth,
|
||||||
'key': key,
|
'key': key,
|
||||||
|
'use_syslog': use_syslog
|
||||||
}
|
}
|
||||||
|
|
||||||
if not os.path.isdir('/etc/ceph'):
|
if not os.path.isdir('/etc/ceph'):
|
||||||
@ -391,7 +394,7 @@ class ApacheSSLContext(OSContextGenerator):
|
|||||||
return ctxt
|
return ctxt
|
||||||
|
|
||||||
|
|
||||||
class NeutronContext(object):
|
class NeutronContext(OSContextGenerator):
|
||||||
interfaces = []
|
interfaces = []
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -452,6 +455,22 @@ class NeutronContext(object):
|
|||||||
|
|
||||||
return nvp_ctxt
|
return nvp_ctxt
|
||||||
|
|
||||||
|
def neutron_ctxt(self):
|
||||||
|
if https():
|
||||||
|
proto = 'https'
|
||||||
|
else:
|
||||||
|
proto = 'http'
|
||||||
|
if is_clustered():
|
||||||
|
host = config('vip')
|
||||||
|
else:
|
||||||
|
host = unit_get('private-address')
|
||||||
|
url = '%s://%s:%s' % (proto, host, '9292')
|
||||||
|
ctxt = {
|
||||||
|
'network_manager': self.network_manager,
|
||||||
|
'neutron_url': url,
|
||||||
|
}
|
||||||
|
return ctxt
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
self._ensure_packages()
|
self._ensure_packages()
|
||||||
|
|
||||||
@ -461,7 +480,7 @@ class NeutronContext(object):
|
|||||||
if not self.plugin:
|
if not self.plugin:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
ctxt = {'network_manager': self.network_manager}
|
ctxt = self.neutron_ctxt()
|
||||||
|
|
||||||
if self.plugin == 'ovs':
|
if self.plugin == 'ovs':
|
||||||
ctxt.update(self.ovs_ctxt())
|
ctxt.update(self.ovs_ctxt())
|
||||||
|
@ -9,3 +9,6 @@
|
|||||||
keyring = /etc/ceph/$cluster.$name.keyring
|
keyring = /etc/ceph/$cluster.$name.keyring
|
||||||
mon host = {{ mon_hosts }}
|
mon host = {{ mon_hosts }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
log to syslog = {{ use_syslog }}
|
||||||
|
err to syslog = {{ use_syslog }}
|
||||||
|
clog to syslog = {{ use_syslog }}
|
||||||
|
@ -49,6 +49,9 @@ CEPH_CONF = """[global]
|
|||||||
auth supported = {auth}
|
auth supported = {auth}
|
||||||
keyring = {keyring}
|
keyring = {keyring}
|
||||||
mon host = {mon_hosts}
|
mon host = {mon_hosts}
|
||||||
|
log to syslog = {use_syslog}
|
||||||
|
err to syslog = {use_syslog}
|
||||||
|
clog to syslog = {use_syslog}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -194,7 +197,7 @@ def get_ceph_nodes():
|
|||||||
return hosts
|
return hosts
|
||||||
|
|
||||||
|
|
||||||
def configure(service, key, auth):
|
def configure(service, key, auth, use_syslog):
|
||||||
''' Perform basic configuration of Ceph '''
|
''' Perform basic configuration of Ceph '''
|
||||||
create_keyring(service, key)
|
create_keyring(service, key)
|
||||||
create_key_file(service, key)
|
create_key_file(service, key)
|
||||||
@ -202,7 +205,8 @@ def configure(service, key, auth):
|
|||||||
with open('/etc/ceph/ceph.conf', 'w') as ceph_conf:
|
with open('/etc/ceph/ceph.conf', 'w') as ceph_conf:
|
||||||
ceph_conf.write(CEPH_CONF.format(auth=auth,
|
ceph_conf.write(CEPH_CONF.format(auth=auth,
|
||||||
keyring=_keyring_path(service),
|
keyring=_keyring_path(service),
|
||||||
mon_hosts=",".join(map(str, hosts))))
|
mon_hosts=",".join(map(str, hosts)),
|
||||||
|
use_syslog=use_syslog))
|
||||||
modprobe('rbd')
|
modprobe('rbd')
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ default_floating_pool = {{ external_network }}
|
|||||||
|
|
||||||
{% if network_manager and network_manager == 'quantum' -%}
|
{% if network_manager and network_manager == 'quantum' -%}
|
||||||
network_api_class = nova.network.quantumv2.api.API
|
network_api_class = nova.network.quantumv2.api.API
|
||||||
|
quantum_url = {{ neutron_url }}
|
||||||
{% if auth_host -%}
|
{% if auth_host -%}
|
||||||
quantum_auth_strategy = keystone
|
quantum_auth_strategy = keystone
|
||||||
quantum_admin_tenant_name = {{ admin_tenant_name }}
|
quantum_admin_tenant_name = {{ admin_tenant_name }}
|
||||||
@ -82,6 +83,7 @@ quantum_admin_auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}/v
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% elif network_manager and network_manager == 'neutron' -%}
|
{% elif network_manager and network_manager == 'neutron' -%}
|
||||||
network_api_class = nova.network.neutronv2.api.API
|
network_api_class = nova.network.neutronv2.api.API
|
||||||
|
neutron_url = {{ neutron_url }}
|
||||||
{% if auth_host -%}
|
{% if auth_host -%}
|
||||||
neutron_auth_strategy = keystone
|
neutron_auth_strategy = keystone
|
||||||
neutron_admin_tenant_name = {{ admin_tenant_name }}
|
neutron_admin_tenant_name = {{ admin_tenant_name }}
|
||||||
|
@ -17,3 +17,18 @@ firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewal
|
|||||||
{% else -%}
|
{% else -%}
|
||||||
firewall_driver = neutron.agent.firewall.NoopFirewallDriver
|
firewall_driver = neutron.agent.firewall.NoopFirewallDriver
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
|
[keystone_authtoken]
|
||||||
|
signing_dir = $state_path/keystone-signing
|
||||||
|
{% if service_host -%}
|
||||||
|
service_protocol = {{ service_protocol }}
|
||||||
|
service_host = {{ service_host }}
|
||||||
|
service_port = {{ service_port }}
|
||||||
|
auth_host = {{ auth_host }}
|
||||||
|
auth_port = {{ auth_port }}
|
||||||
|
auth_protocol = {{ auth_protocol }}
|
||||||
|
admin_tenant_name = {{ admin_tenant_name }}
|
||||||
|
admin_user = {{ admin_user }}
|
||||||
|
admin_password = {{ admin_password }}
|
||||||
|
signing_dir = $state_path/keystone-signing
|
||||||
|
{% endif -%}
|
||||||
|
Loading…
Reference in New Issue
Block a user