Merge lp:~gnuoy/charms/trusty/nova-compute/dnsaas-tactical into lp:~openstack-charmers-archive/charms/trusty/nova-compute/next

Proposed by Liam Young on 2016-01-26
Status: Merged
Merged at revision: 198
Proposed branch: lp:~gnuoy/charms/trusty/nova-compute/dnsaas-tactical
Merge into: lp:~openstack-charmers-archive/charms/trusty/nova-compute/next
Diff against target: 315 lines (+245/-0)
6 files modified
hooks/nova_compute_context.py (+15/-0)
hooks/nova_compute_hooks.py (+6/-0)
hooks/nova_compute_utils.py (+2/-0)
metadata.yaml (+2/-0)
templates/liberty/nova.conf (+190/-0)
unit_tests/test_nova_compute_contexts.py (+30/-0)
To merge this branch: bzr merge lp:~gnuoy/charms/trusty/nova-compute/dnsaas-tactical
Reviewer Review Type Date Requested Status
James Page 2016-01-26 Needs Fixing on 2016-01-26
Review via email: mp+283923@code.launchpad.net
To post a comment you must log in.
James Page (james-page) wrote :

I like the approach of using a relation to enable the designate notifications; however we need to validate that these settings won't override those set by the ceilometer-agent subordinate charm for ceilometer, as that uses the same keys (I think).

review: Needs Information
James Page (james-page) :
review: Needs Fixing

charm_unit_test #16946 nova-compute-next for gnuoy mp283923
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/16946/

charm_lint_check #18188 nova-compute-next for gnuoy mp283923
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
make: *** [lint] Error 1
ERROR:root:Make target returned non-zero.

Full lint test output: http://paste.ubuntu.com/14672765/
Build: http://10.245.162.77:8080/job/charm_lint_check/18188/

charm_lint_check #18193 nova-compute-next for gnuoy mp283923
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
make: *** [lint] Error 1
ERROR:root:Make target returned non-zero.

Full lint test output: http://paste.ubuntu.com/14673160/
Build: http://10.245.162.77:8080/job/charm_lint_check/18193/

charm_amulet_test #9061 nova-compute-next for gnuoy mp283923
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/9061/

James Page (james-page) wrote :

Confirmed functional; please tidyup the bits and pieces from my original feedback but generally +1.

charm_lint_check #368 nova-compute-next for gnuoy mp283923
    LINT OK: passed

Build: http://10.245.162.36:8080/job/charm_lint_check/368/

charm_unit_test #291 nova-compute-next for gnuoy mp283923
    UNIT OK: passed

Build: http://10.245.162.36:8080/job/charm_unit_test/291/

charm_amulet_test #142 nova-compute-next for gnuoy mp283923
    AMULET OK: passed

