Refactor for Mitaka and z/KVM

* Updates for mitaka baseline

* Add parts directory from nova compute

* Fixup typo

* Add serial console support

* Fixup rel to neutron-api

* Add missing hooks for napi-plugin

* Remap

* Drop deprecated option from nova-cc

* Add prevent arp spoofing config option inline with n-ovs

* Add cpu-mode and model to config options

* Fixup configuration context passback

* Drop remvoed _neutron_api_settings code

* Update tox to skip unit tests for now

* Add status support

* Update status message

* use comma in managing list

* Directly use internals of openstack utils to evaluate interface states

* Tweak interface handling

* Fixup typing

* Add wedge to ensure that status of relations inc neutron-plugin-api is OK

* Revert "Add wedge to ensure that status of relations inc neutron-plugin-api is OK"

This reverts commit 7b955846a636f69d3a46317bed876641ef583fb7.

* Add reserved-host-memory configuration support

* Add update status hook

* Add series to metadata.yaml

* Update copyright to apache 2.0

* Ensure VNC is disabled
This commit is contained in:
James Page 2016-10-26 15:12:24 +02:00 committed by Ryan Beisner
parent 568d50922d
commit f9f4e3fe0b
30 changed files with 515 additions and 310 deletions

8
.testr.conf Normal file
View File

@ -0,0 +1,8 @@
[DEFAULT]
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
${PYTHON:-python} -m subunit.run discover -t ./ ./unit_tests $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

0
actions/.keep Normal file
View File

View File

@ -70,3 +70,35 @@ options:
.
BE CAREFUL - this option allows you to disable all port level security within
an OpenStack cloud.
prevent-arp-spoofing:
type: boolean
default: true
description: |
Enable suppression of ARP responses that don't match an IP address that belongs
to the port from which they originate.
.
Only supported in OpenStack Liberty or newer, which has the required minimum version
of Open vSwitch.
cpu-mode:
type: string
default:
description: |
Set to 'host-model' to clone the host CPU feature flags; to
'host-passthrough' to use the host CPU model exactly; to 'custom' to
use a named CPU model; to 'none' to not set any CPU model. If
virt_type='kvm|qemu', it will default to 'host-model', otherwise it will
default to 'none'. Defaults to 'host-passthrough' for ppc64el, ppc64le
if no value is set.
cpu-model:
type: string
default:
description: |
Set to a named libvirt CPU model (see names listed in
/usr/share/libvirt/cpu_map.xml). Only has effect if cpu_mode='custom' and
virt_type='kvm|qemu'.
reserved-host-memory:
type: int
default: 512
description: |
Amount of memory in MB to reserve for the host. Defaults to 512MB.

View File

@ -2,16 +2,15 @@ Format: http://dep.debian.net/deps/dep5/
Files: *
Copyright: Copyright 2012, Canonical Ltd., All Rights Reserved.
License: GPL-3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

5
hooks/fabfile.py vendored
View File

@ -75,10 +75,5 @@ def fix_selinux_permission(path):
'{}'.format(path))
def fix_ml2_plugin_config():
sudo('sed -i "s!openvswitch/ovs_neutron_plugin.ini'
'!ml2/ml2_conf.ini!g" /etc/init.d/neutron-openvswitch-agent')
def fix_local_ip(f):
sudo('sed -i "s!LOCAL_IP!%s!g" %s' % (env.host, f))

View File

@ -0,0 +1 @@
nova_compute_hooks.py

View File

@ -0,0 +1 @@
nova_compute_hooks.py

View File

@ -0,0 +1 @@
nova_compute_hooks.py

View File

@ -0,0 +1 @@
nova_compute_hooks.py

View File

