Merge lp:~freyes/charms/trusty/nova-cloud-controller/bug-989337 into lp:~openstack-charmers-archive/charms/trusty/nova-cloud-controller/next
- Trusty Tahr (14.04)
- bug-989337
- Merge into next
Status: | Superseded |
---|---|
Proposed branch: | lp:~freyes/charms/trusty/nova-cloud-controller/bug-989337 |
Merge into: | lp:~openstack-charmers-archive/charms/trusty/nova-cloud-controller/next |
Diff against target: |
345 lines (+133/-22) 10 files modified
hooks/nova_cc_context.py (+36/-17) hooks/nova_cc_hooks.py (+9/-0) hooks/nova_cc_utils.py (+3/-1) metadata.yaml (+2/-0) templates/folsom/nova.conf (+5/-0) templates/grizzly/nova.conf (+5/-0) templates/havana/nova.conf (+4/-0) templates/icehouse/nova.conf (+4/-0) unit_tests/test_nova_cc_contexts.py (+56/-0) unit_tests/test_nova_cc_utils.py (+9/-4) |
To merge this branch: | bzr merge lp:~freyes/charms/trusty/nova-cloud-controller/bug-989337 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Edward Hope-Morley | Needs Fixing | ||
OpenStack Charmers | Pending | ||
Review via email: mp+239671@code.launchpad.net |
This proposal has been superseded by a proposal from 2014-11-10.
Commit message
Description of the change
This branch extends the charm to install python-memcache, and configure nova.conf adding the key memcached_servers when a relationship with memcached service is established.
If multiple units of memcached are available, all of them are used (memcached_servers = host1:port1,
Ryan Beisner (1chb1n) wrote : | # |
Ryan Beisner (1chb1n) wrote : | # |
UOSCI bot says:
charm_unit_test #579 nova-cloud-
UNIT FAIL: unit-test failed
UNIT Results (max last 4 lines) from
/var/lib/
Ran 4 tests in 0.150s
FAILED (errors=2)
make: *** [unit_test] Error 1
Full unit output: http://
Build: http://
Ryan Beisner (1chb1n) wrote : | # |
UOSCI bot says:
charm_amulet_test #304 nova-cloud-
AMULET OK: believed to pass, but you should confirm results
AMULET Results (max last 4 lines) from
/var/lib/
juju-test.conductor DEBUG : Tearing down osci-sv05 juju environment
juju-test.conductor DEBUG : Calling "juju destroy-environment -y osci-sv05"
WARNING cannot delete security group "juju-osci-sv05-0". Used by another environment?
juju-test INFO : Results: 3 passed, 0 failed, 0 errored
Full amulet output: http://
Build: http://
Ryan Beisner (1chb1n) wrote : | # |
UOSCI bot says:
charm_unit_test #582 nova-cloud-
UNIT FAIL: unit-test failed
UNIT Results (max last 4 lines) from
/var/lib/
Ran 4 tests in 0.153s
FAILED (errors=2)
make: *** [unit_test] Error 1
Full unit output: http://
Build: http://
Ryan Beisner (1chb1n) wrote : | # |
UOSCI bot says:
charm_lint_check #774 nova-cloud-
LINT OK: believed to pass, but you should confirm results
LINT Results (max last 4 lines) from
/var/lib/
I: config.yaml: option haproxy-
I: config.yaml: option ssl_cert has no default value
I: config.yaml: option nvp-l3-uuid has no default value
I: config.yaml: option os-internal-network has no default value
Full lint output: http://
Build: http://
Ryan Beisner (1chb1n) wrote : | # |
UOSCI bot says:
charm_amulet_test #307 nova-cloud-
AMULET FAIL: amulet-test failed
AMULET Results (max last 4 lines) from
/var/lib/
return self.read(buflen)
File "/usr/lib/
return self._sslobj.
socket.error: [Errno 110] Connection timed out
Full amulet output: http://
Build: http://
Edward Hope-Morley (hopem) wrote : | # |
I'm getting a couple of unit test failures here. Looks like a couple of extra mocks needed - see attached u/t output.
Edward Hope-Morley (hopem) wrote : | # |
Hmm can't attach so pasting:
$ make unit_test
Starting unit tests...
nose.plugins.cover: ERROR: Coverage not available: unable to import coverage module
test_instance_
test_instance_
Failure: OSError ([Errno 2] No such file or directory) ... ERROR
Failure: OSError ([Errno 2] No such file or directory) ... ERROR
=======
ERROR: Failure: OSError ([Errno 2] No such file or directory)
-------
Traceback (most recent call last):
File "/usr/lib/
addr.filename, addr.module)
File "/usr/lib/
return self.importFrom
File "/usr/lib/
mod = load_module(
File "/home/
import nova_cc_utils as utils
File "hooks/
nova_
File "hooks/
self)
File "hooks/
res = func(*args, **kwargs)
File "hooks/
config_data = json.loads(
File "/usr/lib/
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/lib/
errread, errwrite)
File "/usr/lib/
raise child_exception
OSError: [Errno 2] No such file or directory
=======
ERROR: Failure: OSError ([Errno 2] No such file or directory)
-------
Traceback (most recent call last):
File "/usr/lib/
addr.filename, addr.module)
File "/usr/lib/
return self.importFrom
File "/usr/lib/
mod = load_module(
File "/home/
import nova_cc_utils as utils
File "hooks/
nova_
File "hooks/
self)
File "hooks/
res = func(*args, **kwa...
Edward Hope-Morley (hopem) wrote : | # |
FWIW, other than the above this lgtm
- 124. By Felipe Reyes
-
Changed the way charmhelpers.
core.hookenv. config is imported This change allows to easily monkey patch the function with a mock,
otherwise the 'config' function is left imported at the module level.
Felipe Reyes (freyes) wrote : | # |
Edward, I fixed the broken tests, the patch was a little bit larger than what I expected, but they are working OK now.
Name Stmts Miss Cover Missing
-------
hooks/nova_
hooks/nova_cc_hooks 447 146 67% 132-135, 148-149, 173, 184-185, 189, 224, 229-234, 245, 325-328, 336-339, 345-348, 358-374, 383-385, 395-409, 413-422, 508, 518, 522-523, 576, 582-592, 597-608, 618-628, 633-672, 682-697, 705-709, 734-743, 767, 772-780, 806, 861, 865-868
hooks/nova_cc_utils 442 111 75% 296-301, 312-315, 325-326, 382, 384, 428-430, 434, 448-456, 463-468, 472-486, 592-594, 599-602, 607, 611, 635-636, 650-652, 673-674, 680-703, 707-713, 717-723, 729, 735, 742, 753-757, 842, 902-908, 912-914, 918-921, 925-937
-------
TOTAL 1055 369 65%
-------
Ran 99 tests in 7.518s
Ryan Beisner (1chb1n) wrote : | # |
UOSCI bot says:
charm_lint_check #922 nova-cloud-
LINT OK: passed
LINT Results (max last 5 lines):
I: config.yaml: option os-admin-network has no default value
I: config.yaml: option haproxy-
I: config.yaml: option ssl_cert has no default value
I: config.yaml: option nvp-l3-uuid has no default value
I: config.yaml: option os-internal-network has no default value
Full lint test output: http://
Build: http://
Ryan Beisner (1chb1n) wrote : | # |
UOSCI bot says:
charm_unit_test #757 nova-cloud-
UNIT OK: passed
UNIT Results (max last 5 lines):
hooks/
hooks/
TOTAL 1055 369 65%
Ran 99 tests in 8.707s
OK
Full unit test output: http://
Build: http://
Ryan Beisner (1chb1n) wrote : | # |
UOSCI bot says:
charm_amulet_test #340 nova-cloud-
AMULET OK: passed
AMULET Results (max last 5 lines):
juju-
juju-
juju-
WARNING cannot delete security group "juju-osci-sv07-0". Used by another environment?
juju-test INFO : Results: 3 passed, 0 failed, 0 errored
Full amulet test output: http://
Build: http://
- 125. By Felipe Reyes
-
Revert "Changed the way charmhelpers.
core.hookenv. config is imported" - 126. By Felipe Reyes
-
Patch nova_cc_utils config() before it's imported by nova_cc_context
- 127. By Felipe Reyes
-
Format message, set proper level and include exception
- 128. By Felipe Reyes
-
Renamed relation from 'cache' to 'memcache'
- 129. By Felipe Reyes
-
Commit after merge
- 130. By Felipe Reyes
-
Commit after pulling changes from upstream
- 131. By Felipe Reyes
-
Added IPv6 support
Added test to check that IPv6 addresses are properly formatted.
- 132. By Felipe Reyes
-
Commit after merge
- 133. By Felipe Reyes
-
Replace "Couldn't get caching servers" with "Couldn't get memcache servers"
- 134. By Felipe Reyes
-
Refactor the way memcached_servers config is put in the templates
Instead of formatting the string with Jinja2, it's formatted with python
and passed to the template as a string.
Unmerged revisions
Preview Diff
1 | === added symlink 'hooks/cache-relation-broken' | |||
2 | === target is u'nova_cc_hooks.py' | |||
3 | === added symlink 'hooks/cache-relation-changed' | |||
4 | === target is u'nova_cc_hooks.py' | |||
5 | === added symlink 'hooks/cache-relation-departed' | |||
6 | === target is u'nova_cc_hooks.py' | |||
7 | === added symlink 'hooks/cache-relation-joined' | |||
8 | === target is u'nova_cc_hooks.py' | |||
9 | === modified file 'hooks/nova_cc_context.py' | |||
10 | --- hooks/nova_cc_context.py 2014-10-13 16:18:58 +0000 | |||
11 | +++ hooks/nova_cc_context.py 2014-11-04 18:12:57 +0000 | |||
12 | @@ -1,7 +1,7 @@ | |||
13 | 1 | from charmhelpers.core.hookenv import ( | 1 | from charmhelpers.core.hookenv import ( |
17 | 2 | config, relation_ids, relation_set, log, ERROR, | 2 | relation_ids, relation_set, log, ERROR, |
18 | 3 | unit_get, related_units, relation_get) | 3 | unit_get, related_units, relation_get, relations_for_id) |
19 | 4 | 4 | from charmhelpers.core import hookenv | |
20 | 5 | from charmhelpers.fetch import apt_install, filter_installed_packages | 5 | from charmhelpers.fetch import apt_install, filter_installed_packages |
21 | 6 | from charmhelpers.contrib.openstack import context, neutron, utils | 6 | from charmhelpers.contrib.openstack import context, neutron, utils |
22 | 7 | 7 | ||
23 | @@ -181,14 +181,14 @@ | |||
24 | 181 | if https(): | 181 | if https(): |
25 | 182 | scheme = 'https' | 182 | scheme = 'https' |
26 | 183 | 183 | ||
28 | 184 | if config('prefer-ipv6'): | 184 | if hookenv.config('prefer-ipv6'): |
29 | 185 | if is_clustered(): | 185 | if is_clustered(): |
31 | 186 | addr = '[%s]' % config(vip_setting) | 186 | addr = '[%s]' % hookenv.config(vip_setting) |
32 | 187 | else: | 187 | else: |
34 | 188 | addr = '[%s]' % get_ipv6_addr(exc_list=[config('vip')])[0] | 188 | addr = '[%s]' % get_ipv6_addr(exc_list=[hookenv.config('vip')])[0] |
35 | 189 | else: | 189 | else: |
36 | 190 | if is_clustered(): | 190 | if is_clustered(): |
38 | 191 | addr = config(vip_setting) | 191 | addr = hookenv.config(vip_setting) |
39 | 192 | else: | 192 | else: |
40 | 193 | addr = unit_get('private-address') | 193 | addr = unit_get('private-address') |
41 | 194 | 194 | ||
42 | @@ -209,8 +209,8 @@ | |||
43 | 209 | 209 | ||
44 | 210 | @property | 210 | @property |
45 | 211 | def neutron_security_groups(self): | 211 | def neutron_security_groups(self): |
48 | 212 | sec_groups = (config('neutron-security-groups') or | 212 | sec_groups = (hookenv.config('neutron-security-groups') or |
49 | 213 | config('quantum-security-groups')) | 213 | hookenv.config('quantum-security-groups')) |
50 | 214 | return sec_groups.lower() == 'yes' | 214 | return sec_groups.lower() == 'yes' |
51 | 215 | 215 | ||
52 | 216 | def _ensure_packages(self): | 216 | def _ensure_packages(self): |
53 | @@ -220,9 +220,9 @@ | |||
54 | 220 | 220 | ||
55 | 221 | def __call__(self): | 221 | def __call__(self): |
56 | 222 | ctxt = super(NeutronCCContext, self).__call__() | 222 | ctxt = super(NeutronCCContext, self).__call__() |
60 | 223 | ctxt['external_network'] = config('neutron-external-network') | 223 | ctxt['external_network'] = hookenv.config('neutron-external-network') |
61 | 224 | if config('quantum-plugin') in ['nvp', 'nsx']: | 224 | if hookenv.config('quantum-plugin') in ['nvp', 'nsx']: |
62 | 225 | _config = config() | 225 | _config = hookenv.config() |
63 | 226 | for k, v in _config.iteritems(): | 226 | for k, v in _config.iteritems(): |
64 | 227 | if k.startswith('nvp'): | 227 | if k.startswith('nvp'): |
65 | 228 | ctxt[k.replace('-', '_')] = v | 228 | ctxt[k.replace('-', '_')] = v |
66 | @@ -251,7 +251,7 @@ | |||
67 | 251 | ctxt['service_port'] | 251 | ctxt['service_port'] |
68 | 252 | ) | 252 | ) |
69 | 253 | ctxt['keystone_ec2_url'] = ec2_tokens | 253 | ctxt['keystone_ec2_url'] = ec2_tokens |
71 | 254 | ctxt['region'] = config('region') | 254 | ctxt['region'] = hookenv.config('region') |
72 | 255 | 255 | ||
73 | 256 | return ctxt | 256 | return ctxt |
74 | 257 | 257 | ||
75 | @@ -265,19 +265,38 @@ | |||
76 | 265 | 265 | ||
77 | 266 | def __init__(self): | 266 | def __init__(self): |
78 | 267 | super(NeutronPostgresqlDBContext, | 267 | super(NeutronPostgresqlDBContext, |
80 | 268 | self).__init__(config('neutron-database')) | 268 | self).__init__(hookenv.config('neutron-database')) |
81 | 269 | 269 | ||
82 | 270 | 270 | ||
83 | 271 | class NovaConfigContext(context.WorkerConfigContext): | 271 | class NovaConfigContext(context.WorkerConfigContext): |
84 | 272 | def __call__(self): | 272 | def __call__(self): |
85 | 273 | ctxt = super(NovaConfigContext, self).__call__() | 273 | ctxt = super(NovaConfigContext, self).__call__() |
88 | 274 | ctxt['cpu_allocation_ratio'] = config('cpu-allocation-ratio') | 274 | ctxt['cpu_allocation_ratio'] = hookenv.config('cpu-allocation-ratio') |
89 | 275 | ctxt['ram_allocation_ratio'] = config('ram-allocation-ratio') | 275 | ctxt['ram_allocation_ratio'] = hookenv.config('ram-allocation-ratio') |
90 | 276 | return ctxt | 276 | return ctxt |
91 | 277 | 277 | ||
92 | 278 | 278 | ||
93 | 279 | class NovaIPv6Context(context.BindHostContext): | 279 | class NovaIPv6Context(context.BindHostContext): |
94 | 280 | def __call__(self): | 280 | def __call__(self): |
95 | 281 | ctxt = super(NovaIPv6Context, self).__call__() | 281 | ctxt = super(NovaIPv6Context, self).__call__() |
97 | 282 | ctxt['use_ipv6'] = config('prefer-ipv6') | 282 | ctxt['use_ipv6'] = hookenv.config('prefer-ipv6') |
98 | 283 | return ctxt | ||
99 | 284 | |||
100 | 285 | |||
101 | 286 | class InstanceConsoleContext(context.OSContextGenerator): | ||
102 | 287 | interfaces = [] | ||
103 | 288 | |||
104 | 289 | def __call__(self): | ||
105 | 290 | ctxt = {} | ||
106 | 291 | servers = [] | ||
107 | 292 | try: | ||
108 | 293 | for rid in relation_ids('cache'): | ||
109 | 294 | for rel in relations_for_id(rid): | ||
110 | 295 | servers.append({'private-address': rel['private-address'], | ||
111 | 296 | 'port': rel['port']}) | ||
112 | 297 | except Exception as ex: | ||
113 | 298 | log(str(ex)) | ||
114 | 299 | servers = [] | ||
115 | 300 | |||
116 | 301 | ctxt['memcached_servers'] = servers | ||
117 | 283 | return ctxt | 302 | return ctxt |
118 | 284 | 303 | ||
119 | === modified file 'hooks/nova_cc_hooks.py' | |||
120 | --- hooks/nova_cc_hooks.py 2014-10-23 07:32:45 +0000 | |||
121 | +++ hooks/nova_cc_hooks.py 2014-11-04 18:12:57 +0000 | |||
122 | @@ -849,6 +849,15 @@ | |||
123 | 849 | quantum_joined(rid=rid) | 849 | quantum_joined(rid=rid) |
124 | 850 | 850 | ||
125 | 851 | 851 | ||
126 | 852 | @hooks.hook('cache-relation-joined', | ||
127 | 853 | 'cache-relation-departed', | ||
128 | 854 | 'cache-relation-changed', | ||
129 | 855 | 'cache-relation-broken') | ||
130 | 856 | @restart_on_change(restart_map()) | ||
131 | 857 | def memcached_joined(): | ||
132 | 858 | CONFIGS.write(NOVA_CONF) | ||
133 | 859 | |||
134 | 860 | |||
135 | 852 | def main(): | 861 | def main(): |
136 | 853 | try: | 862 | try: |
137 | 854 | hooks.execute(sys.argv) | 863 | hooks.execute(sys.argv) |
138 | 855 | 864 | ||
139 | === modified file 'hooks/nova_cc_utils.py' | |||
140 | --- hooks/nova_cc_utils.py 2014-10-23 16:39:43 +0000 | |||
141 | +++ hooks/nova_cc_utils.py 2014-11-04 18:12:57 +0000 | |||
142 | @@ -68,6 +68,7 @@ | |||
143 | 68 | 'python-psycopg2', | 68 | 'python-psycopg2', |
144 | 69 | 'python-psutil', | 69 | 'python-psutil', |
145 | 70 | 'uuid', | 70 | 'uuid', |
146 | 71 | 'python-memcache', | ||
147 | 71 | ] | 72 | ] |
148 | 72 | 73 | ||
149 | 73 | BASE_SERVICES = [ | 74 | BASE_SERVICES = [ |
150 | @@ -123,7 +124,8 @@ | |||
151 | 123 | nova_cc_context.VolumeServiceContext(), | 124 | nova_cc_context.VolumeServiceContext(), |
152 | 124 | nova_cc_context.NovaIPv6Context(), | 125 | nova_cc_context.NovaIPv6Context(), |
153 | 125 | nova_cc_context.NeutronCCContext(), | 126 | nova_cc_context.NeutronCCContext(), |
155 | 126 | nova_cc_context.NovaConfigContext()], | 127 | nova_cc_context.NovaConfigContext(), |
156 | 128 | nova_cc_context.InstanceConsoleContext()], | ||
157 | 127 | }), | 129 | }), |
158 | 128 | (NOVA_API_PASTE, { | 130 | (NOVA_API_PASTE, { |
159 | 129 | 'services': [s for s in BASE_SERVICES if 'api' in s], | 131 | 'services': [s for s in BASE_SERVICES if 'api' in s], |
160 | 130 | 132 | ||
161 | === modified file 'metadata.yaml' | |||
162 | --- metadata.yaml 2014-07-11 09:14:57 +0000 | |||
163 | +++ metadata.yaml 2014-11-04 18:12:57 +0000 | |||
164 | @@ -40,6 +40,8 @@ | |||
165 | 40 | nova-vmware: | 40 | nova-vmware: |
166 | 41 | interface: nova-vmware | 41 | interface: nova-vmware |
167 | 42 | scope: container | 42 | scope: container |
168 | 43 | cache: | ||
169 | 44 | interface: memcache | ||
170 | 43 | peers: | 45 | peers: |
171 | 44 | cluster: | 46 | cluster: |
172 | 45 | interface: nova-ha | 47 | interface: nova-ha |
173 | 46 | 48 | ||
174 | === modified file 'templates/folsom/nova.conf' | |||
175 | --- templates/folsom/nova.conf 2014-04-16 08:25:14 +0000 | |||
176 | +++ templates/folsom/nova.conf 2014-11-04 18:12:57 +0000 | |||
177 | @@ -21,6 +21,11 @@ | |||
178 | 21 | enabled_apis=ec2,osapi_compute,metadata | 21 | enabled_apis=ec2,osapi_compute,metadata |
179 | 22 | auth_strategy=keystone | 22 | auth_strategy=keystone |
180 | 23 | compute_driver=libvirt.LibvirtDriver | 23 | compute_driver=libvirt.LibvirtDriver |
181 | 24 | |||
182 | 25 | {% if memcached_servers %} | ||
183 | 26 | memcached_servers = {%for s in memcached_servers %}{% if loop.index0 != 0 %},{% endif %}{{s['private-address']}}:{{s['port']}}{% endfor %} | ||
184 | 27 | {% endif %} | ||
185 | 28 | |||
186 | 24 | {% if keystone_ec2_url -%} | 29 | {% if keystone_ec2_url -%} |
187 | 25 | keystone_ec2_url = {{ keystone_ec2_url }} | 30 | keystone_ec2_url = {{ keystone_ec2_url }} |
188 | 26 | {% endif -%} | 31 | {% endif -%} |
189 | 27 | 32 | ||
190 | === modified file 'templates/grizzly/nova.conf' | |||
191 | --- templates/grizzly/nova.conf 2014-03-31 11:56:09 +0000 | |||
192 | +++ templates/grizzly/nova.conf 2014-11-04 18:12:57 +0000 | |||
193 | @@ -20,6 +20,11 @@ | |||
194 | 20 | enabled_apis=ec2,osapi_compute,metadata | 20 | enabled_apis=ec2,osapi_compute,metadata |
195 | 21 | auth_strategy=keystone | 21 | auth_strategy=keystone |
196 | 22 | compute_driver=libvirt.LibvirtDriver | 22 | compute_driver=libvirt.LibvirtDriver |
197 | 23 | |||
198 | 24 | {% if memcached_servers %} | ||
199 | 25 | memcached_servers = {%for s in memcached_servers %}{% if loop.index0 != 0 %},{% endif %}{{s['private-address']}}:{{s['port']}}{% endfor %} | ||
200 | 26 | {% endif %} | ||
201 | 27 | |||
202 | 23 | {% if keystone_ec2_url -%} | 28 | {% if keystone_ec2_url -%} |
203 | 24 | keystone_ec2_url = {{ keystone_ec2_url }} | 29 | keystone_ec2_url = {{ keystone_ec2_url }} |
204 | 25 | {% endif -%} | 30 | {% endif -%} |
205 | 26 | 31 | ||
206 | === modified file 'templates/havana/nova.conf' | |||
207 | --- templates/havana/nova.conf 2014-08-08 09:31:32 +0000 | |||
208 | +++ templates/havana/nova.conf 2014-11-04 18:12:57 +0000 | |||
209 | @@ -26,6 +26,10 @@ | |||
210 | 26 | cpu_allocation_ratio = {{ cpu_allocation_ratio }} | 26 | cpu_allocation_ratio = {{ cpu_allocation_ratio }} |
211 | 27 | use_syslog={{ use_syslog }} | 27 | use_syslog={{ use_syslog }} |
212 | 28 | 28 | ||
213 | 29 | {% if memcached_servers %} | ||
214 | 30 | memcached_servers = {%for s in memcached_servers %}{% if loop.index0 != 0 %},{% endif %}{{s['private-address']}}:{{s['port']}}{% endfor %} | ||
215 | 31 | {% endif %} | ||
216 | 32 | |||
217 | 29 | {% if keystone_ec2_url -%} | 33 | {% if keystone_ec2_url -%} |
218 | 30 | keystone_ec2_url = {{ keystone_ec2_url }} | 34 | keystone_ec2_url = {{ keystone_ec2_url }} |
219 | 31 | {% endif -%} | 35 | {% endif -%} |
220 | 32 | 36 | ||
221 | === modified file 'templates/icehouse/nova.conf' | |||
222 | --- templates/icehouse/nova.conf 2014-10-07 11:37:20 +0000 | |||
223 | +++ templates/icehouse/nova.conf 2014-11-04 18:12:57 +0000 | |||
224 | @@ -38,6 +38,10 @@ | |||
225 | 38 | 38 | ||
226 | 39 | use_syslog={{ use_syslog }} | 39 | use_syslog={{ use_syslog }} |
227 | 40 | 40 | ||
228 | 41 | {% if memcached_servers %} | ||
229 | 42 | memcached_servers = {%for s in memcached_servers %}{% if loop.index0 != 0 %},{% endif %}{{s['private-address']}}:{{s['port']}}{% endfor %} | ||
230 | 43 | {% endif %} | ||
231 | 44 | |||
232 | 41 | {% if keystone_ec2_url -%} | 45 | {% if keystone_ec2_url -%} |
233 | 42 | keystone_ec2_url = {{ keystone_ec2_url }} | 46 | keystone_ec2_url = {{ keystone_ec2_url }} |
234 | 43 | {% endif -%} | 47 | {% endif -%} |
235 | 44 | 48 | ||
236 | === added file 'unit_tests/test_nova_cc_contexts.py' | |||
237 | --- unit_tests/test_nova_cc_contexts.py 1970-01-01 00:00:00 +0000 | |||
238 | +++ unit_tests/test_nova_cc_contexts.py 2014-11-04 18:12:57 +0000 | |||
239 | @@ -0,0 +1,56 @@ | |||
240 | 1 | from __future__ import print_function | ||
241 | 2 | |||
242 | 3 | import mock | ||
243 | 4 | import nova_cc_context as context | ||
244 | 5 | |||
245 | 6 | from charmhelpers.contrib.openstack import utils | ||
246 | 7 | |||
247 | 8 | from test_utils import CharmTestCase | ||
248 | 9 | |||
249 | 10 | |||
250 | 11 | TO_PATCH = [ | ||
251 | 12 | 'apt_install', | ||
252 | 13 | 'filter_installed_packages', | ||
253 | 14 | 'relation_ids', | ||
254 | 15 | 'relation_get', | ||
255 | 16 | 'related_units', | ||
256 | 17 | 'log', | ||
257 | 18 | 'unit_get', | ||
258 | 19 | 'relations_for_id', | ||
259 | 20 | ] | ||
260 | 21 | |||
261 | 22 | |||
262 | 23 | def fake_log(msg, level=None): | ||
263 | 24 | level = level or 'INFO' | ||
264 | 25 | print('[juju test log (%s)] %s' % (level, msg)) | ||
265 | 26 | |||
266 | 27 | |||
267 | 28 | class NovaComputeContextTests(CharmTestCase): | ||
268 | 29 | def setUp(self): | ||
269 | 30 | super(NovaComputeContextTests, self).setUp(context, TO_PATCH) | ||
270 | 31 | self.relation_get.side_effect = self.test_relation.get | ||
271 | 32 | self.log.side_effect = fake_log | ||
272 | 33 | |||
273 | 34 | @mock.patch.object(utils, 'os_release') | ||
274 | 35 | def test_instance_console_context_without_memcache(self, os_release): | ||
275 | 36 | self.unit_get.return_value = '127.0.0.1' | ||
276 | 37 | self.relation_ids.return_value = 'cache:0' | ||
277 | 38 | self.related_units.return_value = 'memcached/0' | ||
278 | 39 | instance_console = context.InstanceConsoleContext() | ||
279 | 40 | os_release.return_value = 'icehouse' | ||
280 | 41 | self.assertEqual({'memcached_servers': []}, | ||
281 | 42 | instance_console()) | ||
282 | 43 | |||
283 | 44 | @mock.patch.object(utils, 'os_release') | ||
284 | 45 | def test_instance_console_context_with_memcache(self, os_release): | ||
285 | 46 | memcached_servers = [{'private-address': '127.0.1.1', | ||
286 | 47 | 'port': '11211'}] | ||
287 | 48 | self.unit_get.return_value = '127.0.0.1' | ||
288 | 49 | self.relation_ids.return_value = ['cache:0'] | ||
289 | 50 | self.relations_for_id.return_value = memcached_servers | ||
290 | 51 | self.related_units.return_value = 'memcached/0' | ||
291 | 52 | instance_console = context.InstanceConsoleContext() | ||
292 | 53 | os_release.return_value = 'icehouse' | ||
293 | 54 | self.maxDiff = None | ||
294 | 55 | self.assertEqual({'memcached_servers': memcached_servers}, | ||
295 | 56 | instance_console()) | ||
296 | 0 | 57 | ||
297 | === modified file 'unit_tests/test_nova_cc_utils.py' | |||
298 | --- unit_tests/test_nova_cc_utils.py 2014-10-23 16:39:43 +0000 | |||
299 | +++ unit_tests/test_nova_cc_utils.py 2014-11-04 18:12:57 +0000 | |||
300 | @@ -155,8 +155,9 @@ | |||
301 | 155 | _map = utils.resource_map() | 155 | _map = utils.resource_map() |
302 | 156 | return _map | 156 | return _map |
303 | 157 | 157 | ||
304 | 158 | @patch('charmhelpers.core.hookenv.config') | ||
305 | 158 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') | 159 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') |
307 | 159 | def test_resource_map_quantum(self, subcontext): | 160 | def test_resource_map_quantum(self, subcontext, config_): |
308 | 160 | self.is_relation_made.return_value = False | 161 | self.is_relation_made.return_value = False |
309 | 161 | self._resource_map(network_manager='quantum') | 162 | self._resource_map(network_manager='quantum') |
310 | 162 | _map = utils.resource_map() | 163 | _map = utils.resource_map() |
311 | @@ -167,8 +168,9 @@ | |||
312 | 167 | ] | 168 | ] |
313 | 168 | [self.assertIn(q_conf, _map.keys()) for q_conf in confs] | 169 | [self.assertIn(q_conf, _map.keys()) for q_conf in confs] |
314 | 169 | 170 | ||
315 | 171 | @patch('charmhelpers.core.hookenv.config') | ||
316 | 170 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') | 172 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') |
318 | 171 | def test_resource_map_neutron(self, subcontext): | 173 | def test_resource_map_neutron(self, subcontext, config_): |
319 | 172 | self.is_relation_made.return_value = False | 174 | self.is_relation_made.return_value = False |
320 | 173 | self._resource_map(network_manager='neutron') | 175 | self._resource_map(network_manager='neutron') |
321 | 174 | _map = utils.resource_map() | 176 | _map = utils.resource_map() |
322 | @@ -259,9 +261,11 @@ | |||
323 | 259 | for service in console_services: | 261 | for service in console_services: |
324 | 260 | self.assertIn(service, _map['/etc/nova/nova.conf']['services']) | 262 | self.assertIn(service, _map['/etc/nova/nova.conf']['services']) |
325 | 261 | 263 | ||
326 | 264 | @patch('charmhelpers.core.hookenv.config') | ||
327 | 262 | @patch('os.path.exists') | 265 | @patch('os.path.exists') |
328 | 263 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') | 266 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') |
330 | 264 | def test_restart_map_api_before_frontends(self, subcontext, _exists): | 267 | def test_restart_map_api_before_frontends(self, subcontext, _exists, |
331 | 268 | config_): | ||
332 | 265 | self.is_relation_made.return_value = False | 269 | self.is_relation_made.return_value = False |
333 | 266 | _exists.return_value = False | 270 | _exists.return_value = False |
334 | 267 | self._resource_map(network_manager='neutron') | 271 | self._resource_map(network_manager='neutron') |
335 | @@ -303,8 +307,9 @@ | |||
336 | 303 | pkgs = utils.determine_packages() | 307 | pkgs = utils.determine_packages() |
337 | 304 | self.assertIn('quantum-server', pkgs) | 308 | self.assertIn('quantum-server', pkgs) |
338 | 305 | 309 | ||
339 | 310 | @patch('charmhelpers.core.hookenv.config') | ||
340 | 306 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') | 311 | @patch('charmhelpers.contrib.openstack.context.SubordinateConfigContext') |
342 | 307 | def test_determine_packages_neutron(self, subcontext): | 312 | def test_determine_packages_neutron(self, subcontext, config_): |
343 | 308 | self.is_relation_made.return_value = False | 313 | self.is_relation_made.return_value = False |
344 | 309 | self._resource_map(network_manager='neutron') | 314 | self._resource_map(network_manager='neutron') |
345 | 310 | pkgs = utils.determine_packages() | 315 | pkgs = utils.determine_packages() |
UOSCI bot says: controller- next for freyes mp239671
charm_lint_check #771 nova-cloud-
LINT OK: believed to pass, but you should confirm results
LINT Results (max last 4 lines) from jenkins/ workspace/ charm_lint_ check/make- lint.771: client- timeout has no default value
/var/lib/
I: config.yaml: option haproxy-
I: config.yaml: option ssl_cert has no default value
I: config.yaml: option nvp-l3-uuid has no default value
I: config.yaml: option os-internal-network has no default value
Full lint output: http:// paste.ubuntu. com/8694351/ 10.98.191. 181:8080/ job/charm_ lint_check/ 771/
Build: http://