Merge lp:~hopem/charms/precise/cinder/python-redux.lp1226823 into lp:~openstack-charmers/charms/precise/cinder/python-redux

Proposed by Edward Hope-Morley
Status: Merged
Merged at revision: 74
Proposed branch: lp:~hopem/charms/precise/cinder/python-redux.lp1226823
Merge into: lp:~openstack-charmers/charms/precise/cinder/python-redux
Diff against target: 93 lines (+21/-8)
6 files modified
config.yaml (+10/-0)
hooks/cinder_hooks.py (+3/-1)
hooks/cinder_utils.py (+2/-2)
revision (+1/-1)
unit_tests/test_cinder_hooks.py (+1/-1)
unit_tests/test_cinder_utils.py (+4/-3)
To merge this branch: bzr merge lp:~hopem/charms/precise/cinder/python-redux.lp1226823
Reviewer Review Type Date Requested Status
Adam Gandelman Pending
Review via email: mp+187256@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Edward Hope-Morley (hopem) wrote :

Adam, I have not been able to run the unit tests as they won't run for me on precise->raring. Thought I would push this for you to look and if possible test while i get saucy up to try to run tests again.

69. By Edward Hope-Morley

Fixed unit tests

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

Ok I've run the test and they work fine aside from a tests that appears to be broken in trunk i.e.:

make test
Starting tests...
nose.plugins.cover: ERROR: Coverage not available: unable to import coverage module
............................................F.
======================================================================
FAIL: Ensure API restart before haproxy on cluster changed
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mock.py", line 1201, in patched
    return func(*args, **keywargs)
  File "/home/ubuntu/cinder.redux.lp1226823/unit_tests/test_cluster_hooks.py", line 81, in test_cluster_hook
    self.assertEquals(ex, service.call_args_list)
AssertionError: [call('restart', 'cinder-api'), call('restart', 'cinder-volume'), call('restart', 'cinder-scheduler'), call('restart', 'haproxy'), call('restart', 'apache2')] != []

----------------------------------------------------------------------
Ran 46 tests in 0.909s

FAILED (failures=1)
make: *** [test] Error 1

Revision history for this message
Adam Gandelman (gandelman-a) wrote :

Dont worry about that test, it is unrelated. Some mocks bleeding between test files, I need to fix that. LG, though. Merged.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2013-06-13 00:55:02 +0000
3+++ config.yaml 2013-09-24 16:42:36 +0000
4@@ -28,6 +28,16 @@
5 The *available* block device on which to create LVM volume group.
6 May also be set to None for deployments that will not need local
7 storage (eg, Ceph/RBD-backed volumes).
8+ ceph-osd-replication-count:
9+ default: 2
10+ type: int
11+ description: |
12+ This value dictates the number of replicas ceph must make of any
13+ object it stores withing the cinder rbd pool. Of course, this only
14+ applies if using Ceph as a backend store. Note that once the cinder
15+ rbd pool has been created, changing this value will not have any
16+ effect (although it can be changed in ceph by manually configuring
17+ your ceph cluster).
18 volume-group:
19 default: cinder-volumes
20 type: string
21
22=== modified file 'hooks/cinder_hooks.py'
23--- hooks/cinder_hooks.py 2013-09-24 15:54:19 +0000
24+++ hooks/cinder_hooks.py 2013-09-24 16:42:36 +0000
25@@ -172,7 +172,9 @@
26 set_ceph_env_variables(service=svc)
27
28 if eligible_leader(CLUSTER_RES):
29- ensure_ceph_pool(service=svc)
30+ _config = config()
31+ ensure_ceph_pool(service=svc,
32+ replicas=_config['ceph-osd-replication-count'])
33
34
35 @hooks.hook('cluster-relation-changed',
36
37=== modified file 'hooks/cinder_utils.py'
38--- hooks/cinder_utils.py 2013-09-23 18:43:55 +0000
39+++ hooks/cinder_utils.py 2013-09-24 16:42:36 +0000
40@@ -301,11 +301,11 @@
41 subprocess.check_call(cmd)
42
43
44-def ensure_ceph_pool(service):
45+def ensure_ceph_pool(service, replicas):
46 '''Creates a ceph pool for service if one does not exist'''
47 # TODO: Ditto about moving somewhere sharable.
48 if not ceph_pool_exists(service=service, name=service):
49- ceph_create_pool(service=service, name=service)
50+ ceph_create_pool(service=service, name=service, replicas=replicas)
51
52
53 def set_ceph_env_variables(service):
54
55=== modified file 'revision'
56--- revision 2013-07-19 23:03:02 +0000
57+++ revision 2013-09-24 16:42:36 +0000
58@@ -1,1 +1,1 @@
59-128
60+129
61
62=== modified file 'unit_tests/test_cinder_hooks.py'
63--- unit_tests/test_cinder_hooks.py 2013-09-23 18:10:11 +0000
64+++ unit_tests/test_cinder_hooks.py 2013-09-24 16:42:36 +0000
65@@ -265,7 +265,7 @@
66 self.ensure_ceph_keyring.return_value = True
67 hooks.hooks.execute(['hooks/ceph-relation-changed'])
68 self.ensure_ceph_keyring.assert_called_with(service='cinder')
69- self.ensure_ceph_pool.assert_called_with(service='cinder')
70+ self.ensure_ceph_pool.assert_called_with(service='cinder', replicas=2)
71 for c in [call('/etc/ceph/ceph.conf'),
72 call('/etc/cinder/cinder.conf')]:
73 self.assertIn(c, self.CONFIGS.write.call_args_list)
74
75=== modified file 'unit_tests/test_cinder_utils.py'
76--- unit_tests/test_cinder_utils.py 2013-09-23 18:43:55 +0000
77+++ unit_tests/test_cinder_utils.py 2013-09-24 16:42:36 +0000
78@@ -204,11 +204,12 @@
79
80 def test_ensure_ceph_pool(self):
81 self.ceph_pool_exists.return_value = False
82- cinder_utils.ensure_ceph_pool(service='cinder')
83+ cinder_utils.ensure_ceph_pool(service='cinder', replicas=3)
84 self.ceph_create_pool.assert_called_with(service='cinder',
85- name='cinder')
86+ name='cinder',
87+ replicas=3)
88
89 def test_ensure_ceph_pool_already_exists(self):
90 self.ceph_pool_exists.return_value = True
91- cinder_utils.ensure_ceph_pool(service='cinder')
92+ cinder_utils.ensure_ceph_pool(service='cinder', replicas=3)
93 self.assertFalse(self.ceph_create_pool.called)

Subscribers

People subscribed via source and target branches