@ -21,6 +21,9 @@ from charmhelpers.core.hookenv import (
related_units,
ERROR,
)
from charmhelpers.core.strutils import (
bool_from_string,
)
# compatability functions to help with quantum -> neutron transition
@ -29,50 +32,6 @@ def _network_manager():
return manager()
def _neutron_api_settings():
'''
Inspects current neutron-plugin relation
'''
neutron_settings = {
'neutron_security_groups': False,
'l2_population': True,
'overlay_network_type': 'gre',
}
for rid in relation_ids('neutron-plugin-api'):
for unit in related_units(rid):
rdata = relation_get(rid=rid, unit=unit)
if 'l2-population' not in rdata:
continue
neutron_settings = {
'l2_population': rdata['l2-population'],
'neutron_security_groups': rdata['neutron-security-groups'],
'overlay_network_type': rdata['overlay-network-type'],
}
# Override with configuration if set to true
if config('disable-security-groups'):
neutron_settings['neutron_security_groups'] = False
return neutron_settings
return neutron_settings
def _neutron_security_groups():
'''
Inspects current cloud-compute relation and determine if nova-c-c has
instructed us to use neutron security groups.
'''
for rid in relation_ids('cloud-compute'):
for unit in related_units(rid):
groups = [
relation_get('neutron_security_groups',
rid=rid, unit=unit),
relation_get('quantum_security_groups',
rid=rid, unit=unit)
]
if ('yes' in groups or 'Yes' in groups):
return True
return False
def _neutron_plugin():
from nova_compute_utils import neutron_plugin
return neutron_plugin()
@ -91,7 +50,12 @@ class NovaComputeVirtContext(context.OSContextGenerator):
ctxt = {}
if config('instances-path') is not None:
ctxt['instances_path'] = config('instances-path')
return {}
if config('cpu-mode'):
ctxt['cpu_mode'] = config('cpu-mode')
if config('cpu-model'):
ctxt['cpu_model'] = config('cpu-model')
ctxt['reserved_host_memory'] = config('reserved-host-memory')
return ctxt
class CloudComputeContext(context.OSContextGenerator):
@ -148,6 +112,8 @@ class CloudComputeContext(context.OSContextGenerator):
'auth_protocol', **rel) or 'http',
'service_protocol': relation_get(
'service_protocol', **rel) or 'http',
'service_port': relation_get(
'service_port', **rel),
'neutron_auth_strategy': 'keystone',
'keystone_host': relation_get(
'auth_host', **rel),
@ -169,8 +135,6 @@ class CloudComputeContext(context.OSContextGenerator):
' '.join(missing))
return {}
neutron_ctxt['neutron_security_groups'] = _neutron_security_groups()
ks_url = '%s://%s:%s/v2.0' % (neutron_ctxt['auth_protocol'],
neutron_ctxt['keystone_host'],
neutron_ctxt['auth_port'])
@ -225,6 +189,19 @@ class CloudComputeContext(context.OSContextGenerator):
if net_manager:
ctxt['network_manager'] = self.network_manager
ctxt['network_manager_config'] = net_manager
# This is duplicating information in the context to enable
# common keystone fragment to be used in template
ctxt['service_protocol'] = net_manager.get('service_protocol')
ctxt['service_host'] = net_manager.get('keystone_host')
ctxt['service_port'] = net_manager.get('service_port')
ctxt['admin_tenant_name'] = net_manager.get(
'neutron_admin_tenant_name')
ctxt['admin_user'] = net_manager.get('neutron_admin_username')
ctxt['admin_password'] = net_manager.get('neutron_admin_password')
ctxt['auth_protocol'] = net_manager.get('auth_protocol')
ctxt['auth_host'] = net_manager.get('keystone_host')
ctxt['auth_port'] = net_manager.get('auth_port')
ctxt['api_version'] = net_manager.get('api_version')
vol_service = self.volume_context()
if vol_service:
@ -237,7 +214,7 @@ class CloudComputeContext(context.OSContextGenerator):
class NeutronRemoteComputeContext(context.NeutronContext):
interfaces = []
interfaces = ['neutron-plugin-api']
@property
def plugin(self):
@ -247,10 +224,6 @@ class NeutronRemoteComputeContext(context.NeutronContext):
def network_manager(self):
return _network_manager()
@property
def neutron_security_groups(self):
return _neutron_security_groups()
def _ensure_packages(self):
# NOTE(jamespage) no-op for nova-compute-proxy
pass
@ -266,5 +239,41 @@ class NeutronRemoteComputeContext(context.NeutronContext):
'neutron_security_groups': self.neutron_security_groups,
'config': '/etc/neutron/plugins/ml2/ml2_conf.ini'
}
ovs_ctxt.update(_neutron_api_settings())
neutron_api_settings = context.NeutronAPIContext()()
ovs_ctxt['neutron_security_groups'] = \
neutron_api_settings['neutron_security_groups']
ovs_ctxt['l2_population'] = neutron_api_settings['l2_population']
ovs_ctxt['distributed_routing'] = neutron_api_settings['enable_dvr']
ovs_ctxt['overlay_network_type'] = \
neutron_api_settings['overlay_network_type']
ovs_ctxt['prevent_arp_spoofing'] = config('prevent-arp-spoofing')
return ovs_ctxt
class SerialConsoleContext(context.OSContextGenerator):
@property
def enable_serial_console(self):
for rid in relation_ids('cloud-compute'):
for unit in related_units(rid):
_enable_sc = relation_get('enable_serial_console', rid=rid,
unit=unit)
if _enable_sc and bool_from_string(_enable_sc):
return 'true'
return 'false'
@property
def serial_console_base_url(self):
for rid in relation_ids('cloud-compute'):
for unit in related_units(rid):
base_url = relation_get('serial_console_base_url',
rid=rid, unit=unit)
if base_url is not None:
return base_url
return 'ws://127.0.0.1:6083/'
def __call__(self):
return {
'enable_serial_console': self.enable_serial_console,
'serial_console_base_url': self.serial_console_base_url,
}

