rebased
This commit is contained in:
commit
87653e3362
|
@ -1,4 +1,4 @@
|
|||
branch: lp:~openstack-charmers/charm-helpers/icehouse
|
||||
branch: lp:charm-helpers
|
||||
destination: hooks/charmhelpers
|
||||
include:
|
||||
- core
|
||||
|
|
|
@ -39,14 +39,15 @@ def get_cert():
|
|||
|
||||
|
||||
def get_ca_cert():
|
||||
ca_cert = None
|
||||
log("Inspecting identity-service relations for CA SSL certificate.",
|
||||
level=INFO)
|
||||
for r_id in relation_ids('identity-service'):
|
||||
for unit in relation_list(r_id):
|
||||
if not ca_cert:
|
||||
ca_cert = relation_get('ca_cert',
|
||||
rid=r_id, unit=unit)
|
||||
ca_cert = config_get('ssl_ca')
|
||||
if ca_cert is None:
|
||||
log("Inspecting identity-service relations for CA SSL certificate.",
|
||||
level=INFO)
|
||||
for r_id in relation_ids('identity-service'):
|
||||
for unit in relation_list(r_id):
|
||||
if ca_cert is None:
|
||||
ca_cert = relation_get('ca_cert',
|
||||
rid=r_id, unit=unit)
|
||||
return ca_cert
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import json
|
||||
import os
|
||||
import time
|
||||
|
||||
from base64 import b64decode
|
||||
|
||||
|
@ -113,7 +114,8 @@ class OSContextGenerator(object):
|
|||
class SharedDBContext(OSContextGenerator):
|
||||
interfaces = ['shared-db']
|
||||
|
||||
def __init__(self, database=None, user=None, relation_prefix=None):
|
||||
def __init__(self,
|
||||
database=None, user=None, relation_prefix=None, ssl_dir=None):
|
||||
'''
|
||||
Allows inspecting relation for settings prefixed with relation_prefix.
|
||||
This is useful for parsing access for multiple databases returned via
|
||||
|
@ -122,6 +124,7 @@ class SharedDBContext(OSContextGenerator):
|
|||
self.relation_prefix = relation_prefix
|
||||
self.database = database
|
||||
self.user = user
|
||||
self.ssl_dir = ssl_dir
|
||||
|
||||
def __call__(self):
|
||||
self.database = self.database or config('database')
|
||||
|
@ -139,10 +142,9 @@ class SharedDBContext(OSContextGenerator):
|
|||
|
||||
for rid in relation_ids('shared-db'):
|
||||
for unit in related_units(rid):
|
||||
passwd = relation_get(password_setting, rid=rid, unit=unit)
|
||||
rdata = relation_get(rid=rid, unit=unit)
|
||||
ctxt = {
|
||||
'database_host': relation_get('db_host', rid=rid,
|
||||
unit=unit),
|
||||
'database_host': rdata.get('db_host'),
|
||||
'database': self.database,
|
||||
'database_user': self.user,
|
||||
'database_password': passwd,
|
||||
|
@ -176,12 +178,39 @@ class PostgresqlDBContext(OSContextGenerator):
|
|||
'database_user': relation_get('user', rid=rid, unit=unit),
|
||||
'database_password': relation_get('password', rid=rid, unit=unit),
|
||||
'database_type': 'postgresql',
|
||||
'database_password': rdata.get(password_setting)
|
||||
}
|
||||
if context_complete(ctxt):
|
||||
db_ssl(rdata, ctxt, self.ssl_dir)
|
||||
return ctxt
|
||||
return {}
|
||||
|
||||
|
||||
def db_ssl(rdata, ctxt, ssl_dir):
|
||||
if 'ssl_ca' in rdata and ssl_dir:
|
||||
ca_path = os.path.join(ssl_dir, 'db-client.ca')
|
||||
with open(ca_path, 'w') as fh:
|
||||
fh.write(b64decode(rdata['ssl_ca']))
|
||||
ctxt['database_ssl_ca'] = ca_path
|
||||
elif 'ssl_ca' in rdata:
|
||||
log("Charm not setup for ssl support but ssl ca found")
|
||||
return ctxt
|
||||
if 'ssl_cert' in rdata:
|
||||
cert_path = os.path.join(
|
||||
ssl_dir, 'db-client.cert')
|
||||
if not os.path.exists(cert_path):
|
||||
log("Waiting 1m for ssl client cert validity")
|
||||
time.sleep(60)
|
||||
with open(cert_path, 'w') as fh:
|
||||
fh.write(b64decode(rdata['ssl_cert']))
|
||||
ctxt['database_ssl_cert'] = cert_path
|
||||
key_path = os.path.join(ssl_dir, 'db-client.key')
|
||||
with open(key_path, 'w') as fh:
|
||||
fh.write(b64decode(rdata['ssl_key']))
|
||||
ctxt['database_ssl_key'] = key_path
|
||||
return ctxt
|
||||
|
||||
|
||||
class IdentityServiceContext(OSContextGenerator):
|
||||
interfaces = ['identity-service']
|
||||
|
||||
|
@ -191,22 +220,19 @@ class IdentityServiceContext(OSContextGenerator):
|
|||
|
||||
for rid in relation_ids('identity-service'):
|
||||
for unit in related_units(rid):
|
||||
rdata = relation_get(rid=rid, unit=unit)
|
||||
ctxt = {
|
||||
'service_port': relation_get('service_port', rid=rid,
|
||||
unit=unit),
|
||||
'service_host': relation_get('service_host', rid=rid,
|
||||
unit=unit),
|
||||
'auth_host': relation_get('auth_host', rid=rid, unit=unit),
|
||||
'auth_port': relation_get('auth_port', rid=rid, unit=unit),
|
||||
'admin_tenant_name': relation_get('service_tenant',
|
||||
rid=rid, unit=unit),
|
||||
'admin_user': relation_get('service_username', rid=rid,
|
||||
unit=unit),
|
||||
'admin_password': relation_get('service_password', rid=rid,
|
||||
unit=unit),
|
||||
# XXX: Hard-coded http.
|
||||
'service_protocol': 'http',
|
||||
'auth_protocol': 'http',
|
||||
'service_port': rdata.get('service_port'),
|
||||
'service_host': rdata.get('service_host'),
|
||||
'auth_host': rdata.get('auth_host'),
|
||||
'auth_port': rdata.get('auth_port'),
|
||||
'admin_tenant_name': rdata.get('service_tenant'),
|
||||
'admin_user': rdata.get('service_username'),
|
||||
'admin_password': rdata.get('service_password'),
|
||||
'service_protocol':
|
||||
rdata.get('service_protocol') or 'http',
|
||||
'auth_protocol':
|
||||
rdata.get('auth_protocol') or 'http',
|
||||
}
|
||||
if context_complete(ctxt):
|
||||
return ctxt
|
||||
|
@ -216,6 +242,9 @@ class IdentityServiceContext(OSContextGenerator):
|
|||
class AMQPContext(OSContextGenerator):
|
||||
interfaces = ['amqp']
|
||||
|
||||
def __init__(self, ssl_dir=None):
|
||||
self.ssl_dir = ssl_dir
|
||||
|
||||
def __call__(self):
|
||||
log('Generating template context for amqp')
|
||||
conf = config()
|
||||
|
@ -226,9 +255,9 @@ class AMQPContext(OSContextGenerator):
|
|||
log('Could not generate shared_db context. '
|
||||
'Missing required charm config options: %s.' % e)
|
||||
raise OSContextError
|
||||
|
||||
ctxt = {}
|
||||
for rid in relation_ids('amqp'):
|
||||
ha_vip_only = False
|
||||
for unit in related_units(rid):
|
||||
if relation_get('clustered', rid=rid, unit=unit):
|
||||
ctxt['clustered'] = True
|
||||
|
@ -243,16 +272,36 @@ class AMQPContext(OSContextGenerator):
|
|||
unit=unit),
|
||||
'rabbitmq_virtual_host': vhost,
|
||||
})
|
||||
|
||||
ssl_port = relation_get('ssl_port', rid=rid, unit=unit)
|
||||
if ssl_port:
|
||||
ctxt['rabbit_ssl_port'] = ssl_port
|
||||
ssl_ca = relation_get('ssl_ca', rid=rid, unit=unit)
|
||||
if ssl_ca:
|
||||
ctxt['rabbit_ssl_ca'] = ssl_ca
|
||||
|
||||
if relation_get('ha_queues', rid=rid, unit=unit) is not None:
|
||||
ctxt['rabbitmq_ha_queues'] = True
|
||||
|
||||
ha_vip_only = relation_get('ha-vip-only',
|
||||
rid=rid, unit=unit) is not None
|
||||
|
||||
if context_complete(ctxt):
|
||||
if 'rabbit_ssl_ca' in ctxt:
|
||||
if not self.ssl_dir:
|
||||
log(("Charm not setup for ssl support "
|
||||
"but ssl ca found"))
|
||||
break
|
||||
ca_path = os.path.join(
|
||||
self.ssl_dir, 'rabbit-client-ca.pem')
|
||||
with open(ca_path, 'w') as fh:
|
||||
fh.write(b64decode(ctxt['rabbit_ssl_ca']))
|
||||
ctxt['rabbit_ssl_ca'] = ca_path
|
||||
# Sufficient information found = break out!
|
||||
break
|
||||
# Used for active/active rabbitmq >= grizzly
|
||||
if ('clustered' not in ctxt or relation_get('ha-vip-only') == 'True') and \
|
||||
len(related_units(rid)) > 1:
|
||||
if relation_get('ha_queues'):
|
||||
ctxt['rabbitmq_ha_queues'] = relation_get('ha_queues')
|
||||
else:
|
||||
ctxt['rabbitmq_ha_queues'] = False
|
||||
if ('clustered' not in ctxt or ha_vip_only) \
|
||||
and len(related_units(rid)) > 1:
|
||||
rabbitmq_hosts = []
|
||||
for unit in related_units(rid):
|
||||
rabbitmq_hosts.append(relation_get('private-address',
|
||||
|
@ -418,6 +467,8 @@ class ApacheSSLContext(OSContextGenerator):
|
|||
'private_address': unit_get('private-address'),
|
||||
'endpoints': []
|
||||
}
|
||||
if is_clustered():
|
||||
ctxt['private_address'] = config('vip')
|
||||
for api_port in self.external_ports:
|
||||
ext_port = determine_apache_port(api_port)
|
||||
int_port = determine_api_port(api_port)
|
||||
|
|
|
@ -17,6 +17,8 @@ def headers_package():
|
|||
kver = check_output(['uname', '-r']).strip()
|
||||
return 'linux-headers-%s' % kver
|
||||
|
||||
QUANTUM_CONF_DIR = '/etc/quantum'
|
||||
|
||||
|
||||
def kernel_version():
|
||||
""" Retrieve the current major kernel version as a tuple e.g. (3, 13) """
|
||||
|
@ -35,6 +37,8 @@ def determine_dkms_package():
|
|||
|
||||
|
||||
# legacy
|
||||
|
||||
|
||||
def quantum_plugins():
|
||||
from charmhelpers.contrib.openstack import context
|
||||
return {
|
||||
|
@ -46,7 +50,8 @@ def quantum_plugins():
|
|||
'contexts': [
|
||||
context.SharedDBContext(user=config('neutron-database-user'),
|
||||
database=config('neutron-database'),
|
||||
relation_prefix='neutron')],
|
||||
relation_prefix='neutron',
|
||||
ssl_dir=QUANTUM_CONF_DIR)],
|
||||
'services': ['quantum-plugin-openvswitch-agent'],
|
||||
'packages': [[headers_package()] + determine_dkms_package(),
|
||||
['quantum-plugin-openvswitch-agent']],
|
||||
|
@ -61,7 +66,8 @@ def quantum_plugins():
|
|||
'contexts': [
|
||||
context.SharedDBContext(user=config('neutron-database-user'),
|
||||
database=config('neutron-database'),
|
||||
relation_prefix='neutron')],
|
||||
relation_prefix='neutron',
|
||||
ssl_dir=QUANTUM_CONF_DIR)],
|
||||
'services': [],
|
||||
'packages': [],
|
||||
'server_packages': ['quantum-server',
|
||||
|
@ -70,6 +76,8 @@ def quantum_plugins():
|
|||
}
|
||||
}
|
||||
|
||||
NEUTRON_CONF_DIR = '/etc/neutron'
|
||||
|
||||
|
||||
def neutron_plugins():
|
||||
from charmhelpers.contrib.openstack import context
|
||||
|
@ -83,7 +91,8 @@ def neutron_plugins():
|
|||
'contexts': [
|
||||
context.SharedDBContext(user=config('neutron-database-user'),
|
||||
database=config('neutron-database'),
|
||||
relation_prefix='neutron')],
|
||||
relation_prefix='neutron',
|
||||
ssl_dir=NEUTRON_CONF_DIR)],
|
||||
'services': ['neutron-plugin-openvswitch-agent'],
|
||||
'packages': [[headers_package()] + determine_dkms_package(),
|
||||
['neutron-plugin-openvswitch-agent']],
|
||||
|
@ -98,7 +107,8 @@ def neutron_plugins():
|
|||
'contexts': [
|
||||
context.SharedDBContext(user=config('neutron-database-user'),
|
||||
database=config('neutron-database'),
|
||||
relation_prefix='neutron')],
|
||||
relation_prefix='neutron',
|
||||
ssl_dir=NEUTRON_CONF_DIR)],
|
||||
'services': [],
|
||||
'packages': [],
|
||||
'server_packages': ['neutron-server',
|
||||
|
|
|
@ -3,12 +3,13 @@
|
|||
# cinder configuration file maintained by Juju
|
||||
# local changes may be overwritten.
|
||||
###############################################################################
|
||||
{% if auth -%}
|
||||
[global]
|
||||
{% if auth -%}
|
||||
auth_supported = {{ auth }}
|
||||
keyring = /etc/ceph/$cluster.$name.keyring
|
||||
mon host = {{ mon_hosts }}
|
||||
{% endif -%}
|
||||
log to syslog = {{ use_syslog }}
|
||||
err to syslog = {{ use_syslog }}
|
||||
clog to syslog = {{ use_syslog }}
|
||||
log to syslog = {{ use_syslog }}
|
||||
err to syslog = {{ use_syslog }}
|
||||
clog to syslog = {{ use_syslog }}
|
||||
|
||||
|
|
|
@ -423,19 +423,19 @@ def get_hostname(address, fqdn=True):
|
|||
Resolves hostname for given IP, or returns the input
|
||||
if it is already a hostname.
|
||||
"""
|
||||
if not is_ip(address):
|
||||
return address
|
||||
if is_ip(address):
|
||||
try:
|
||||
import dns.reversename
|
||||
except ImportError:
|
||||
apt_install('python-dnspython')
|
||||
import dns.reversename
|
||||
|
||||
try:
|
||||
import dns.reversename
|
||||
except ImportError:
|
||||
apt_install('python-dnspython')
|
||||
import dns.reversename
|
||||
|
||||
rev = dns.reversename.from_address(address)
|
||||
result = ns_query(rev)
|
||||
if not result:
|
||||
return None
|
||||
rev = dns.reversename.from_address(address)
|
||||
result = ns_query(rev)
|
||||
if not result:
|
||||
return None
|
||||
else:
|
||||
result = address
|
||||
|
||||
if fqdn:
|
||||
# strip trailing .
|
||||
|
|
|
@ -197,6 +197,10 @@ class CloudComputeContext(context.OSContextGenerator):
|
|||
continue
|
||||
|
||||
neutron_ctxt = {
|
||||
'auth_protocol': relation_get(
|
||||
'auth_protocol', **rel) or 'http',
|
||||
'service_protocol': relation_get(
|
||||
'service_protocol', **rel) or 'http',
|
||||
'neutron_auth_strategy': 'keystone',
|
||||
'keystone_host': relation_get(
|
||||
'auth_host', **rel),
|
||||
|
@ -220,8 +224,9 @@ class CloudComputeContext(context.OSContextGenerator):
|
|||
|
||||
neutron_ctxt['neutron_security_groups'] = _neutron_security_groups()
|
||||
|
||||
ks_url = 'http://%s:%s/v2.0' % (neutron_ctxt['keystone_host'],
|
||||
neutron_ctxt['auth_port'])
|
||||
ks_url = '%s://%s:%s/v2.0' % (neutron_ctxt['auth_protocol'],
|
||||
neutron_ctxt['keystone_host'],
|
||||
neutron_ctxt['auth_port'])
|
||||
neutron_ctxt['neutron_admin_auth_url'] = ks_url
|
||||
|
||||
if self.network_manager == 'quantum':
|
||||
|
|
|
@ -43,10 +43,11 @@ BASE_PACKAGES = [
|
|||
'genisoimage', # was missing as a package dependency until raring.
|
||||
]
|
||||
|
||||
NOVA_CONF_DIR = "/etc/nova"
|
||||
QEMU_CONF = '/etc/libvirt/qemu.conf'
|
||||
LIBVIRTD_CONF = '/etc/libvirt/libvirtd.conf'
|
||||
LIBVIRT_BIN = '/etc/default/libvirt-bin'
|
||||
NOVA_CONF = '/etc/nova/nova.conf'
|
||||
NOVA_CONF = '%s/nova.conf' % NOVA_CONF_DIR
|
||||
|
||||
BASE_RESOURCE_MAP = {
|
||||
QEMU_CONF: {
|
||||
|
@ -64,7 +65,8 @@ BASE_RESOURCE_MAP = {
|
|||
NOVA_CONF: {
|
||||
'services': ['nova-compute'],
|
||||
'contexts': [context.AMQPContext(),
|
||||
context.SharedDBContext(relation_prefix='nova'),
|
||||
context.SharedDBContext(
|
||||
relation_prefix='nova', ssl_dir=NOVA_CONF_DIR),
|
||||
context.PostgresqlDBContext(),
|
||||
context.ImageServiceContext(),
|
||||
context.OSConfigFlagContext(),
|
||||
|
@ -91,24 +93,26 @@ CEPH_RESOURCES = {
|
|||
}
|
||||
}
|
||||
|
||||
QUANTUM_CONF = '/etc/quantum/quantum.conf'
|
||||
QUANTUM_CONF_DIR = "/etc/quantum"
|
||||
QUANTUM_CONF = '%s/quantum.conf' % QUANTUM_CONF_DIR
|
||||
|
||||
QUANTUM_RESOURCES = {
|
||||
QUANTUM_CONF: {
|
||||
'services': [],
|
||||
'contexts': [context.AMQPContext(),
|
||||
NeutronComputeContext(),
|
||||
'contexts': [NeutronComputeContext(),
|
||||
context.AMQPContext(ssl_dir=QUANTUM_CONF_DIR),
|
||||
context.SyslogContext()],
|
||||
}
|
||||
}
|
||||
|
||||
NEUTRON_CONF = '/etc/neutron/neutron.conf'
|
||||
NEUTRON_CONF_DIR = "/etc/neutron"
|
||||
NEUTRON_CONF = '%s/neutron.conf' % NEUTRON_CONF_DIR
|
||||
|
||||
NEUTRON_RESOURCES = {
|
||||
NEUTRON_CONF: {
|
||||
'services': [],
|
||||
'contexts': [context.AMQPContext(),
|
||||
NeutronComputeContext(),
|
||||
'contexts': [NeutronComputeContext(),
|
||||
context.AMQPContext(ssl_dir=NEUTRON_CONF_DIR),
|
||||
context.SyslogContext()],
|
||||
}
|
||||
}
|
||||
|
@ -229,10 +233,11 @@ def determine_packages():
|
|||
if (net_manager in ['flatmanager', 'flatdhcpmanager'] and
|
||||
config('multi-host').lower() == 'yes'):
|
||||
packages.extend(['nova-api', 'nova-network'])
|
||||
elif net_manager == 'quantum':
|
||||
elif net_manager in ['quantum', 'neutron']:
|
||||
plugin = neutron_plugin()
|
||||
packages.extend(
|
||||
neutron_plugin_attribute(plugin, 'packages', net_manager))
|
||||
pkg_lists = neutron_plugin_attribute(plugin, 'packages', net_manager)
|
||||
for pkg_list in pkg_lists:
|
||||
packages.extend(pkg_list)
|
||||
|
||||
if relation_ids('ceph'):
|
||||
packages.append('ceph-common')
|
||||
|
|
|
@ -26,7 +26,7 @@ enabled_apis=ec2,osapi_compute,metadata
|
|||
auth_strategy=keystone
|
||||
compute_driver=libvirt.LibvirtDriver
|
||||
{% if database_host -%}
|
||||
sql_connection = {{ database_type }}://{{ database_user }}:{{ database_password }}@{{ database_host }}/{{ database }}
|
||||
sql_connection = {{ database_type }}://{{ database_user }}:{{ database_password }}@{{ database_host }}/{{ database }}{% if database_ssl_ca %}?ssl_ca={{ database_ssl_ca }}{% if database_ssl_cert %}&ssl_cert={{ database_ssl_cert }}&ssl_key={{ database_ssl_key }}{% endif %}{% endif %}
|
||||
{% endif -%}
|
||||
|
||||
{% if rabbitmq_host -%}
|
||||
|
@ -34,6 +34,13 @@ rabbit_host = {{ rabbitmq_host }}
|
|||
rabbit_userid = {{ rabbitmq_user }}
|
||||
rabbit_password = {{ rabbitmq_password }}
|
||||
rabbit_virtual_host = {{ rabbitmq_virtual_host }}
|
||||
{% if rabbit_ssl_port %}
|
||||
rabbit_use_ssl=True
|
||||
rabbit_port={{ rabbit_ssl_port }}
|
||||
{% if rabbit_ssl_ca %}
|
||||
kombu_ssl_ca_certs={{rabbit_ssl_ca}}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif -%}
|
||||
|
||||
{% if glance_api_servers -%}
|
||||
|
|
|
@ -22,7 +22,13 @@ rabbit_host = {{ rabbitmq_host }}
|
|||
rabbit_userid = {{ rabbitmq_user }}
|
||||
rabbit_password = {{ rabbitmq_password }}
|
||||
rabbit_virtual_host = {{ rabbitmq_virtual_host }}
|
||||
|
||||
{% if rabbit_ssl_port %}
|
||||
rabbit_use_ssl=True
|
||||
rabbit_port={{ rabbit_ssl_port }}
|
||||
{% if rabbit_ssl_ca %}
|
||||
kombu_ssl_ca_certs={{rabbit_ssl_ca}}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif -%}
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ enabled_apis=ec2,osapi_compute,metadata
|
|||
auth_strategy=keystone
|
||||
compute_driver=libvirt.LibvirtDriver
|
||||
{% if database_host -%}
|
||||
sql_connection = {{ database_type }}://{{ database_user }}:{{ database_password }}@{{ database_host }}/{{ database }}
|
||||
sql_connection = {{ database_type }}://{{ database_user }}:{{ database_password }}@{{ database_host }}/{{ database }}{% if database_ssl_ca %}?ssl_ca={{ database_ssl_ca }}{% if database_ssl_cert %}&ssl_cert={{ database_ssl_cert }}&ssl_key={{ database_ssl_key }}{% endif %}{% endif %}
|
||||
{% endif -%}
|
||||
|
||||
{% if rabbitmq_host or rabbitmq_hosts -%}
|
||||
|
@ -42,6 +42,13 @@ rabbit_durable_queues = false
|
|||
{% else %}
|
||||
rabbit_host = {{ rabbitmq_host }}
|
||||
{% endif -%}
|
||||
{% if rabbit_ssl_port %}
|
||||
rabbit_use_ssl=True
|
||||
rabbit_port={{ rabbit_ssl_port }}
|
||||
{% if rabbit_ssl_ca %}
|
||||
kombu_ssl_ca_certs={{rabbit_ssl_ca}}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif -%}
|
||||
|
||||
{% if glance_api_servers -%}
|
||||
|
|
|
@ -33,6 +33,13 @@ rabbit_durable_queues = false
|
|||
{% else %}
|
||||
rabbit_host = {{ rabbitmq_host }}
|
||||
{% endif -%}
|
||||
{% if rabbit_ssl_port %}
|
||||
rabbit_use_ssl=True
|
||||
rabbit_port={{ rabbit_ssl_port }}
|
||||
{% if rabbit_ssl_ca %}
|
||||
kombu_ssl_ca_certs={{rabbit_ssl_ca}}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif -%}
|
||||
|
||||
[QUOTAS]
|
||||
|
|
|
@ -26,7 +26,7 @@ enabled_apis=ec2,osapi_compute,metadata
|
|||
auth_strategy=keystone
|
||||
compute_driver=libvirt.LibvirtDriver
|
||||
{% if database_host -%}
|
||||
sql_connection = {{ database_type }}://{{ database_user }}:{{ database_password }}@{{ database_host }}/{{ database }}
|
||||
sql_connection = {{ database_type }}://{{ database_user }}:{{ database_password }}@{{ database_host }}/{{ database }}{% if database_ssl_ca %}?ssl_ca={{ database_ssl_ca }}{% if database_ssl_cert %}&ssl_cert={{ database_ssl_cert }}&ssl_key={{ database_ssl_key }}{% endif %}{% endif %}
|
||||
{% endif -%}
|
||||
|
||||
{% if rabbitmq_host or rabbitmq_hosts -%}
|
||||
|
@ -42,7 +42,14 @@ rabbit_durable_queues = false
|
|||
{% else %}
|
||||
rabbit_host = {{ rabbitmq_host }}
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
{% if rabbit_ssl_port %}
|
||||
rabbit_use_ssl=True
|
||||
rabbit_port={{ rabbit_ssl_port }}
|
||||
{% if rabbit_ssl_ca %}
|
||||
kombu_ssl_ca_certs={{rabbit_ssl_ca}}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
|
||||
{% if glance_api_servers -%}
|
||||
glance_api_servers = {{ glance_api_servers }}
|
||||
|
|
|
@ -22,6 +22,7 @@ QUANTUM_CONTEXT = {
|
|||
'quantum_auth_strategy': 'keystone',
|
||||
'keystone_host': 'keystone_host',
|
||||
'auth_port': '5000',
|
||||
'auth_protocol': 'https',
|
||||
'quantum_url': 'http://quantum_url',
|
||||
'service_tenant_name': 'admin',
|
||||
'service_username': 'admin',
|
||||
|
@ -143,9 +144,11 @@ class NovaComputeContextTests(CharmTestCase):
|
|||
ex_ctxt = {
|
||||
'network_manager': 'quantum',
|
||||
'network_manager_config': {
|
||||
'auth_protocol': 'https',
|
||||
'service_protocol': 'http',
|
||||
'auth_port': '5000',
|
||||
'keystone_host': 'keystone_host',
|
||||
'quantum_admin_auth_url': 'http://keystone_host:5000/v2.0',
|
||||
'quantum_admin_auth_url': 'https://keystone_host:5000/v2.0',
|
||||
'quantum_admin_password': 'openstack',
|
||||
'quantum_admin_tenant_name': 'admin',
|
||||
'quantum_admin_username': 'admin',
|
||||
|
|
|
@ -198,8 +198,8 @@ class NovaComputeRelationsTests(CharmTestCase):
|
|||
with self.assertRaises(Exception) as context:
|
||||
hooks.db_joined()
|
||||
self.assertEqual(context.exception.message,
|
||||
'Attempting to associate a mysql database when there '
|
||||
'is already associated a postgresql one')
|
||||
'Attempting to associate a mysql database when there '
|
||||
'is already associated a postgresql one')
|
||||
|
||||
def test_postgresql_joined_with_db(self):
|
||||
self.is_relation_made.return_value = True
|
||||
|
@ -207,8 +207,8 @@ class NovaComputeRelationsTests(CharmTestCase):
|
|||
with self.assertRaises(Exception) as context:
|
||||
hooks.pgsql_db_joined()
|
||||
self.assertEqual(context.exception.message,
|
||||
'Attempting to associate a postgresql database when there '
|
||||
'is already associated a mysql one')
|
||||
'Attempting to associate a postgresql database when there '
|
||||
'is already associated a mysql one')
|
||||
|
||||
def test_db_joined_quantum_ovs(self):
|
||||
self.unit_get.return_value = 'nova.foohost.com'
|
||||
|
|
|
@ -4,6 +4,7 @@ from test_utils import CharmTestCase, patch_open
|
|||
|
||||
|
||||
import nova_compute_utils as utils
|
||||
import itertools
|
||||
|
||||
TO_PATCH = [
|
||||
'config',
|
||||
|
@ -19,10 +20,12 @@ TO_PATCH = [
|
|||
]
|
||||
|
||||
OVS_PKGS = [
|
||||
'quantum-plugin-openvswitch-agent',
|
||||
'openvswitch-datapath-dkms',
|
||||
['quantum-plugin-openvswitch-agent'],
|
||||
['openvswitch-datapath-dkms'],
|
||||
]
|
||||
|
||||
OVS_PKGS_FLAT = list(itertools.chain.from_iterable(OVS_PKGS))
|
||||
|
||||
|
||||
class NovaComputeUtilsTests(CharmTestCase):
|
||||
|
||||
|
@ -51,7 +54,7 @@ class NovaComputeUtilsTests(CharmTestCase):
|
|||
n_plugin.return_value = 'ovs'
|
||||
self.relation_ids.return_value = []
|
||||
result = utils.determine_packages()
|
||||
ex = utils.BASE_PACKAGES + OVS_PKGS + ['nova-compute-kvm']
|
||||
ex = utils.BASE_PACKAGES + OVS_PKGS_FLAT + ['nova-compute-kvm']
|
||||
self.assertEquals(ex, result)
|
||||
|
||||
@patch.object(utils, 'neutron_plugin')
|
||||
|
@ -62,7 +65,7 @@ class NovaComputeUtilsTests(CharmTestCase):
|
|||
n_plugin.return_value = 'ovs'
|
||||
self.relation_ids.return_value = ['ceph:0']
|
||||
result = utils.determine_packages()
|
||||
ex = (utils.BASE_PACKAGES + OVS_PKGS +
|
||||
ex = (utils.BASE_PACKAGES + OVS_PKGS_FLAT +
|
||||
['ceph-common', 'nova-compute-kvm'])
|
||||
self.assertEquals(ex, result)
|
||||
|
||||
|
|
Loading…
Reference in New Issue