Merge lp:~xfactor973/charms/trusty/ceph/dashboard-wip into lp:~openstack-charmers-archive/charms/trusty/ceph/trunk

Proposed by Chris Holcombe
Status: Needs review
Proposed branch: lp:~xfactor973/charms/trusty/ceph/dashboard-wip
Merge into: lp:~openstack-charmers-archive/charms/trusty/ceph/trunk
Diff against target: 131 lines (+39/-5)
4 files modified
.bzrignore (+1/-0)
hooks/ceph.py (+17/-3)
hooks/hooks.py (+19/-2)
metadata.yaml (+2/-0)
To merge this branch: bzr merge lp:~xfactor973/charms/trusty/ceph/dashboard-wip
Reviewer Review Type Date Requested Status
James Page Pending
Review via email: mp+269974@code.launchpad.net

Description of the change

This change is what was needed to get the Ceph dashboard working. I also fixed a small bug where the subprocess output wasn't being checked and failed the dashboard-relation-joined hook.

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #9246 ceph for xfactor973 mp269974
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
make: *** [lint] Error 1
ERROR:root:Make target returned non-zero.

Full lint test output: http://paste.ubuntu.com/12256785/
Build: http://10.245.162.77:8080/job/charm_lint_check/9246/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #8547 ceph for xfactor973 mp269974
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/8547/

Revision history for this message
Chris Holcombe (xfactor973) wrote :

Those lint failures aren't something I changed.

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #6237 ceph for xfactor973 mp269974
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/6237/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #12343 ceph for xfactor973 mp269974
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
make: *** [lint] Error 1
ERROR:root:Make target returned non-zero.

Full lint test output: http://paste.ubuntu.com/12895619/
Build: http://10.245.162.77:8080/job/charm_lint_check/12343/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #11452 ceph for xfactor973 mp269974
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/11452/

Unmerged revisions

111. By Chris Holcombe

Patch to get the ceph dashboard operational

110. By Chris Holcombe

WIP

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2014-10-01 20:08:33 +0000
3+++ .bzrignore 2015-09-02 20:10:00 +0000
4@@ -1,2 +1,3 @@
5 bin
6 .coverage
7+.idea
8
9=== modified file 'hooks/ceph.py'
10--- hooks/ceph.py 2015-03-23 17:59:39 +0000
11+++ hooks/ceph.py 2015-09-02 20:10:00 +0000
12@@ -1,4 +1,3 @@
13-
14 #
15 # Copyright 2012 Canonical Ltd.
16 #
17@@ -105,6 +104,7 @@
18 # Ignore any errors for this call
19 subprocess.call(cmd)
20
21+
22 DISK_FORMATS = [
23 'xfs',
24 'ext4',
25@@ -118,7 +118,7 @@
26 info = info.split("\n") # IGNORE:E1103
27 for line in info:
28 if line.startswith(
29- 'Partition GUID code: 4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D'
30+ 'Partition GUID code: 4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D'
31 ):
32 return True
33 except subprocess.CalledProcessError:
34@@ -232,6 +232,15 @@
35 'osd': ['allow rwx']
36 }
37
38+_dashboard_caps = {
39+ 'mon': ['allow rwx'],
40+ 'osd': ['allow rwx']
41+}
42+
43+
44+def get_dashboard_key():
45+ return get_named_key('dashboard', _dashboard_caps)
46+
47
48 def get_radosgw_key():
49 return get_named_key('radosgw.gateway', _radosgw_caps)
50@@ -260,7 +269,12 @@
51 subsystem,
52 '; '.join(subcaps),
53 ])
54- return parse_key(subprocess.check_output(cmd).strip()) # IGNORE:E1103
55+ try:
56+ output = subprocess.check_output(cmd)
57+ return parse_key(output.strip()) # IGNORE:E1103
58+ except subprocess.CalledProcessError as e:
59+ log("get_named_key failed with output: " + str(e.output))
60+ raise
61
62
63 def upgrade_key_caps(key, caps):
64
65=== added symlink 'hooks/dashboard-relation-joined'
66=== target is u'hooks.py'
67=== modified file 'hooks/hooks.py'
68--- hooks/hooks.py 2015-03-23 17:40:42 +0000
69+++ hooks/hooks.py 2015-09-02 20:10:00 +0000
70@@ -112,6 +112,7 @@
71 install_alternative('ceph.conf', '/etc/ceph/ceph.conf',
72 charm_ceph_conf, 100)
73
74+
75 JOURNAL_ZAPPED = '/var/lib/ceph/journal_zapped'
76
77
78@@ -145,7 +146,7 @@
79
80 osd_journal = config('osd-journal')
81 if (osd_journal and not os.path.exists(JOURNAL_ZAPPED)
82- and os.path.exists(osd_journal)):
83+ and os.path.exists(osd_journal)):
84 ceph.zap_disk(osd_journal)
85 with open(JOURNAL_ZAPPED, 'w') as zapped:
86 zapped.write('DONE')
87@@ -200,7 +201,7 @@
88 for relid in relation_ids('mon'):
89 relation_set(relation_id=relid,
90 relation_settings={'ceph-public-address':
91- get_public_addr()})
92+ get_public_addr()})
93
94
95 @hooks.hook('mon-relation-departed',
96@@ -268,6 +269,22 @@
97 log('mon cluster not in quorum - deferring fsid provision')
98
99
100+@hooks.hook('dashboard-relation-joined')
101+def dashboard_relation(relid=None):
102+ if ceph.is_quorum():
103+ log("Providing dashboard with keys")
104+ data = {
105+ 'fsid': config('fsid'),
106+ 'dashboard_key': ceph.get_dashboard_key(),
107+ 'auth': config('auth-supported'),
108+ 'mon_hosts': ", ".join(get_mon_hosts()),
109+ }
110+ relation_set(relation_id=relid,
111+ relation_settings=data)
112+ else:
113+ log('mon cluster not in quorum - deferring key provision')
114+
115+
116 @hooks.hook('radosgw-relation-joined')
117 def radosgw_relation(relid=None):
118 # Install radosgw for admin tools
119
120=== modified file 'metadata.yaml'
121--- metadata.yaml 2015-08-10 16:32:52 +0000
122+++ metadata.yaml 2015-09-02 20:10:00 +0000
123@@ -22,6 +22,8 @@
124 interface: ceph-osd
125 radosgw:
126 interface: ceph-radosgw
127+ dashboard:
128+ interface: dashboard
129 nrpe-external-master:
130 interface: nrpe-external-master
131 scope: container

Subscribers

People subscribed via source and target branches