View File

@ -32,6 +32,7 @@ from nova_compute_utils import (
restart_map,
register_configs,
NOVA_CONF,
assess_status,
)
from nova_compute_proxy import (
REMOTEProxy,
@ -98,7 +99,8 @@ def compute_joined(rid=None):
pass
@hooks.hook('cloud-compute-relation-changed')
@hooks.hook('cloud-compute-relation-changed',
'neutron-plugin-api-relation-changed')
@restart_on_change(restart_map(), proxy.restart_service)
def compute_changed():
CONFIGS.write_all()
@ -106,7 +108,8 @@ def compute_changed():
@hooks.hook('amqp-relation-broken',
'image-service-relation-broken')
'image-service-relation-broken',
'neutron-plugin-api-relation-broken')
@restart_on_change(restart_map(), proxy.restart_service)
def relation_broken():
CONFIGS.write_all()
@ -132,3 +135,4 @@ if __name__ == '__main__':
hooks.execute(sys.argv)
except UnregisteredHookError as e:
log('Unknown hook {} - skipping.'.format(e))
assess_status(CONFIGS)

View File

@ -37,7 +37,6 @@ from fabfile import (
disable_shell,
fix_path_ownership,
fix_selinux_permission,
fix_ml2_plugin_config,
fix_local_ip
)
from nova_compute_utils import CHARM_SCRATCH_DIR
@ -59,13 +58,12 @@ except ImportError:
TEMPLATE_DIR = 'templates'
PACKAGES = ['openstack-nova-compute',
'openstack-neutron-ml2',
'openstack-neutron-openvswitch',
'python-neutronclient']
CONFIG_FILES = [
'/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf.ini',
'/etc/neutron/plugins/ml2/openvswitch_agent.ini',
'/etc/nova/nova.conf']
@ -98,7 +96,6 @@ class REMOTEProxy():
def install(self):
self._setup_yum()
self._install_packages()
self._fix_ml2_plugin_config()
def _setup_yum(self):
log('Setup yum')
@ -109,16 +106,14 @@ class REMOTEProxy():
with open(filename, 'w') as f:
f.write(_render_template('yum.template', context))
execute(copy_file_as_root, filename,
'/etc/yum.repos.d/openstack-nova-compute-proxy-{}.repo'.format(repo_id))
'/etc/yum.repos.d/'
'openstack-nova-compute-proxy-{}.repo'.format(repo_id))
os.unlink(filename)
repo_id += 1
def _install_packages(self):
execute(yum_install, PACKAGES)
def _fix_ml2_plugin_config(self):
execute(fix_ml2_plugin_config)
def configure(self):
self.add_bridges()
@ -157,7 +152,8 @@ class REMOTEProxy():
self._fixup_local_ips()
def _fixup_local_ips(self):
execute(fix_local_ip, '/etc/neutron/plugins/ml2/ml2_conf.ini')
execute(fix_local_ip, '/etc/neutron/plugins/ml2/openvswitch_agent.ini')
execute(fix_local_ip, '/etc/nova/nova.conf')
def _render_template(template_name, context, template_dir=TEMPLATE_DIR):

View File