Build: http://10.245.162.36:8080/job/charm_amulet_test/142/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added symlink 'hooks/nova-designate-relation-broken'
2=== target is u'nova_compute_hooks.py'
3=== added symlink 'hooks/nova-designate-relation-changed'
4=== target is u'nova_compute_hooks.py'
5=== added symlink 'hooks/nova-designate-relation-joined'
6=== target is u'nova_compute_hooks.py'
7=== modified file 'hooks/nova_compute_context.py'
8--- hooks/nova_compute_context.py 2015-11-10 13:39:24 +0000
9+++ hooks/nova_compute_context.py 2016-02-12 11:10:43 +0000
10@@ -452,6 +452,21 @@
11 return ctxt
12
13
14+class DesignateContext(context.OSContextGenerator):
15+
16+ def __call__(self):
17+ ctxt = {}
18+ ctxt['enable_designate'] = False
19+ for rid in relation_ids('nova-designate'):
20+ if related_units(rid):
21+ ctxt['enable_designate'] = True
22+ if ctxt['enable_designate']:
23+ ctxt['notification_driver'] = 'messaging'
24+ ctxt['notification_topics'] = 'notifications_designate'
25+ ctxt['notify_on_state_change'] = 'vm_and_task_state'
26+ return ctxt
27+
28+
29 class NeutronComputeContext(context.NeutronContext):
30 interfaces = []
31
32
33=== modified file 'hooks/nova_compute_hooks.py'
34--- hooks/nova_compute_hooks.py 2016-01-15 14:13:25 +0000
35+++ hooks/nova_compute_hooks.py 2016-02-12 11:10:43 +0000
36@@ -422,6 +422,12 @@
37 service_restart('nova-compute')
38
39
40+@hooks.hook('nova-designate-relation-changed')
41+@restart_on_change(restart_map())
42+def designate_changed():
43+ CONFIGS.write(NOVA_CONF)
44+
45+
46 def main():
47 try:
48 hooks.execute(sys.argv)
49
50=== modified file 'hooks/nova_compute_utils.py'
51--- hooks/nova_compute_utils.py 2015-12-02 09:55:37 +0000
52+++ hooks/nova_compute_utils.py 2016-02-12 11:10:43 +0000
53@@ -78,6 +78,7 @@
54 CEPH_CONF,
55 ceph_config_file,
56 HostIPContext,
57+ DesignateContext,
58 )
59
60 CA_CERT_PATH = '/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt'
61@@ -178,6 +179,7 @@
62 context.NotificationDriverContext(),
63 MetadataServiceContext(),
64 HostIPContext(),
65+ DesignateContext(),
66 context.LogLevelContext()],
67 },
68 }
69
70=== modified file 'metadata.yaml'
71--- metadata.yaml 2015-11-18 10:44:39 +0000
72+++ metadata.yaml 2016-02-12 11:10:43 +0000
73@@ -27,6 +27,8 @@
74 interface: glance
75 ceph:
76 interface: ceph-client
77+ nova-designate:
78+ interface: nova-designate
79 lxd:
80 interface: containers
81 scope: container
82
83=== added directory 'templates/liberty'
84=== added file 'templates/liberty/nova.conf'
85--- templates/liberty/nova.conf 1970-01-01 00:00:00 +0000
86+++ templates/liberty/nova.conf 2016-02-12 11:10:43 +0000
87@@ -0,0 +1,190 @@
88+# liberty
89+###############################################################################
90+# [ WARNING ]
91+# Configuration file maintained by Juju. Local changes may be overwritten.
92+{% if restart_trigger -%}
93+# restart trigger: {{ restart_trigger }}
94+{% endif -%}
95+###############################################################################
96+[DEFAULT]
97+verbose={{ verbose }}
98+debug={{ debug }}
99+dhcpbridge_flagfile=/etc/nova/nova.conf
100+dhcpbridge=/usr/bin/nova-dhcpbridge
101+logdir=/var/log/nova
102+state_path=/var/lib/nova
103+force_dhcp_release=True
104+use_syslog = {{ use_syslog }}
105+ec2_private_dns_show_ip=True
106+api_paste_config=/etc/nova/api-paste.ini
107+enabled_apis=ec2,osapi_compute,metadata
108+auth_strategy=keystone
109+my_ip = {{ host_ip }}
110+
111+{% if arch == 'aarch64' -%}
112+libvirt_use_virtio_for_bridges=False
113+libvirt_disk_prefix=vd
114+{% endif -%}
115+
116+{% if console_vnc_type -%}
117+vnc_enabled = True
118+novnc_enabled = True
119+vnc_keymap = {{ console_keymap }}
120+vncserver_listen = 0.0.0.0
121+vncserver_proxyclient_address = {{ console_listen_addr }}
122+{% if console_access_protocol == 'novnc' or console_access_protocol == 'vnc' -%}
123+novncproxy_base_url = {{ novnc_proxy_address }}
124+{% endif -%}
125+{% if console_access_protocol == 'xvpvnc' or console_access_protocol == 'vnc' -%}
126+xvpvncproxy_port = {{ xvpvnc_proxy_port }}
127+xvpvncproxy_host = {{ xvpvnc_proxy_host }}
128+xvpvncproxy_base_url = {{ xvpvnc_proxy_address }}
129+{% endif -%}
130+{% else -%}
131+vnc_enabled = False
132+novnc_enabled = False
133+{% endif -%}
134+
135+{% if neutron_plugin and neutron_plugin in ('ovs', 'midonet') -%}
136+libvirt_vif_driver = nova.virt.libvirt.vif.LibvirtGenericVIFDriver
137+{% if neutron_security_groups -%}
138+security_group_api = neutron
139+firewall_driver = nova.virt.firewall.NoopFirewallDriver
140+{% endif -%}
141+{% endif -%}
142+
143+{% if neutron_plugin and neutron_plugin == 'vsp' -%}
144+network_api_class=nova.network.neutronv2.api.API
145+libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtGenericVIFDriver
146+neutron_ovs_bridge=alubr0
147+security_group_api=nova
148+firewall_driver = nova.virt.firewall.NoopFirewallDriver
149+{% endif -%}
150+
151+{% if neutron_plugin and (neutron_plugin == 'nvp' or neutron_plugin == 'nsx') -%}
152+libvirt_vif_driver = nova.virt.libvirt.vif.LibvirtOpenVswitchVirtualPortDriver
153+security_group_api = neutron
154+firewall_driver = nova.virt.firewall.NoopFirewallDriver
155+{% endif -%}
156+
157+{% if neutron_plugin and neutron_plugin == 'Calico' -%}
158+security_group_api = neutron
159+firewall_driver = nova.virt.firewall.NoopFirewallDriver
160+{% endif -%}
161+
162+{% if neutron_plugin and neutron_plugin == 'plumgrid' -%}
163+security_group_api=neutron
164+firewall_driver = nova.virt.firewall.NoopFirewallDriver
165+{% endif -%}
166+
167+{% if network_manager != 'neutron' and network_manager_config -%}
168+{% for key, value in network_manager_config.iteritems() -%}
169+{{ key }} = {{ value }}
170+{% endfor -%}
171+{% endif -%}
172+
173+{% if network_manager == 'neutron' -%}
174+network_api_class = nova.network.neutronv2.api.API
175+{% else -%}
176+network_manager = nova.network.manager.FlatDHCPManager
177+{% endif -%}
178+
179+{% if network_device_mtu -%}
180+network_device_mtu = {{ network_device_mtu }}
181+{% endif -%}
182+
183+{% if volume_service -%}
184+volume_api_class = nova.volume.cinder.API
185+{% endif -%}
186+
187+{% if user_config_flags -%}
188+{% for key, value in user_config_flags.iteritems() -%}
189+{{ key }} = {{ value }}
190+{% endfor -%}
191+{% endif -%}
192+
193+{% if instances_path -%}
194+instances_path = {{ instances_path }}
195+{% endif -%}
196+
197+{% if enable_designate -%}
198+notification_driver = {{ notification_driver }}
199+notification_topics = {{ notification_topics }}
200+notify_on_state_change = {{ notify_on_state_change }}
201+{% endif -%}
202+
203+{% if sections and 'DEFAULT' in sections -%}
204+{% for key, value in sections['DEFAULT'] -%}
205+{{ key }} = {{ value }}
206+{% endfor -%}
207+{% endif -%}
208+
209+{% include "section-zeromq" %}
210+
211+{% if network_manager == 'neutron' and network_manager_config -%}
212+[neutron]
213+url = {{ network_manager_config.neutron_url }}
214+{% if network_manager_config.keystone_host -%}
215+{% if neutron_plugin and neutron_plugin == 'vsp' -%}
216+ovs_bridge = alubr0
217+{% endif -%}
218+auth_strategy = keystone
219+admin_tenant_name = {{ network_manager_config.neutron_admin_tenant_name }}
220+admin_username = {{ network_manager_config.neutron_admin_username }}
221+admin_password = {{ network_manager_config.neutron_admin_password }}
222+admin_auth_url = {{ network_manager_config.auth_protocol }}://{{ network_manager_config.keystone_host }}:{{ network_manager_config.auth_port }}/v2.0
223+{% if metadata_shared_secret -%}
224+metadata_proxy_shared_secret = {{ metadata_shared_secret }}
225+service_metadata_proxy=True
226+{% endif -%}
227+{% endif -%}
228+{% endif -%}
229+
230+{% if glance_api_servers -%}
231+[glance]
232+api_servers = {{ glance_api_servers }}
233+{% endif -%}
234+
235+{% if console_access_protocol == 'spice' -%}
236+[spice]
237+agent_enabled = True
238+enabled = True
239+html5proxy_base_url = {{ spice_proxy_address }}
240+keymap = {{ console_keymap }}
241+server_listen = 0.0.0.0
242+server_proxyclient_address = {{ console_listen_addr }}
243+{% endif -%}
244+
245+[libvirt]
246+{% if cpu_mode -%}
247+cpu_mode = {{ cpu_mode }}
248+{% endif -%}
249+{% if cpu_model -%}
250+cpu_model = {{ cpu_model }}
251+{% endif -%}
252+{% if libvirt_images_type -%}
253+images_type = {{ libvirt_images_type }}
254+images_rbd_pool = {{ rbd_pool }}
255+images_rbd_ceph_conf = {{ libvirt_rbd_images_ceph_conf }}
256+inject_password=false
257+inject_key=false
258+inject_partition=-2
259+{% endif -%}
260+{% if rbd_pool -%}
261+rbd_pool = {{ rbd_pool }}
262+rbd_user = {{ rbd_user }}
263+rbd_secret_uuid = {{ rbd_secret_uuid }}
264+{% endif -%}
265+{% if live_migration_uri -%}
266+live_migration_uri = {{ live_migration_uri }}
267+{% endif -%}
268+{% if disk_cachemodes -%}
269+disk_cachemodes = {{ disk_cachemodes }}
270+{% endif -%}
271+
272+{% include "parts/section-database" %}
273+
274+{% include "section-rabbitmq-oslo" %}
275+
276+[oslo_concurrency]
277+lock_path=/var/lock/nova
278
279=== modified file 'unit_tests/test_nova_compute_contexts.py'
280--- unit_tests/test_nova_compute_contexts.py 2015-11-10 13:39:24 +0000
281+++ unit_tests/test_nova_compute_contexts.py 2016-02-12 11:10:43 +0000
282@@ -274,3 +274,33 @@
283 metadatactxt = context.MetadataServiceContext()
284 self.assertEqual(metadatactxt(), {'metadata_shared_secret':
285 'shared_secret'})
286+
287+
288+class DesignateContextTests(CharmTestCase):
289+
290+ def setUp(self):
291+ super(DesignateContextTests, self).setUp(context, TO_PATCH)
292+ self.relation_get.side_effect = self.test_relation.get
293+ self.config.side_effect = self.test_config.get
294+ self.host_uuid = 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'
295+
296+ def test_designate_relation(self):
297+ self.test_relation.set({})
298+ designatectxt = context.DesignateContext()
299+ self.relation_ids.return_value = ['nova-designate:0']
300+ self.related_units.return_value = 'designate/0'
301+ self.assertEqual(designatectxt(), {
302+ 'enable_designate': True,
303+ 'notification_driver': 'messaging',
304+ 'notification_topics': 'notifications_designate',
305+ 'notify_on_state_change': 'vm_and_task_state',
306+ })
307+
308+ def test_no_designate_relation(self):
309+ self.test_relation.set({})
310+ designatectxt = context.DesignateContext()
311+ self.relation_ids.return_value = []
312+ self.related_units.return_value = None
313+ self.assertEqual(designatectxt(), {
314+ 'enable_designate': False,
315+ })

Subscribers

People subscribed via source and target branches