Enable notifications for designate

This commit is contained in:
Liam Young 2016-01-22 10:33:27 +00:00
parent 100779616b
commit 2c918a46b3
8 changed files with 214 additions and 6 deletions

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

@ -452,6 +452,23 @@ class MetadataServiceContext(context.OSContextGenerator):
return ctxt return ctxt
class DesignateContext(context.OSContextGenerator):
def __call__(self):
ctxt = {}
ctxt['enable_designate_designate'] = False
for rid in relation_ids('nova-designate'):
if related_units(rid):
ctxt['enable_designate_designate'] = True
if ctxt['enable_designate_designate']:
ctxt['notification_driver'] = 'messaging'
ctxt['notification_topics'] = 'notifications_designate'
ctxt['notify_on_state_change'] = 'vm_and_task_state'
# ctxt['instance_usage_audit_period'] = 'hour'
# ctxt['instance_usage_audit'] = 'true'
return ctxt
class NeutronComputeContext(context.NeutronContext): class NeutronComputeContext(context.NeutronContext):
interfaces = [] interfaces = []

View File

@ -78,6 +78,7 @@ from nova_compute_context import (
CEPH_CONF, CEPH_CONF,
ceph_config_file, ceph_config_file,
HostIPContext, HostIPContext,
DesignateContext,
) )
CA_CERT_PATH = '/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt' CA_CERT_PATH = '/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt'
@ -178,6 +179,7 @@ BASE_RESOURCE_MAP = {
context.NotificationDriverContext(), context.NotificationDriverContext(),
MetadataServiceContext(), MetadataServiceContext(),
HostIPContext(), HostIPContext(),
DesignateContext(),
context.LogLevelContext()], context.LogLevelContext()],
}, },
} }

View File

@ -27,6 +27,8 @@ requires:
interface: glance interface: glance
ceph: ceph:
interface: ceph-client interface: ceph-client
nova-designate:
interface: nova-designate
lxd: lxd:
interface: containers interface: containers
scope: container scope: container

View File

@ -107,12 +107,6 @@ volume_api_class = nova.volume.cinder.API
instances_path = {{ instances_path }} instances_path = {{ instances_path }}
{% endif -%} {% endif -%}
notification_driver=messaging
notification_topics = notifications_designate
notify_on_state_change = vm_and_task_state
instance_usage_audit_period = hour
instance_usage_audit = true
{% if sections and 'DEFAULT' in sections -%} {% if sections and 'DEFAULT' in sections -%}
{% for key, value in sections['DEFAULT'] -%} {% for key, value in sections['DEFAULT'] -%}
{{ key }} = {{ value }} {{ key }} = {{ value }}

190
templates/liberty/nova.conf Normal file
View File

@ -0,0 +1,190 @@
# liberty
###############################################################################
# [ WARNING ]
# Configuration file maintained by Juju. Local changes may be overwritten.
{% if restart_trigger -%}
# restart trigger: {{ restart_trigger }}
{% endif -%}
###############################################################################
[DEFAULT]
verbose={{ verbose }}
debug={{ debug }}
dhcpbridge_flagfile=/etc/nova/nova.conf
dhcpbridge=/usr/bin/nova-dhcpbridge
logdir=/var/log/nova
state_path=/var/lib/nova
force_dhcp_release=True
use_syslog = {{ use_syslog }}
ec2_private_dns_show_ip=True
api_paste_config=/etc/nova/api-paste.ini
enabled_apis=ec2,osapi_compute,metadata
auth_strategy=keystone
my_ip = {{ host_ip }}
{% if arch == 'aarch64' -%}
libvirt_use_virtio_for_bridges=False
libvirt_disk_prefix=vd
{% endif -%}
{% if console_vnc_type -%}
vnc_enabled = True
novnc_enabled = True
vnc_keymap = {{ console_keymap }}
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = {{ console_listen_addr }}
{% if console_access_protocol == 'novnc' or console_access_protocol == 'vnc' -%}
novncproxy_base_url = {{ novnc_proxy_address }}
{% endif -%}
{% if console_access_protocol == 'xvpvnc' or console_access_protocol == 'vnc' -%}
xvpvncproxy_port = {{ xvpvnc_proxy_port }}
xvpvncproxy_host = {{ xvpvnc_proxy_host }}
xvpvncproxy_base_url = {{ xvpvnc_proxy_address }}
{% endif -%}
{% else -%}
vnc_enabled = False
novnc_enabled = False
{% endif -%}
{% if neutron_plugin and neutron_plugin in ('ovs', 'midonet') -%}
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 neutron_plugin and neutron_plugin == 'vsp' -%}
network_api_class=nova.network.neutronv2.api.API
libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtGenericVIFDriver
neutron_ovs_bridge=alubr0
security_group_api=nova
firewall_driver = nova.virt.firewall.NoopFirewallDriver
{% endif -%}
{% if neutron_plugin and (neutron_plugin == 'nvp' or neutron_plugin == 'nsx') -%}
libvirt_vif_driver = nova.virt.libvirt.vif.LibvirtOpenVswitchVirtualPortDriver
security_group_api = neutron
firewall_driver = nova.virt.firewall.NoopFirewallDriver
{% endif -%}
{% if neutron_plugin and neutron_plugin == 'Calico' -%}
security_group_api = neutron
firewall_driver = nova.virt.firewall.NoopFirewallDriver
{% endif -%}
{% if neutron_plugin and neutron_plugin == 'plumgrid' -%}
security_group_api=neutron
firewall_driver = nova.virt.firewall.NoopFirewallDriver
{% 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 network_device_mtu -%}
network_device_mtu = {{ network_device_mtu }}
{% 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_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 -%}
{% 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 -%}
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 -%}
{% if console_access_protocol == 'spice' -%}
[spice]
agent_enabled = True
enabled = True
html5proxy_base_url = {{ spice_proxy_address }}
keymap = {{ console_keymap }}
server_listen = 0.0.0.0
server_proxyclient_address = {{ console_listen_addr }}
{% 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 }}
images_rbd_pool = {{ rbd_pool }}
images_rbd_ceph_conf = {{ libvirt_rbd_images_ceph_conf }}
inject_password=false
inject_key=false
inject_partition=-2
{% endif -%}
{% if rbd_pool -%}
rbd_pool = {{ rbd_pool }}
rbd_user = {{ rbd_user }}
rbd_secret_uuid = {{ rbd_secret_uuid }}
{% endif -%}
{% if live_migration_uri -%}
live_migration_uri = {{ live_migration_uri }}
{% endif -%}
{% if disk_cachemodes -%}
disk_cachemodes = {{ disk_cachemodes }}
{% endif -%}
{% include "parts/section-database" %}
{% include "section-rabbitmq-oslo" %}
[oslo_concurrency]
lock_path=/var/lock/nova