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: |
267 lines (+144/-1) 10 files modified
hooks/nova_cc_context.py (+24/-0) 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 (+87/-0) unit_tests/test_nova_cc_hooks.py (+1/-0) |
To merge this branch: | bzr merge lp:~freyes/charms/trusty/nova-cloud-controller/bug-989337 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenStack Charmers | Pending | ||
Jorge Niedbalski | Pending | ||
Edward Hope-Morley | Pending | ||
James Troup | Pending | ||
Review via email: mp+244432@code.launchpad.net |
This proposal supersedes a proposal from 2014-11-26.
This proposal has been superseded by a proposal from 2014-12-15.
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,
To secure memcached access this relies in the memcached charm ability to use iptables rules to only allow access to related machines[0]
This patch can be tested using the deployer file available at https:/
[0] http://
Ryan Beisner (1chb1n) wrote : Posted in a previous version of this proposal | # |
Ryan Beisner (1chb1n) wrote : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
FWIW, other than the above this lgtm
Felipe Reyes (freyes) wrote : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
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 : Posted in a previous version of this proposal | # |
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://
Ryan Beisner (1chb1n) wrote : Posted in a previous version of this proposal | # |
UOSCI bot says:
charm_lint_check #979 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 : Posted in a previous version of this proposal | # |
UOSCI bot says:
charm_unit_test #814 nova-cloud-
UNIT OK: passed
UNIT Results (max last 5 lines):
hooks/
hooks/
TOTAL 1055 369 65%
Ran 99 tests in 8.712s
OK
Full unit test output: http://
Build: http://
Ryan Beisner (1chb1n) wrote : Posted in a previous version of this proposal | # |
UOSCI bot says:
charm_amulet_test #359 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://
Edward Hope-Morley (hopem) wrote : Posted in a previous version of this proposal | # |
Felipe, thanks for working on this it is much needed.
So some initial comments;
* could you please rename the cache-relation-* to memcache-relation-*
* is there are reason for replacing config() with hookenv.config()? I know it is not the nicest coding style but it is the same across all charms so to do it differently here would be breaking convention.
* some more comments inline
Felipe Reyes (freyes) wrote : Posted in a previous version of this proposal | # |
Hi,
> * could you please rename the cache-relation-* to memcache-relation-*
I initially used memcache-relation-* hooks, but they weren't triggered, a quick look to mediawiki charm also uses cache-relation-* for memcache, I'll give it another try to double check this.
> * is there are reason for replacing config() with hookenv.config()? I know
> it is not the nicest coding style but it is the same across all charms so to
> do it differently here would be breaking convention.
I know, but importing config() function made fail the mocking due to the way the modules are imported, if this is a blocker I totally understand and I can revisit this to find a way to make the tests happy.
Best,
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
UOSCI bot says:
charm_lint_check #1151 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://
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
UOSCI bot says:
charm_unit_test #985 nova-cloud-
UNIT OK: passed
UNIT Results (max last 5 lines):
hooks/
hooks/
TOTAL 1054 369 65%
Ran 99 tests in 9.596s
OK
Full unit test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
UOSCI bot says:
charm_amulet_test #493 nova-cloud-
AMULET FAIL: amulet-test failed
AMULET Results (max last 5 lines):
"
WARNING cannot delete security group "juju-osci-sv07-0". Used by another environment?
juju-test INFO : Results: 2 passed, 0 failed, 1 errored
ERROR subprocess encountered error code 124
make: *** [test] Error 124
Full amulet test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
UOSCI bot says:
charm_lint_check #1159 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://
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
UOSCI bot says:
charm_unit_test #993 nova-cloud-
UNIT OK: passed
UNIT Results (max last 5 lines):
hooks/
hooks/
TOTAL 1055 370 65%
Ran 98 tests in 10.450s
OK
Full unit test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
UOSCI bot says:
charm_amulet_test #501 nova-cloud-
AMULET FAIL: amulet-test failed
AMULET Results (max last 5 lines):
subprocess.
WARNING cannot delete security group "juju-osci-sv05-0". Used by another environment?
juju-test INFO : Results: 0 passed, 2 failed, 1 errored
ERROR subprocess encountered error code 2
make: *** [test] Error 2
Full amulet test output: http://
Build: http://
Felipe Reyes (freyes) wrote : Posted in a previous version of this proposal | # |
> juju-test.
> juju-test.conductor DEBUG : Tearing down osci-sv07 juju environment
> juju-test.conductor DEBUG : Calling "juju destroy-environment -y osci-sv07ERROR:
> "
> WARNING cannot delete security group "juju-osci-sv07-0". Used by another environment?
> juju-test INFO : Results: 2 passed, 0 failed, 1 errored
> ERROR subprocess encountered error code 124
Should I do something with this error?
Felipe Reyes (freyes) : Posted in a previous version of this proposal | # |
Felipe Reyes (freyes) wrote : Posted in a previous version of this proposal | # |
By the way, this patch can be tested using the bundler file available at https:/
Thanks,
James Troup (elmo) wrote : Posted in a previous version of this proposal | # |
memcache (by design) has no ACLs and is not safe to deploy without some sort of protection (e.g. local iptables rules or being run on a private network not accessible to anything but trusted machines). How is this MP dealing with that?
Edward Hope-Morley (hopem) wrote : Posted in a previous version of this proposal | # |
Could this work - https:/
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
UOSCI bot says:
charm_lint_check #1236 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://
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
UOSCI bot says:
charm_unit_test #1070 nova-cloud-
UNIT OK: passed
UNIT Results (max last 5 lines):
hooks/
hooks/
TOTAL 1057 370 65%
Ran 99 tests in 10.551s
OK
Full unit test output: http://
Build: http://
Edward Hope-Morley (hopem) wrote : Posted in a previous version of this proposal | # |
We should already be leveraging split network support here e.g. have memcached running on the os-admin-network if defined. That should suffice.
Edward Hope-Morley (hopem) wrote : Posted in a previous version of this proposal | # |
See inline comment
uosci-testing-bot (uosci-testing-bot) wrote : Posted in a previous version of this proposal | # |
UOSCI bot says:
charm_amulet_test #539 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://
Jorge Niedbalski (niedbalski) wrote : Posted in a previous version of this proposal | # |
Will not be so easy to enable SASL support on the proposal, mostly since the memcache client requires to support it, and the default python-memcache module seems to not support it. We could use python-
Felipe Reyes (freyes) wrote : Posted in a previous version of this proposal | # |
@elmo, I'm addressing your concerns about memcached security adding iptables rules to allow access only to related machines, I would like to get your feedback on that MP[0]
[0] https:/
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #202 nova-cloud-
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #165 nova-cloud-
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #120 nova-cloud-
AMULET OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #83 nova-cloud-
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #89 nova-cloud-
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #118 nova-cloud-
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #121 nova-cloud-
UNIT OK: passed
- 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/memcache-relation-broken' | |||
2 | === target is u'nova_cc_hooks.py' | |||
3 | === added symlink 'hooks/memcache-relation-changed' | |||
4 | === target is u'nova_cc_hooks.py' | |||
5 | === added symlink 'hooks/memcache-relation-departed' | |||
6 | === target is u'nova_cc_hooks.py' | |||
7 | === added symlink 'hooks/memcache-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-12-03 23:49:34 +0000 | |||
11 | +++ hooks/nova_cc_context.py 2014-12-15 13:35:46 +0000 | |||
12 | @@ -6,6 +6,7 @@ | |||
13 | 6 | ERROR, | 6 | ERROR, |
14 | 7 | unit_get, | 7 | unit_get, |
15 | 8 | related_units, | 8 | related_units, |
16 | 9 | relations_for_id, | ||
17 | 9 | relation_get, | 10 | relation_get, |
18 | 10 | ) | 11 | ) |
19 | 11 | from charmhelpers.fetch import ( | 12 | from charmhelpers.fetch import ( |
20 | @@ -299,3 +300,26 @@ | |||
21 | 299 | ctxt = super(NovaIPv6Context, self).__call__() | 300 | ctxt = super(NovaIPv6Context, self).__call__() |
22 | 300 | ctxt['use_ipv6'] = config('prefer-ipv6') | 301 | ctxt['use_ipv6'] = config('prefer-ipv6') |
23 | 301 | return ctxt | 302 | return ctxt |
24 | 303 | |||
25 | 304 | |||
26 | 305 | class InstanceConsoleContext(context.OSContextGenerator): | ||
27 | 306 | interfaces = [] | ||
28 | 307 | |||
29 | 308 | def __call__(self): | ||
30 | 309 | ctxt = {} | ||
31 | 310 | servers = [] | ||
32 | 311 | try: | ||
33 | 312 | for rid in relation_ids('memcache'): | ||
34 | 313 | for rel in relations_for_id(rid): | ||
35 | 314 | priv_addr = rel['private-address'] | ||
36 | 315 | # format it as IPv6 address if neeeded | ||
37 | 316 | priv_addr = format_ipv6_addr(priv_addr) or priv_addr | ||
38 | 317 | servers.append({'private-address': priv_addr, | ||
39 | 318 | 'port': rel['port']}) | ||
40 | 319 | except Exception as ex: | ||
41 | 320 | log("Couldn't get caching servers: {}".format(str(ex)), | ||
42 | 321 | level='WARNING') | ||
43 | 322 | servers = [] | ||
44 | 323 | |||
45 | 324 | ctxt['memcached_servers'] = servers | ||
46 | 325 | return ctxt | ||
47 | 302 | 326 | ||
48 | === modified file 'hooks/nova_cc_hooks.py' | |||
49 | --- hooks/nova_cc_hooks.py 2014-10-23 07:32:45 +0000 | |||
50 | +++ hooks/nova_cc_hooks.py 2014-12-15 13:35:46 +0000 | |||
51 | @@ -849,6 +849,15 @@ | |||
52 | 849 | quantum_joined(rid=rid) | 849 | quantum_joined(rid=rid) |
53 | 850 | 850 | ||
54 | 851 | 851 | ||
55 | 852 | @hooks.hook('memcache-relation-joined', | ||
56 | 853 | 'memcache-relation-departed', | ||
57 | 854 | 'memcache-relation-changed', | ||
58 | 855 | 'memcache-relation-broken') | ||
59 | 856 | @restart_on_change(restart_map()) | ||
60 | 857 | def memcached_joined(): | ||
61 | 858 | CONFIGS.write(NOVA_CONF) | ||
62 | 859 | |||
63 | 860 | |||
64 | 852 | def main(): | 861 | def main(): |
65 | 853 | try: | 862 | try: |
66 | 854 | hooks.execute(sys.argv) | 863 | hooks.execute(sys.argv) |
67 | 855 | 864 | ||
68 | === modified file 'hooks/nova_cc_utils.py' | |||
69 | --- hooks/nova_cc_utils.py 2014-11-14 09:55:10 +0000 | |||
70 | +++ hooks/nova_cc_utils.py 2014-12-15 13:35:46 +0000 | |||
71 | @@ -68,6 +68,7 @@ | |||
72 | 68 | 'python-psycopg2', | 68 | 'python-psycopg2', |
73 | 69 | 'python-psutil', | 69 | 'python-psutil', |
74 | 70 | 'uuid', | 70 | 'uuid', |
75 | 71 | 'python-memcache', | ||
76 | 71 | ] | 72 | ] |
77 | 72 | 73 | ||
78 | 73 | BASE_SERVICES = [ | 74 | BASE_SERVICES = [ |
79 | @@ -123,7 +124,8 @@ | |||
80 | 123 | nova_cc_context.VolumeServiceContext(), | 124 | nova_cc_context.VolumeServiceContext(), |
81 | 124 | nova_cc_context.NovaIPv6Context(), | 125 | nova_cc_context.NovaIPv6Context(), |
82 | 125 | nova_cc_context.NeutronCCContext(), | 126 | nova_cc_context.NeutronCCContext(), |
84 | 126 | nova_cc_context.NovaConfigContext()], | 127 | nova_cc_context.NovaConfigContext(), |
85 | 128 | nova_cc_context.InstanceConsoleContext()], | ||
86 | 127 | }), | 129 | }), |
87 | 128 | (NOVA_API_PASTE, { | 130 | (NOVA_API_PASTE, { |
88 | 129 | 'services': [s for s in BASE_SERVICES if 'api' in s], | 131 | 'services': [s for s in BASE_SERVICES if 'api' in s], |
89 | 130 | 132 | ||
90 | === modified file 'metadata.yaml' | |||
91 | --- metadata.yaml 2014-07-11 09:14:57 +0000 | |||
92 | +++ metadata.yaml 2014-12-15 13:35:46 +0000 | |||
93 | @@ -40,6 +40,8 @@ | |||
94 | 40 | nova-vmware: | 40 | nova-vmware: |
95 | 41 | interface: nova-vmware | 41 | interface: nova-vmware |
96 | 42 | scope: container | 42 | scope: container |
97 | 43 | memcache: | ||
98 | 44 | interface: memcache | ||
99 | 43 | peers: | 45 | peers: |
100 | 44 | cluster: | 46 | cluster: |
101 | 45 | interface: nova-ha | 47 | interface: nova-ha |
102 | 46 | 48 | ||
103 | === modified file 'templates/folsom/nova.conf' | |||
104 | --- templates/folsom/nova.conf 2014-04-16 08:25:14 +0000 | |||
105 | +++ templates/folsom/nova.conf 2014-12-15 13:35:46 +0000 | |||
106 | @@ -21,6 +21,11 @@ | |||
107 | 21 | enabled_apis=ec2,osapi_compute,metadata | 21 | enabled_apis=ec2,osapi_compute,metadata |
108 | 22 | auth_strategy=keystone | 22 | auth_strategy=keystone |
109 | 23 | compute_driver=libvirt.LibvirtDriver | 23 | compute_driver=libvirt.LibvirtDriver |
110 | 24 | |||
111 | 25 | {% if memcached_servers %} | ||
112 | 26 | memcached_servers = {%for s in memcached_servers %}{% if loop.index0 != 0 %},{% endif %}{{s['private-address']}}:{{s['port']}}{% endfor %} | ||
113 | 27 | {% endif %} | ||
114 | 28 | |||
115 | 24 | {% if keystone_ec2_url -%} | 29 | {% if keystone_ec2_url -%} |
116 | 25 | keystone_ec2_url = {{ keystone_ec2_url }} | 30 | keystone_ec2_url = {{ keystone_ec2_url }} |
117 | 26 | {% endif -%} | 31 | {% endif -%} |
118 | 27 | 32 | ||
119 | === modified file 'templates/grizzly/nova.conf' | |||
120 | --- templates/grizzly/nova.conf 2014-03-31 11:56:09 +0000 | |||
121 | +++ templates/grizzly/nova.conf 2014-12-15 13:35:46 +0000 | |||
122 | @@ -20,6 +20,11 @@ | |||
123 | 20 | enabled_apis=ec2,osapi_compute,metadata | 20 | enabled_apis=ec2,osapi_compute,metadata |
124 | 21 | auth_strategy=keystone | 21 | auth_strategy=keystone |
125 | 22 | compute_driver=libvirt.LibvirtDriver | 22 | compute_driver=libvirt.LibvirtDriver |
126 | 23 | |||
127 | 24 | {% if memcached_servers %} | ||
128 | 25 | memcached_servers = {%for s in memcached_servers %}{% if loop.index0 != 0 %},{% endif %}{{s['private-address']}}:{{s['port']}}{% endfor %} | ||
129 | 26 | {% endif %} | ||
130 | 27 | |||
131 | 23 | {% if keystone_ec2_url -%} | 28 | {% if keystone_ec2_url -%} |
132 | 24 | keystone_ec2_url = {{ keystone_ec2_url }} | 29 | keystone_ec2_url = {{ keystone_ec2_url }} |
133 | 25 | {% endif -%} | 30 | {% endif -%} |
134 | 26 | 31 | ||
135 | === modified file 'templates/havana/nova.conf' | |||
136 | --- templates/havana/nova.conf 2014-12-03 23:31:19 +0000 | |||
137 | +++ templates/havana/nova.conf 2014-12-15 13:35:46 +0000 | |||
138 | @@ -27,6 +27,10 @@ | |||
139 | 27 | use_syslog={{ use_syslog }} | 27 | use_syslog={{ use_syslog }} |
140 | 28 | my_ip = {{ host_ip }} | 28 | my_ip = {{ host_ip }} |
141 | 29 | 29 | ||
142 | 30 | {% if memcached_servers %} | ||
143 | 31 | memcached_servers = {%for s in memcached_servers %}{% if loop.index0 != 0 %},{% endif %}{{s['private-address']}}:{{s['port']}}{% endfor %} | ||
144 | 32 | {% endif %} | ||
145 | 33 | |||
146 | 30 | {% if keystone_ec2_url -%} | 34 | {% if keystone_ec2_url -%} |
147 | 31 | keystone_ec2_url = {{ keystone_ec2_url }} | 35 | keystone_ec2_url = {{ keystone_ec2_url }} |
148 | 32 | {% endif -%} | 36 | {% endif -%} |
149 | 33 | 37 | ||
150 | === modified file 'templates/icehouse/nova.conf' | |||
151 | --- templates/icehouse/nova.conf 2014-12-03 23:31:19 +0000 | |||
152 | +++ templates/icehouse/nova.conf 2014-12-15 13:35:46 +0000 | |||
153 | @@ -38,6 +38,10 @@ | |||
154 | 38 | use_syslog={{ use_syslog }} | 38 | use_syslog={{ use_syslog }} |
155 | 39 | my_ip = {{ host_ip }} | 39 | my_ip = {{ host_ip }} |
156 | 40 | 40 | ||
157 | 41 | {% if memcached_servers %} | ||
158 | 42 | memcached_servers = {%for s in memcached_servers %}{% if loop.index0 != 0 %},{% endif %}{{s['private-address']}}:{{s['port']}}{% endfor %} | ||
159 | 43 | {% endif %} | ||
160 | 44 | |||
161 | 41 | {% if keystone_ec2_url -%} | 45 | {% if keystone_ec2_url -%} |
162 | 42 | keystone_ec2_url = {{ keystone_ec2_url }} | 46 | keystone_ec2_url = {{ keystone_ec2_url }} |
163 | 43 | {% endif -%} | 47 | {% endif -%} |
164 | 44 | 48 | ||
165 | === added file 'unit_tests/test_nova_cc_contexts.py' | |||
166 | --- unit_tests/test_nova_cc_contexts.py 1970-01-01 00:00:00 +0000 | |||
167 | +++ unit_tests/test_nova_cc_contexts.py 2014-12-15 13:35:46 +0000 | |||
168 | @@ -0,0 +1,87 @@ | |||
169 | 1 | from __future__ import print_function | ||
170 | 2 | |||
171 | 3 | import mock | ||
172 | 4 | |||
173 | 5 | ##### | ||
174 | 6 | # NOTE(freyes): this is a workaround to patch config() function imported by | ||
175 | 7 | # nova_cc_utils before it gets a reference to the actual config() provided by | ||
176 | 8 | # hookenv module. | ||
177 | 9 | from charmhelpers.core import hookenv | ||
178 | 10 | _conf = hookenv.config | ||
179 | 11 | hookenv.config = mock.MagicMock() | ||
180 | 12 | import nova_cc_utils as _utils | ||
181 | 13 | # this assert is a double check + to avoid pep8 warning | ||
182 | 14 | assert _utils.config == hookenv.config | ||
183 | 15 | hookenv.config = _conf | ||
184 | 16 | ##### | ||
185 | 17 | |||
186 | 18 | import nova_cc_context as context | ||
187 | 19 | |||
188 | 20 | from charmhelpers.contrib.openstack import utils | ||
189 | 21 | |||
190 | 22 | from test_utils import CharmTestCase | ||
191 | 23 | |||
192 | 24 | |||
193 | 25 | TO_PATCH = [ | ||
194 | 26 | 'apt_install', | ||
195 | 27 | 'filter_installed_packages', | ||
196 | 28 | 'relation_ids', | ||
197 | 29 | 'relation_get', | ||
198 | 30 | 'related_units', | ||
199 | 31 | 'config', | ||
200 | 32 | 'log', | ||
201 | 33 | 'unit_get', | ||
202 | 34 | 'relations_for_id', | ||
203 | 35 | ] | ||
204 | 36 | |||
205 | 37 | |||
206 | 38 | def fake_log(msg, level=None): | ||
207 | 39 | level = level or 'INFO' | ||
208 | 40 | print('[juju test log (%s)] %s' % (level, msg)) | ||
209 | 41 | |||
210 | 42 | |||
211 | 43 | class NovaComputeContextTests(CharmTestCase): | ||
212 | 44 | def setUp(self): | ||
213 | 45 | super(NovaComputeContextTests, self).setUp(context, TO_PATCH) | ||
214 | 46 | self.relation_get.side_effect = self.test_relation.get | ||
215 | 47 | self.config.side_effect = self.test_config.get | ||
216 | 48 | self.log.side_effect = fake_log | ||
217 | 49 | |||
218 | 50 | @mock.patch.object(utils, 'os_release') | ||
219 | 51 | @mock.patch('charmhelpers.contrib.network.ip.log') | ||
220 | 52 | def test_instance_console_context_without_memcache(self, os_release, log_): | ||
221 | 53 | self.unit_get.return_value = '127.0.0.1' | ||
222 | 54 | self.relation_ids.return_value = 'cache:0' | ||
223 | 55 | self.related_units.return_value = 'memcached/0' | ||
224 | 56 | instance_console = context.InstanceConsoleContext() | ||
225 | 57 | os_release.return_value = 'icehouse' | ||
226 | 58 | self.assertEqual({'memcached_servers': []}, | ||
227 | 59 | instance_console()) | ||
228 | 60 | |||
229 | 61 | @mock.patch.object(utils, 'os_release') | ||
230 | 62 | @mock.patch('charmhelpers.contrib.network.ip.log') | ||
231 | 63 | def test_instance_console_context_with_memcache(self, os_release, log_): | ||
232 | 64 | self.check_instance_console_context_with_memcache(os_release, | ||
233 | 65 | '127.0.1.1', | ||
234 | 66 | '127.0.1.1') | ||
235 | 67 | |||
236 | 68 | @mock.patch.object(utils, 'os_release') | ||
237 | 69 | @mock.patch('charmhelpers.contrib.network.ip.log') | ||
238 | 70 | def test_instance_console_context_with_memcache_ipv6(self, os_release, | ||
239 | 71 | log_): | ||
240 | 72 | self.check_instance_console_context_with_memcache(os_release, '::1', | ||
241 | 73 | '[::1]') | ||
242 | 74 | |||
243 | 75 | def check_instance_console_context_with_memcache(self, os_release, ip, | ||
244 | 76 | formated_ip): | ||
245 | 77 | memcached_servers = [{'private-address': formated_ip, | ||
246 | 78 | 'port': '11211'}] | ||
247 | 79 | self.unit_get.return_value = ip | ||
248 | 80 | self.relation_ids.return_value = ['cache:0'] | ||
249 | 81 | self.relations_for_id.return_value = memcached_servers | ||
250 | 82 | self.related_units.return_value = 'memcached/0' | ||
251 | 83 | instance_console = context.InstanceConsoleContext() | ||
252 | 84 | os_release.return_value = 'icehouse' | ||
253 | 85 | self.maxDiff = None | ||
254 | 86 | self.assertEqual({'memcached_servers': memcached_servers}, | ||
255 | 87 | instance_console()) | ||
256 | 0 | 88 | ||
257 | === modified file 'unit_tests/test_nova_cc_hooks.py' | |||
258 | --- unit_tests/test_nova_cc_hooks.py 2014-10-21 13:18:47 +0000 | |||
259 | +++ unit_tests/test_nova_cc_hooks.py 2014-12-15 13:35:46 +0000 | |||
260 | @@ -1,6 +1,7 @@ | |||
261 | 1 | from mock import MagicMock, patch, call | 1 | from mock import MagicMock, patch, call |
262 | 2 | from test_utils import CharmTestCase, patch_open | 2 | from test_utils import CharmTestCase, patch_open |
263 | 3 | import os | 3 | import os |
264 | 4 | |||
265 | 4 | with patch('charmhelpers.core.hookenv.config') as config: | 5 | with patch('charmhelpers.core.hookenv.config') as config: |
266 | 5 | config.return_value = 'neutron' | 6 | config.return_value = 'neutron' |
267 | 6 | import nova_cc_utils as utils | 7 | import nova_cc_utils as utils |
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://