Merge lp:~hopem/charms/precise/quantum-gateway/lp1273067 into lp:charms/quantum-gateway

Proposed by Edward Hope-Morley
Status: Merged
Merged at revision: 46
Proposed branch: lp:~hopem/charms/precise/quantum-gateway/lp1273067
Merge into: lp:charms/quantum-gateway
Diff against target: 412 lines (+134/-32)
15 files modified
config.yaml (+5/-0)
hooks/charmhelpers/contrib/openstack/context.py (+9/-6)
hooks/charmhelpers/contrib/openstack/neutron.py (+28/-4)
hooks/charmhelpers/contrib/openstack/utils.py (+16/-13)
hooks/charmhelpers/contrib/storage/linux/utils.py (+2/-1)
hooks/charmhelpers/fetch/__init__.py (+23/-0)
hooks/charmhelpers/fetch/archiveurl.py (+15/-0)
hooks/quantum_utils.py (+9/-3)
revision (+1/-1)
templates/folsom/metadata_agent.ini (+1/-1)
templates/folsom/nova.conf (+1/-0)
templates/folsom/quantum.conf (+1/-0)
templates/havana/neutron.conf (+1/-0)
templates/havana/nova.conf (+1/-0)
unit_tests/test_quantum_contexts.py (+21/-3)
To merge this branch: bzr merge lp:~hopem/charms/precise/quantum-gateway/lp1273067
Reviewer Review Type Date Requested Status
Edward Hope-Morley Approve
Review via email: mp+212717@code.launchpad.net

Description of the change

The is part of a resubmit for all the charm use-syslog patches since the previous attempts were getting messy

To post a comment you must log in.
48. By Edward Hope-Morley

[hopem] removed extraneous use_syslog from .ini files since neutron.conf & quantum.conf should suffice