@ -19,23 +19,35 @@ from charmhelpers.core.hookenv import (
related_units,
relation_ids,
relation_get,
service_name
service_name,
status_set,
application_version_set,
)
from charmhelpers.core.host import mkdir
from charmhelpers.contrib.openstack import templating, context
from charmhelpers.contrib.openstack.utils import (
_determine_os_workload_status,
)
from nova_compute_context import (
CloudComputeContext,
NovaComputeVirtContext,
NeutronRemoteComputeContext,
SerialConsoleContext,
)
TEMPLATES = 'templates/'
CHARM_SCRATCH_DIR = '/var/lib/charm/%s' % service_name()
REQUIRED_INTERFACES = {
'messaging': ['amqp'],
'image': ['image-service'],
'neutron': ['neutron-plugin-api'],
}
NOVA_CONF_DIR = "%s/etc/nova" % CHARM_SCRATCH_DIR
NOVA_CONF = '%s/nova.conf' % NOVA_CONF_DIR
CHARM_SCRATCH_DIR = '/var/lib/charm/{}'.format(service_name())
NOVA_CONF_DIR = "{}/etc/nova".format(CHARM_SCRATCH_DIR)
NOVA_CONF = '{}/nova.conf'.format(NOVA_CONF_DIR)
BASE_RESOURCE_MAP = {
NOVA_CONF: {
@ -45,6 +57,7 @@ BASE_RESOURCE_MAP = {
context.OSConfigFlagContext(),
CloudComputeContext(),
NovaComputeVirtContext(),
SerialConsoleContext(),
context.SyslogContext(),
context.LogLevelContext(),
context.SubordinateConfigContext(
@ -54,8 +67,13 @@ BASE_RESOURCE_MAP = {
},
}
NEUTRON_CONF_DIR = "%s/etc/neutron" % CHARM_SCRATCH_DIR
NEUTRON_CONF = '%s/neutron.conf' % NEUTRON_CONF_DIR
NEUTRON_CONF_DIR = "{}/etc/neutron".format(CHARM_SCRATCH_DIR)
NEUTRON_CONF = '{}/neutron.conf'.format(NEUTRON_CONF_DIR)
OVS_AGENT_CONF = (
'{}/etc/neutron/plugins/ml2/'
'openvswitch_agent.ini'.format(CHARM_SCRATCH_DIR)
)
NEUTRON_RESOURCES = {
NEUTRON_CONF: {
@ -64,6 +82,10 @@ NEUTRON_RESOURCES = {
context.AMQPContext(ssl_dir=NEUTRON_CONF_DIR),
context.SyslogContext(),
context.LogLevelContext()],
},
OVS_AGENT_CONF: {
'services': ['neutron-openvswitch-agent'],
'contexts': [NeutronRemoteComputeContext()],
}
}
@ -87,15 +109,8 @@ def resource_map():
if plugin in ['ovs', 'ml2']:
nm_rsc = NEUTRON_RESOURCES
resource_map.update(nm_rsc)
conf = '{}/etc/neutron/plugins/ml2/ml2_conf.ini'.format(
CHARM_SCRATCH_DIR)
resource_map[conf] = {}
resource_map[conf]['services'] = ['neutron-openvswitch-agent']
resource_map[conf]['contexts'] = [NeutronRemoteComputeContext()]
else:
raise ValueError("Only Neutron ml2/ovs plugin "
raise ValueError("Only Neutron ML2/ovs plugin "
"is supported on this platform")
resource_map[NOVA_CONF]['contexts'].append(
@ -167,3 +182,30 @@ def network_manager():
if manager in ['quantum', 'neutron']:
return 'neutron'
return manager
def assess_status(configs):
"""Assess status of current unit
Decides what the state of the unit should be based on the current
configuration.
@param configs: a templating.OSConfigRenderer() object
@returns None - this function is executed for its side-effect
"""
state, message = _determine_os_workload_status(configs,
REQUIRED_INTERFACES.copy())
if state != 'active':
status_set(state, message)
else:
remote_hosts = config('remote-hosts')
if remote_hosts:
remote_hosts = remote_hosts.split()
status_set(
'active',
'Unit is ready (managing: {})'.format(','.join(remote_hosts))
)
else:
status_set(
'blocked',
'Missing remote-hosts configuration'
)
application_version_set(config('openstack-release'))

1
hooks/update-status Symbolic link
View File

@ -0,0 +1 @@
nova_compute_hooks.py

0
lib/.keep Normal file
View File

View File

@ -10,6 +10,9 @@ description: |
don't run Ubuntu.
tags:
- openstack
series:
- xenial
- trusty
provides:
cloud-compute:
interface: nova-compute

12
requirements.txt Normal file
View File

@ -0,0 +1,12 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr>=1.8.0,<1.9.0
PyYAML>=3.1.0
simplejson>=2.2.0
netifaces>=0.10.4
netaddr>=0.7.12,!=0.7.16
Jinja2>=2.6 # BSD License (3 clause)
six>=1.9.0
dnspython>=1.12.0
psutil>=1.1.1,<2.0.0

View File

@ -1,92 +0,0 @@
# kilo
###############################################################################
# [ WARNING ]
# Configuration file maintained by Juju. Local changes may be overwritten.
{% if restart_trigger -%}
# restart trigger: {{ restart_trigger }}
{% endif -%}
###############################################################################
[DEFAULT]
# Nova Network DHCP options
dhcpbridge_flagfile = /etc/nova/nova.conf
dhcpbridge = /usr/bin/nova-dhcpbridge
# General system paths
state_path=/var/lib/nova
lock_path=/var/lib/nova/tmp
# Logging options
logdir = /var/log/nova
verbose = {{ verbose }}
debug = {{ debug }}
use_syslog = {{ use_syslog }}
auth_strategy=keystone
compute_driver = libvirt.LibvirtDriver
{% if neutron_plugin and neutron_plugin == 'ovs' -%}
libvirt_vif_driver = nova.virt.libvirt.vif.LibvirtGenericVIFDriver
{% if neutron_security_groups -%}
security_group_api = neutron
firewall_driver = nova.virt.firewall.NoopFirewallDriver
{% endif -%}
{% endif -%}
{% if network_manager != 'neutron' and network_manager_config -%}
{% for key, value in network_manager_config.iteritems() -%}
{{ key }} = {{ value }}
{% endfor -%}
{% endif -%}
{% if network_manager == 'neutron' -%}
network_api_class = nova.network.neutronv2.api.API
{% else -%}
network_manager = nova.network.manager.FlatDHCPManager
{% endif -%}
{% if volume_service -%}
volume_api_class = nova.volume.cinder.API
{% endif -%}
{% if user_config_flags -%}
{% for key, value in user_config_flags.iteritems() -%}
{{ key }} = {{ value }}
{% endfor -%}
{% endif -%}
{% if instances_path -%}
instances_path = {{ instances_path }}
{% endif -%}
{% if sections and 'DEFAULT' in sections -%}
{% for key, value in sections['DEFAULT'] -%}
{{ key }} = {{ value }}
{% endfor -%}
{% endif -%}
{% if network_manager == 'neutron' and network_manager_config -%}
[neutron]
url = {{ network_manager_config.neutron_url }}
{% if network_manager_config.keystone_host -%}
auth_strategy = keystone
admin_tenant_name = {{ network_manager_config.neutron_admin_tenant_name }}
admin_username = {{ network_manager_config.neutron_admin_username }}
admin_password = {{ network_manager_config.neutron_admin_password }}
admin_auth_url = {{ network_manager_config.auth_protocol }}://{{ network_manager_config.keystone_host }}:{{ network_manager_config.auth_port }}/v2.0
{% if metadata_shared_secret -%}
metadata_proxy_shared_secret = {{ metadata_shared_secret }}
service_metadata_proxy=True
{% endif -%}
{% endif -%}
{% endif -%}
{% if glance_api_servers -%}
[glance]
api_servers = {{ glance_api_servers }}
{% endif -%}
{% include "section-rabbitmq-oslo" %}
[oslo_concurrency]
lock_path=/var/lock/nova

View File

@ -1,23 +1,30 @@
# kilo
# mitaka
###############################################################################
# [ WARNING ]
# Configuration file maintained by Juju. Local changes may be overwritten.
# Config managed by nova-compute-proxy charm
###############################################################################
[DEFAULT]
state_path = /var/lib/neutron
lock_path = $state_path/lock
# Logging options
verbose = {{ verbose }}
debug = {{ debug }}
use_syslog = {{ use_syslog }}
state_path = /var/lib/neutron
{% if core_plugin -%}
core_plugin = {{ core_plugin }}
{% endif -%}
auth_strategy = keystone
notification_driver = messagingv2
default_notification_level = INFO
notification_topics = notifications
{% include "section-rabbitmq-oslo" %}
[QUOTAS]
[DEFAULT_SERVICETYPE]
[AGENT]
root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf

162
templates/mitaka/nova.conf Normal file
View File

@ -0,0 +1,162 @@
# mitaka
###############################################################################
# [ WARNING ]
# Configuration file maintained by Juju. Local changes may be overwritten.
{% if restart_trigger -%}
# restart trigger: {{ restart_trigger }}
{% endif -%}
###############################################################################
[DEFAULT]
debug={{ debug }}
use_syslog = {{ use_syslog }}
logdir=/var/log/nova
state_path=/var/lib/nova
enabled_apis=osapi_compute,metadata
auth_strategy=keystone
my_ip = LOCAL_IP
{% if neutron_plugin and neutron_plugin in ('ovs') -%}
libvirt_vif_driver = nova.virt.libvirt.vif.LibvirtGenericVIFDriver
{% if neutron_security_groups -%}
security_group_api = neutron
firewall_driver = nova.virt.firewall.NoopFirewallDriver
{% endif -%}
{% endif -%}
{% if network_manager != 'neutron' and network_manager_config -%}
{% for key, value in network_manager_config.iteritems() -%}
{{ key }} = {{ value }}
{% endfor -%}
{% endif -%}
{% if network_manager == 'neutron' -%}
network_api_class = nova.network.neutronv2.api.API
use_neutron = True
{% else -%}
network_manager = nova.network.manager.FlatDHCPManager
{% endif -%}
{% if volume_service -%}
volume_api_class = nova.volume.cinder.API
{% endif -%}
{% if user_config_flags -%}
{% for key, value in user_config_flags.iteritems() -%}
{{ key }} = {{ value }}
{% endfor -%}
{% endif -%}
{% if instances_path -%}
instances_path = {{ instances_path }}
{% endif -%}
{% if enable_designate -%}
notification_driver = {{ notification_driver }}
notification_topics = {{ notification_topics }}
notify_on_state_change = {{ notify_on_state_change }}
{% endif -%}
{% if sections and 'DEFAULT' in sections -%}
{% for key, value in sections['DEFAULT'] -%}
{{ key }} = {{ value }}
{% endfor -%}
{% endif -%}
{% if vcpu_pin_set -%}
vcpu_pin_set = {{ vcpu_pin_set }}
{% endif -%}
reserved_host_memory = {{ reserved_host_memory }}
{% if pci_passthrough_whitelist -%}
pci_passthrough_whitelist = {{ pci_passthrough_whitelist }}
{% endif -%}
{% include "section-zeromq" %}
{% if network_manager == 'neutron' and network_manager_config -%}
[neutron]
url = {{ network_manager_config.neutron_url }}
{% if network_manager_config.keystone_host -%}
{% if neutron_plugin and neutron_plugin == 'vsp' -%}
ovs_bridge = alubr0
{% endif -%}
{% if auth_host -%}
auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = {{ admin_tenant_name }}
username = {{ admin_user }}
password = {{ admin_password }}
signing_dir = {{ signing_dir }}
{% endif -%}
{% if metadata_shared_secret -%}
metadata_proxy_shared_secret = {{ metadata_shared_secret }}
service_metadata_proxy=True
{% endif -%}
{% endif -%}
{% endif -%}
{% include "section-keystone-authtoken-mitaka" %}
{% if glance_api_servers -%}
[glance]
api_servers = {{ glance_api_servers }}
{% endif -%}
[libvirt]
{% if cpu_mode -%}
cpu_mode = {{ cpu_mode }}
{% endif -%}
{% if cpu_model -%}
cpu_model = {{ cpu_model }}
{% endif -%}
{% if libvirt_images_type -%}
images_type = {{ libvirt_images_type }}
{% endif -%}
{% if libvirt_images_type and rbd_pool -%}
images_rbd_pool = {{ rbd_pool }}
images_rbd_ceph_conf = {{ libvirt_rbd_images_ceph_conf }}
inject_password = false
inject_key = false
inject_partition = -2
{% endif -%}
rbd_user = {{ rbd_user }}
rbd_secret_uuid = {{ rbd_secret_uuid }}
{% if live_migration_uri -%}
live_migration_uri = {{ live_migration_uri }}
{% endif -%}
{% if disk_cachemodes -%}
disk_cachemodes = {{ disk_cachemodes }}
{% endif %}
# Disable tunnelled migration so that selective
# live block migration can be supported.
live_migration_tunnelled = False
{% if virt_type == 'lxd' and enable_live_migration -%}
[lxd]
allow_live_migration = True
{% endif -%}
{% include "parts/section-database" %}
{% include "section-rabbitmq-oslo" %}
{% include "parts/section-cinder" %}
[oslo_concurrency]
lock_path=/var/lock/nova
[workarounds]
disable_libvirt_livesnapshot = False
{% include "parts/section-ephemeral" %}
{% include "parts/section-serial-console" %}
[vnc]
enabled = False

View File

@ -1,33 +1,19 @@
# icehouse
# mitaka
###############################################################################
# [ WARNING ]
# Configuration file maintained by Juju. Local changes may be overwritten.
# Config generated by nova-compute-proxy charm
###############################################################################
[ml2]
type_drivers = gre,vxlan,vlan,flat
tenant_network_types = gre,vxlan,vlan,flat
mechanism_drivers = openvswitch,l2population
[ml2_type_gre]
tunnel_id_ranges = 1:1000
[ml2_type_vxlan]
vni_ranges = 1001:2000
[ml2_type_vlan]
network_vlan_ranges = physnet1:1000:2000
[ml2_type_flat]
flat_networks = physnet1
[ovs]
enable_tunneling = True
local_ip = LOCAL_IP
bridge_mappings = physnet1:br-data
bridge_mappings = {{ bridge_mappings }}
[agent]
tunnel_types = {{ overlay_network_type }}
l2_population = {{ l2_population }}
enable_distributed_routing = {{ distributed_routing }}
prevent_arp_spoofing = {{ prevent_arp_spoofing }}
[securitygroup]
{% if neutron_security_groups -%}

View File

@ -1,25 +0,0 @@
# icehouse
###############################################################################
# [ WARNING ]
# Configuration file maintained by Juju. Local changes may be overwritten.
###############################################################################
[DEFAULT]
state_path = /var/lib/neutron
lock_path = $state_path/lock
# Logging options
verbose = {{ verbose }}
debug = {{ debug }}
use_syslog = {{ use_syslog }}
{% if core_plugin -%}
core_plugin = {{ core_plugin }}
{% endif -%}
{% include "parts/rabbitmq" %}
[AGENT]
root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf
[keystone_authtoken]
signing_dir = /var/lib/neutron/keystone-signing

View File

@ -1,72 +0,0 @@
# icehouse
###############################################################################
# [ WARNING ]
# Configuration file maintained by Juju. Local changes may be overwritten.
{% if restart_trigger -%}
# restart trigger: {{ restart_trigger }}
{% endif -%}
###############################################################################
[DEFAULT]
# Nova Network DHCP options
dhcpbridge_flagfile = /etc/nova/nova.conf
dhcpbridge = /usr/bin/nova-dhcpbridge
# General system paths
state_path=/var/lib/nova
lock_path=/var/lib/nova/tmp
# Logging options
logdir = /var/log/nova
verbose = {{ verbose }}
debug = {{ debug }}
use_syslog = {{ use_syslog }}
auth_strategy=keystone
compute_driver = libvirt.LibvirtDriver
{% include "parts/rabbitmq" %}
{% if glance_api_servers -%}
glance_api_servers = {{ glance_api_servers }}
{% endif -%}
{% if neutron_plugin and neutron_plugin == 'ovs' -%}
libvirt_vif_driver = nova.virt.libvirt.vif.LibvirtGenericVIFDriver
{% if neutron_security_groups -%}
security_group_api = neutron
firewall_driver = nova.virt.firewall.NoopFirewallDriver
{% endif -%}
{% endif -%}
{% if network_manager_config -%}
{% for key, value in network_manager_config.iteritems() -%}
{{ key }} = {{ value }}
{% endfor -%}
{% endif -%}
{% if network_manager == 'neutron' -%}
network_api_class = nova.network.neutronv2.api.API
{% else -%}
network_manager = nova.network.manager.FlatDHCPManager
{% endif -%}
{% if volume_service -%}
volume_api_class = nova.volume.cinder.API
{% endif -%}
{% if user_config_flags -%}
{% for key, value in user_config_flags.iteritems() -%}
{{ key }} = {{ value }}
{% endfor -%}
{% endif -%}
{% if instances_path -%}
instances_path = {{ instances_path }}
{% endif -%}
{% if sections and 'DEFAULT' in sections -%}
{% for key, value in sections['DEFAULT'] -%}
{{ key }} = {{ value }}
{% endfor -%}
{% endif -%}

3
templates/parts/database Normal file
View File

@ -0,0 +1,3 @@
{% if database_host -%}
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 -%}

View File

@ -0,0 +1,9 @@
{% if volume_service and volume_service == 'cinder' -%}
[cinder]
{% if use_internal_endpoints -%}
catalog_info = volumev2:cinderv2:internalURL
{% endif %}
{% if region -%}
os_region_name = {{ region }}
{% endif %}
{% endif -%}

View File

@ -0,0 +1,4 @@
{% if database_host -%}
[database]
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 -%}

View File

@ -0,0 +1,8 @@
{% for section in sections -%}
{% if section != 'DEFAULT' -%}
[{{ section }}]
{% for key, value in sections[section] -%}
{{ key }} = {{ value }}
{% endfor %}
{% endif %}
{%- endfor %}

View File

@ -0,0 +1,4 @@
[serial_console]
enabled = {{ enable_serial_console }}
proxyclient_address = {{ console_listen_addr }}
base_url = {{ serial_console_base_url }}

23
test-requirements.txt Normal file
View File

@ -0,0 +1,23 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
coverage>=3.6
mock>=1.2
flake8>=2.2.4,<=2.4.1
os-testr>=0.4.1
charm-tools>=2.0.0
requests==2.6.0
# BEGIN: Amulet OpenStack Charm Helper Requirements
# Liberty client lower constraints
amulet>=1.14.3,<2.0
bundletester>=0.6.1,<1.0
python-ceilometerclient>=1.5.0,<2.0
python-cinderclient>=1.4.0,<2.0
python-glanceclient>=1.1.0,<2.0
python-heatclient>=0.8.0,<1.0
python-novaclient>=2.30.1,<3.0
python-openstackclient>=1.7.0,<2.0
python-swiftclient>=2.6.0,<3.0
pika>=0.10.0,<1.0
distro-info
# END: Amulet OpenStack Charm Helper Requirements

83
tox.ini Normal file
View File

@ -0,0 +1,83 @@
# Classic charm: ./tox.ini
# This file is managed centrally by release-tools and should not be modified
# within individual charm repos.
[tox]
envlist = pep8,py27
skipsdist = True
[testenv]
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
CHARM_DIR={envdir}
AMULET_SETUP_TIMEOUT=2700
install_command =
pip install --allow-unverified python-apt {opts} {packages}
commands = ostestr {posargs}
whitelist_externals = juju
passenv = HOME TERM AMULET_*
[testenv:py27]
basepython = python2.7
whitelist_externals = echo
commands =
echo "No unit tests for this charm"
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:pep8]
basepython = python2.7
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = flake8 {posargs} hooks unit_tests tests actions lib
charm-proof
[testenv:venv]
commands = {posargs}
[testenv:func27-noop]
# DRY RUN - For Debug
basepython = python2.7
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
bundletester -vl DEBUG -r json -o func-results.json --test-pattern "gate-*" -n --no-destroy
[testenv:func27]
# Charm Functional Test
# Run all gate tests which are +x (expected to always pass)
basepython = python2.7
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
bundletester -vl DEBUG -r json -o func-results.json --test-pattern "gate-*" --no-destroy
[testenv:func27-smoke]
# Charm Functional Test
# Run a specific test as an Amulet smoke test (expected to always pass)
basepython = python2.7
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
bundletester -vl DEBUG -r json -o func-results.json gate-basic-xenial-mitaka --no-destroy
[testenv:func27-dfs]
# Charm Functional Test
# Run all deploy-from-source tests which are +x (may not always pass!)
basepython = python2.7
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
bundletester -vl DEBUG -r json -o func-results.json --test-pattern "dfs-*" --no-destroy
[testenv:func27-dev]
# Charm Functional Test
# Run all development test targets which are +x (may not always pass!)
basepython = python2.7
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
bundletester -vl DEBUG -r json -o func-results.json --test-pattern "dev-*" --no-destroy
[flake8]
ignore = E402,E226
exclude = */charmhelpers