Merge lp:~xfactor973/charm-helpers/ceph-jewel-flag into lp:charm-helpers

Proposed by Chris Holcombe on 2016-04-15
Status: Merged
Merged at revision: 567
Proposed branch: lp:~xfactor973/charm-helpers/ceph-jewel-flag
Merge into: lp:charm-helpers
Diff against target: 47 lines (+13/-3)
2 files modified
charmhelpers/contrib/storage/linux/ceph.py (+8/-1)
tests/contrib/storage/test_linux_ceph.py (+5/-2)
To merge this branch: bzr merge lp:~xfactor973/charm-helpers/ceph-jewel-flag
Reviewer Review Type Date Requested Status
Ryan Beisner 2016-04-15 Approve on 2016-04-15
Review via email: mp+292049@code.launchpad.net

Description of the Change

Ceph added a mandatory flag in their jewel release candidate that needs to be added to our cache tier removal calls.

To post a comment you must log in.
Ryan Beisner (1chb1n) wrote :

Unit, lint checks OK. --yes-i-really-approve-it

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/storage/linux/ceph.py'
2--- charmhelpers/contrib/storage/linux/ceph.py 2016-04-13 21:45:02 +0000
3+++ charmhelpers/contrib/storage/linux/ceph.py 2016-04-15 20:44:26 +0000
4@@ -166,12 +166,19 @@
5 """
6 # read-only is easy, writeback is much harder
7 mode = get_cache_mode(self.service, cache_pool)
8+ version = ceph_version()
9 if mode == 'readonly':
10 check_call(['ceph', '--id', self.service, 'osd', 'tier', 'cache-mode', cache_pool, 'none'])
11 check_call(['ceph', '--id', self.service, 'osd', 'tier', 'remove', self.name, cache_pool])
12
13 elif mode == 'writeback':
14- check_call(['ceph', '--id', self.service, 'osd', 'tier', 'cache-mode', cache_pool, 'forward'])
15+ pool_forward_cmd = ['ceph', '--id', self.service, 'osd', 'tier',
16+ 'cache-mode', cache_pool, 'forward']
17+ if version >= '10.1':
18+ # Jewel added a mandatory flag
19+ pool_forward_cmd.append('--yes-i-really-mean-it')
20+
21+ check_call(pool_forward_cmd)
22 # Flush the cache and wait for it to return
23 check_call(['rados', '--id', self.service, '-p', cache_pool, 'cache-flush-evict-all'])
24 check_call(['ceph', '--id', self.service, 'osd', 'tier', 'remove-overlay', self.name])
25
26=== modified file 'tests/contrib/storage/test_linux_ceph.py'
27--- tests/contrib/storage/test_linux_ceph.py 2016-04-13 21:45:02 +0000
28+++ tests/contrib/storage/test_linux_ceph.py 2016-04-15 20:44:26 +0000
29@@ -214,13 +214,16 @@
30 ])
31
32 @patch.object(ceph_utils, 'get_cache_mode')
33- def test_pool_remove_writeback_cache_tier(self, cache_mode):
34+ @patch.object(ceph_utils, 'ceph_version')
35+ def test_pool_remove_writeback_cache_tier(self, ceph_version, cache_mode):
36 cache_mode.return_value = 'writeback'
37+ ceph_version.return_value = '10.1.1'
38
39 p = ceph_utils.Pool(name='test', service='admin')
40 p.remove_cache_tier(cache_pool='cacher')
41 self.check_call.assert_has_calls([
42- call(['ceph', '--id', 'admin', 'osd', 'tier', 'cache-mode', 'cacher', 'forward']),
43+ call(['ceph', '--id', 'admin', 'osd', 'tier', 'cache-mode', 'cacher', 'forward',
44+ '--yes-i-really-mean-it']),
45 call(['rados', '--id', 'admin', '-p', 'cacher', 'cache-flush-evict-all']),
46 call(['ceph', '--id', 'admin', 'osd', 'tier', 'remove-overlay', 'test']),
47 call(['ceph', '--id', 'admin', 'osd', 'tier', 'remove', 'test', 'cacher']),

Subscribers

People subscribed via source and target branches