Revision history for this message
Edward Hope-Morley (hopem) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'config.yaml'
--- config.yaml 2014-03-14 13:16:57 +0000
+++ config.yaml 2014-03-26 11:07:00 +0000
@@ -50,6 +50,11 @@
50 type: string50 type: string
51 description: RabbitMQ Virtual Host51 description: RabbitMQ Virtual Host
52 default: openstack52 default: openstack
53 use-syslog:
54 type: boolean
55 default: False
56 description: |
57 If set to True, supporting services will log to syslog.
53 instance-mtu:58 instance-mtu:
54 type: int59 type: int
55 description: |60 description: |
5661
=== modified file 'hooks/charmhelpers/contrib/openstack/context.py'
--- hooks/charmhelpers/contrib/openstack/context.py 2014-03-14 13:24:39 +0000
+++ hooks/charmhelpers/contrib/openstack/context.py 2014-03-26 11:07:00 +0000
@@ -199,6 +199,7 @@
199199
200 ctxt = {}200 ctxt = {}
201 for rid in relation_ids('amqp'):201 for rid in relation_ids('amqp'):
202 ha_vip_only = False
202 for unit in related_units(rid):203 for unit in related_units(rid):
203 if relation_get('clustered', rid=rid, unit=unit):204 if relation_get('clustered', rid=rid, unit=unit):
204 ctxt['clustered'] = True205 ctxt['clustered'] = True
@@ -213,16 +214,18 @@
213 unit=unit),214 unit=unit),
214 'rabbitmq_virtual_host': vhost,215 'rabbitmq_virtual_host': vhost,
215 })216 })
217 if relation_get('ha_queues', rid=rid, unit=unit) is not None:
218 ctxt['rabbitmq_ha_queues'] = True
219
220 ha_vip_only = relation_get('ha-vip-only',
221 rid=rid, unit=unit) is not None
222
216 if context_complete(ctxt):223 if context_complete(ctxt):
217 # Sufficient information found = break out!224 # Sufficient information found = break out!
218 break225 break
219 # Used for active/active rabbitmq >= grizzly226 # Used for active/active rabbitmq >= grizzly
220 if ('clustered' not in ctxt or relation_get('ha-vip-only') == 'True') and \227 if ('clustered' not in ctxt or ha_vip_only) \
221 len(related_units(rid)) > 1:228 and len(related_units(rid)) > 1:
222 if relation_get('ha_queues'):
223 ctxt['rabbitmq_ha_queues'] = relation_get('ha_queues')
224 else:
225 ctxt['rabbitmq_ha_queues'] = False
226 rabbitmq_hosts = []229 rabbitmq_hosts = []
227 for unit in related_units(rid):230 for unit in related_units(rid):
228 rabbitmq_hosts.append(relation_get('private-address',231 rabbitmq_hosts.append(relation_get('private-address',
229232
=== modified file 'hooks/charmhelpers/contrib/openstack/neutron.py'
--- hooks/charmhelpers/contrib/openstack/neutron.py 2013-11-06 03:57:51 +0000
+++ hooks/charmhelpers/contrib/openstack/neutron.py 2014-03-26 11:07:00 +0000
@@ -18,6 +18,22 @@
18 return 'linux-headers-%s' % kver18 return 'linux-headers-%s' % kver
1919
2020
21def kernel_version():
22 """ Retrieve the current major kernel version as a tuple e.g. (3, 13) """
23 kver = check_output(['uname', '-r']).strip()
24 kver = kver.split('.')
25 return (int(kver[0]), int(kver[1]))
26
27
28def determine_dkms_package():
29 """ Determine which DKMS package should be used based on kernel version """
30 # NOTE: 3.13 kernels have support for GRE and VXLAN native
31 if kernel_version() >= (3, 13):
32 return []
33 else:
34 return ['openvswitch-datapath-dkms']
35
36
21# legacy37# legacy
22def quantum_plugins():38def quantum_plugins():
23 from charmhelpers.contrib.openstack import context39 from charmhelpers.contrib.openstack import context
@@ -32,7 +48,7 @@
32 database=config('neutron-database'),48 database=config('neutron-database'),
33 relation_prefix='neutron')],49 relation_prefix='neutron')],
34 'services': ['quantum-plugin-openvswitch-agent'],50 'services': ['quantum-plugin-openvswitch-agent'],
35 'packages': [[headers_package(), 'openvswitch-datapath-dkms'],51 'packages': [[headers_package()] + determine_dkms_package(),
36 ['quantum-plugin-openvswitch-agent']],52 ['quantum-plugin-openvswitch-agent']],
37 'server_packages': ['quantum-server',53 'server_packages': ['quantum-server',
38 'quantum-plugin-openvswitch'],54 'quantum-plugin-openvswitch'],
@@ -57,7 +73,8 @@
5773
58def neutron_plugins():74def neutron_plugins():
59 from charmhelpers.contrib.openstack import context75 from charmhelpers.contrib.openstack import context
60 return {76 release = os_release('nova-common')
77 plugins = {
61 'ovs': {78 'ovs': {
62 'config': '/etc/neutron/plugins/openvswitch/'79 'config': '/etc/neutron/plugins/openvswitch/'
63 'ovs_neutron_plugin.ini',80 'ovs_neutron_plugin.ini',
@@ -68,8 +85,8 @@
68 database=config('neutron-database'),85 database=config('neutron-database'),
69 relation_prefix='neutron')],86 relation_prefix='neutron')],
70 'services': ['neutron-plugin-openvswitch-agent'],87 'services': ['neutron-plugin-openvswitch-agent'],
71 'packages': [[headers_package(), 'openvswitch-datapath-dkms'],88 'packages': [[headers_package()] + determine_dkms_package(),
72 ['quantum-plugin-openvswitch-agent']],89 ['neutron-plugin-openvswitch-agent']],
73 'server_packages': ['neutron-server',90 'server_packages': ['neutron-server',
74 'neutron-plugin-openvswitch'],91 'neutron-plugin-openvswitch'],
75 'server_services': ['neutron-server']92 'server_services': ['neutron-server']
@@ -89,6 +106,13 @@
89 'server_services': ['neutron-server']106 'server_services': ['neutron-server']
90 }107 }
91 }108 }
109 # NOTE: patch in ml2 plugin for icehouse onwards
110 if release >= 'icehouse':
111 plugins['ovs']['config'] = '/etc/neutron/plugins/ml2/ml2_conf.ini'
112 plugins['ovs']['driver'] = 'neutron.plugins.ml2.plugin.Ml2Plugin'
113 plugins['ovs']['server_packages'] = ['neutron-server',
114 'neutron-plugin-ml2']
115 return plugins
92116
93117
94def neutron_plugin_attribute(plugin, attr, net_manager=None):118def neutron_plugin_attribute(plugin, attr, net_manager=None):
95119
=== modified file 'hooks/charmhelpers/contrib/openstack/utils.py'
--- hooks/charmhelpers/contrib/openstack/utils.py 2014-03-14 13:24:39 +0000
+++ hooks/charmhelpers/contrib/openstack/utils.py 2014-03-26 11:07:00 +0000
@@ -65,6 +65,9 @@
65 ('1.10.0', 'havana'),65 ('1.10.0', 'havana'),
66 ('1.9.1', 'havana'),66 ('1.9.1', 'havana'),
67 ('1.9.0', 'havana'),67 ('1.9.0', 'havana'),
68 ('1.13.0', 'icehouse'),
69 ('1.12.0', 'icehouse'),
70 ('1.11.0', 'icehouse'),
68])71])
6972
70DEFAULT_LOOPBACK_SIZE = '5G'73DEFAULT_LOOPBACK_SIZE = '5G'
@@ -420,19 +423,19 @@
420 Resolves hostname for given IP, or returns the input423 Resolves hostname for given IP, or returns the input
421 if it is already a hostname.424 if it is already a hostname.
422 """425 """
423 if not is_ip(address):426 if is_ip(address):
424 return address427 try:
425428 import dns.reversename
426 try:429 except ImportError:
427 import dns.reversename430 apt_install('python-dnspython')
428 except ImportError:431 import dns.reversename
429 apt_install('python-dnspython')432
430 import dns.reversename433 rev = dns.reversename.from_address(address)
431434 result = ns_query(rev)
432 rev = dns.reversename.from_address(address)435 if not result:
433 result = ns_query(rev)436 return None
434 if not result:437 else:
435 return None438 result = address
436439
437 if fqdn:440 if fqdn:
438 # strip trailing .441 # strip trailing .
439442
=== modified file 'hooks/charmhelpers/contrib/storage/linux/utils.py'
--- hooks/charmhelpers/contrib/storage/linux/utils.py 2014-03-14 13:24:39 +0000
+++ hooks/charmhelpers/contrib/storage/linux/utils.py 2014-03-26 11:07:00 +0000
@@ -22,4 +22,5 @@
2222
23 :param block_device: str: Full path of block device to clean.23 :param block_device: str: Full path of block device to clean.
24 '''24 '''
25 check_call(['sgdisk', '--zap-all', '--mbrtogpt', block_device])25 check_call(['sgdisk', '--zap-all', '--clear',
26 '--mbrtogpt', block_device])
2627
=== modified file 'hooks/charmhelpers/fetch/__init__.py'
--- hooks/charmhelpers/fetch/__init__.py 2014-03-14 13:24:39 +0000
+++ hooks/charmhelpers/fetch/__init__.py 2014-03-26 11:07:00 +0000
@@ -97,6 +97,29 @@
97 subprocess.call(cmd, env=env)97 subprocess.call(cmd, env=env)
9898
9999
100def apt_upgrade(options=None, fatal=False, dist=False):
101 """Upgrade all packages"""
102 if options is None:
103 options = ['--option=Dpkg::Options::=--force-confold']
104
105 cmd = ['apt-get', '--assume-yes']
106 cmd.extend(options)
107 if dist:
108 cmd.append('dist-upgrade')
109 else:
110 cmd.append('upgrade')
111 log("Upgrading with options: {}".format(options))
112
113 env = os.environ.copy()
114 if 'DEBIAN_FRONTEND' not in env:
115 env['DEBIAN_FRONTEND'] = 'noninteractive'
116
117 if fatal:
118 subprocess.check_call(cmd, env=env)
119 else:
120 subprocess.call(cmd, env=env)
121
122
100def apt_update(fatal=False):123def apt_update(fatal=False):
101 """Update local apt cache"""124 """Update local apt cache"""
102 cmd = ['apt-get', 'update']125 cmd = ['apt-get', 'update']
103126
=== modified file 'hooks/charmhelpers/fetch/archiveurl.py'
--- hooks/charmhelpers/fetch/archiveurl.py 2013-09-02 16:36:50 +0000
+++ hooks/charmhelpers/fetch/archiveurl.py 2014-03-26 11:07:00 +0000
@@ -1,5 +1,7 @@
1import os1import os
2import urllib22import urllib2
3import urlparse
4
3from charmhelpers.fetch import (5from charmhelpers.fetch import (
4 BaseFetchHandler,6 BaseFetchHandler,
5 UnhandledSource7 UnhandledSource
@@ -24,6 +26,19 @@
24 def download(self, source, dest):26 def download(self, source, dest):
25 # propogate all exceptions27 # propogate all exceptions
26 # URLError, OSError, etc28 # URLError, OSError, etc
29 proto, netloc, path, params, query, fragment = urlparse.urlparse(source)
30 if proto in ('http', 'https'):
31 auth, barehost = urllib2.splituser(netloc)
32 if auth is not None:
33 source = urlparse.urlunparse((proto, barehost, path, params, query, fragment))
34 username, password = urllib2.splitpasswd(auth)
35 passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
36 # Realm is set to None in add_password to force the username and password
37 # to be used whatever the realm
38 passman.add_password(None, source, username, password)
39 authhandler = urllib2.HTTPBasicAuthHandler(passman)
40 opener = urllib2.build_opener(authhandler)
41 urllib2.install_opener(opener)
27 response = urllib2.urlopen(source)42 response = urllib2.urlopen(source)
28 try:43 try:
29 with open(dest, 'w') as dest_file:44 with open(dest, 'w') as dest_file:
3045
=== modified file 'hooks/quantum_utils.py'
--- hooks/quantum_utils.py 2014-03-14 13:24:39 +0000
+++ hooks/quantum_utils.py 2014-03-26 11:07:00 +0000
@@ -25,6 +25,9 @@
25)25)
2626
27import charmhelpers.contrib.openstack.context as context27import charmhelpers.contrib.openstack.context as context
28from charmhelpers.contrib.openstack.context import (
29 SyslogContext
30)
28import charmhelpers.contrib.openstack.templating as templating31import charmhelpers.contrib.openstack.templating as templating
29from charmhelpers.contrib.openstack.neutron import headers_package32from charmhelpers.contrib.openstack.neutron import headers_package
30from quantum_contexts import (33from quantum_contexts import (
@@ -150,7 +153,8 @@
150 'hook_contexts': [context.AMQPContext(),153 'hook_contexts': [context.AMQPContext(),
151 QuantumSharedDBContext(),154 QuantumSharedDBContext(),
152 NetworkServiceContext(),155 NetworkServiceContext(),
153 QuantumGatewayContext()],156 QuantumGatewayContext(),
157 SyslogContext()],
154 'services': ['nova-api-metadata']158 'services': ['nova-api-metadata']
155 },159 },
156}160}
@@ -188,7 +192,8 @@
188QUANTUM_OVS_CONFIG_FILES = {192QUANTUM_OVS_CONFIG_FILES = {
189 QUANTUM_CONF: {193 QUANTUM_CONF: {
190 'hook_contexts': [context.AMQPContext(),194 'hook_contexts': [context.AMQPContext(),
191 QuantumGatewayContext()],195 QuantumGatewayContext(),
196 SyslogContext()],
192 'services': ['quantum-l3-agent',197 'services': ['quantum-l3-agent',
193 'quantum-dhcp-agent',198 'quantum-dhcp-agent',
194 'quantum-metadata-agent',199 'quantum-metadata-agent',
@@ -214,7 +219,8 @@
214NEUTRON_OVS_CONFIG_FILES = {219NEUTRON_OVS_CONFIG_FILES = {
215 NEUTRON_CONF: {220 NEUTRON_CONF: {
216 'hook_contexts': [context.AMQPContext(),221 'hook_contexts': [context.AMQPContext(),
217 QuantumGatewayContext()],222 QuantumGatewayContext(),
223 SyslogContext()],
218 'services': ['neutron-l3-agent',224 'services': ['neutron-l3-agent',
219 'neutron-dhcp-agent',225 'neutron-dhcp-agent',
220 'neutron-metadata-agent',226 'neutron-metadata-agent',
221227
=== modified file 'revision'
--- revision 2014-03-14 13:24:39 +0000
+++ revision 2014-03-26 11:07:00 +0000
@@ -1,1 +1,1 @@
163164
2\ No newline at end of file2\ No newline at end of file
33
=== modified file 'templates/folsom/metadata_agent.ini'
--- templates/folsom/metadata_agent.ini 2013-09-04 09:46:54 +0000
+++ templates/folsom/metadata_agent.ini 2014-03-26 11:07:00 +0000
@@ -14,4 +14,4 @@
14# shared secret to prevent spoofing. You may select any string for a secret,14# shared secret to prevent spoofing. You may select any string for a secret,
15# but it must match here and in the configuration used by the Nova Metadata15# but it must match here and in the configuration used by the Nova Metadata
16# Server. NOTE: Nova uses a different key: quantum_metadata_proxy_shared_secret16# Server. NOTE: Nova uses a different key: quantum_metadata_proxy_shared_secret
17metadata_proxy_shared_secret = {{ shared_secret }}17metadata_proxy_shared_secret = {{ shared_secret }}
18\ No newline at end of file18\ No newline at end of file
1919
=== modified file 'templates/folsom/nova.conf'
--- templates/folsom/nova.conf 2013-09-04 09:46:54 +0000
+++ templates/folsom/nova.conf 2014-03-26 11:07:00 +0000
@@ -4,6 +4,7 @@
4lock_path=/var/lock/nova4lock_path=/var/lock/nova
5root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf5root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
6verbose=True6verbose=True
7use_syslog = {{ use_syslog }}
7api_paste_config=/etc/nova/api-paste.ini8api_paste_config=/etc/nova/api-paste.ini
8enabled_apis=metadata9enabled_apis=metadata
9multi_host=True10multi_host=True
1011
=== modified file 'templates/folsom/quantum.conf'
--- templates/folsom/quantum.conf 2013-09-04 09:46:54 +0000
+++ templates/folsom/quantum.conf 2014-03-26 11:07:00 +0000
@@ -5,6 +5,7 @@
5rabbit_host = {{ rabbitmq_host }}5rabbit_host = {{ rabbitmq_host }}
6rabbit_password = {{ rabbitmq_password }}6rabbit_password = {{ rabbitmq_password }}
7debug = True7debug = True
8use_syslog = {{ use_syslog }}
8bind_host = 0.0.0.09bind_host = 0.0.0.0
9bind_port = 969610bind_port = 9696
10core_plugin = {{ core_plugin }} 11core_plugin = {{ core_plugin }}
1112
=== modified file 'templates/havana/neutron.conf'
--- templates/havana/neutron.conf 2013-09-04 09:46:54 +0000
+++ templates/havana/neutron.conf 2014-03-26 11:07:00 +0000
@@ -5,6 +5,7 @@
5rabbit_host = {{ rabbitmq_host }}5rabbit_host = {{ rabbitmq_host }}
6rabbit_password = {{ rabbitmq_password }}6rabbit_password = {{ rabbitmq_password }}
7debug = True7debug = True
8use_syslog = {{ use_syslog }}
8bind_host = 0.0.0.09bind_host = 0.0.0.0
9bind_port = 969610bind_port = 9696
10core_plugin = {{ core_plugin }} 11core_plugin = {{ core_plugin }}
1112
=== modified file 'templates/havana/nova.conf'
--- templates/havana/nova.conf 2013-09-04 09:46:54 +0000
+++ templates/havana/nova.conf 2014-03-26 11:07:00 +0000
@@ -4,6 +4,7 @@
4lock_path=/var/lock/nova4lock_path=/var/lock/nova
5root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf5root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
6verbose=True6verbose=True
7use_syslog = {{ use_syslog }}
7api_paste_config=/etc/nova/api-paste.ini8api_paste_config=/etc/nova/api-paste.ini
8enabled_apis=metadata9enabled_apis=metadata
9multi_host=True10multi_host=True
1011
=== modified file 'unit_tests/test_quantum_contexts.py'
--- unit_tests/test_quantum_contexts.py 2014-03-14 13:24:39 +0000
+++ unit_tests/test_quantum_contexts.py 2014-03-26 11:07:00 +0000
@@ -1,5 +1,10 @@
1from mock import MagicMock, patch1from mock import (
2 Mock,
3 MagicMock,
4 patch
5)
2import quantum_contexts6import quantum_contexts
7import sys
3from contextlib import contextmanager8from contextlib import contextmanager
49
5from test_utils import (10from test_utils import (
@@ -199,6 +204,7 @@
199 def setUp(self):204 def setUp(self):
200 super(TestQuantumGatewayContext, self).setUp(quantum_contexts,205 super(TestQuantumGatewayContext, self).setUp(quantum_contexts,
201 TO_PATCH)206 TO_PATCH)
207 self.config.side_effect = self.test_config.get
202208
203 @patch.object(quantum_contexts, 'get_shared_secret')209 @patch.object(quantum_contexts, 'get_shared_secret')
204 @patch.object(quantum_contexts, 'get_host_ip')210 @patch.object(quantum_contexts, 'get_host_ip')
@@ -256,6 +262,19 @@
256 super(TestHostIP, self).setUp(quantum_contexts,262 super(TestHostIP, self).setUp(quantum_contexts,
257 TO_PATCH)263 TO_PATCH)
258 self.config.side_effect = self.test_config.get264 self.config.side_effect = self.test_config.get
265 # Save and inject
266 self.mods = {'dns': None, 'dns.resolver': None}
267 for mod in self.mods:
268 if mod not in sys.modules:
269 sys.modules[mod] = Mock()
270 else:
271 del self.mods[mod]
272
273 def tearDown(self):
274 super(TestHostIP, self).tearDown()
275 # Cleanup
276 for mod in self.mods.keys():
277 del sys.modules[mod]
259278
260 def test_get_host_ip_already_ip(self):279 def test_get_host_ip_already_ip(self):
261 self.assertEquals(quantum_contexts.get_host_ip('10.5.0.1'),280 self.assertEquals(quantum_contexts.get_host_ip('10.5.0.1'),
@@ -268,8 +287,7 @@
268287
269 @patch('dns.resolver.query')288 @patch('dns.resolver.query')
270 def test_get_host_ip_hostname_unresolvable(self, _query):289 def test_get_host_ip_hostname_unresolvable(self, _query):
271 class NXDOMAIN(Exception):290 class NXDOMAIN(Exception): pass
272 pass
273 _query.side_effect = NXDOMAIN()291 _query.side_effect = NXDOMAIN()
274 self.assertRaises(NXDOMAIN, quantum_contexts.get_host_ip,292 self.assertRaises(NXDOMAIN, quantum_contexts.get_host_ip,
275 'missing.example.com')293 'missing.example.com')

Subscribers

People subscribed via source and target branches