Merge lp:~james-page/charms/quantal/glance/ceph-integration into lp:~charmers/charms/quantal/glance/trunk

Proposed by James Page
Status: Merged
Merged at revision: 24
Proposed branch: lp:~james-page/charms/quantal/glance/ceph-integration
Merge into: lp:~charmers/charms/quantal/glance/trunk
Diff against target: 81 lines (+53/-0)
2 files modified
hooks/glance-relations (+51/-0)
metadata.yaml (+2/-0)
To merge this branch: bzr merge lp:~james-page/charms/quantal/glance/ceph-integration
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+129229@code.launchpad.net

This proposal supersedes a proposal from 2012-10-11.

Description of the change

Support for use of Ceph RADOS object storage for glance.

To post a comment you must log in.
27. By James Page

Added support for auth configuration from ceph

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added symlink 'hooks/ceph-relation-changed'
2=== target is u'glance-relations'
3=== added symlink 'hooks/ceph-relation-joined'
4=== target is u'glance-relations'
5=== modified file 'hooks/glance-relations'
6--- hooks/glance-relations 2012-06-19 23:09:07 +0000
7+++ hooks/glance-relations 2012-10-25 06:35:11 +0000
8@@ -86,6 +86,55 @@
9 glance_ctl glance-api restart
10 }
11
12+
13+function ceph_joined {
14+ mkdir -p /etc/ceph
15+ apt-get -y install ceph-common python-ceph || exit 1
16+}
17+
18+function ceph_changed {
19+ SERVICE_NAME=`echo $JUJU_UNIT_NAME | cut -d / -f 1`
20+ KEYRING=/etc/ceph/ceph.client.$SERVICE_NAME.keyring
21+ KEY=`relation-get key`
22+ if [ -n "$KEY" ]; then
23+ # But only once
24+ if [ ! -f $KEYRING ]; then
25+ ceph-authtool $KEYRING \
26+ --create-keyring --name=client.$SERVICE_NAME \
27+ --add-key="$KEY"
28+ chmod +r $KEYRING
29+ fi
30+ else
31+ # No key - bail for the time being
32+ exit 0
33+ fi
34+
35+ MONS=`relation-list`
36+ mon_hosts=""
37+ for mon in $MONS; do
38+ mon_hosts="$mon_hosts `relation-get private-address $mon`:6789"
39+ done
40+ cat > /etc/ceph/ceph.conf << EOF
41+[global]
42+ auth supported = $(relation-get auth)
43+ keyring = /etc/ceph/\$cluster.\$name.keyring
44+ mon host = $mon_hosts
45+EOF
46+
47+ # Create the images pool if it does not already exist
48+ if ! rados --id $SERVICE_NAME lspools | grep -q images; then
49+ rados --id $SERVICE_NAME mkpool images
50+ fi
51+
52+ # Configure glance for ceph storage options
53+ set_or_update default_store rbd api
54+ set_or_update rbd_store_ceph_conf /etc/ceph/ceph.conf api
55+ set_or_update rbd_store_user $SERVICE_NAME api
56+ set_or_update rbd_store_pool images api
57+ set_or_update rbd_store_chunk_size 8 api
58+ glance_ctl glance-api restart
59+}
60+
61 function keystone_joined {
62 # advertise our API endpoint to keystone
63 url="http://$(unit-get private-address):9292/v1"
64@@ -138,5 +187,7 @@
65 "object-store-relation-changed") object-store_changed ;;
66 "identity-service-relation-joined") keystone_joined ;;
67 "identity-service-relation-changed") keystone_changed ;;
68+ "ceph-relation-joined") ceph_joined;;
69+ "ceph-relation-changed") ceph_changed;;
70 esac
71
72
73=== modified file 'metadata.yaml'
74--- metadata.yaml 2012-06-07 17:53:19 +0000
75+++ metadata.yaml 2012-10-25 06:35:11 +0000
76@@ -17,3 +17,5 @@
77 interface: swift
78 identity-service:
79 interface: keystone
80+ ceph:
81+ interface: ceph-client

Subscribers

People subscribed via source and target branches

to all changes: