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

Proposed by James Page
Status: Superseded
Proposed branch: lp:~james-page/charms/quantal/glance/ceph-integration
Merge into: lp:~charmers/charms/precise/glance/trunk
Diff against target: 167 lines (+79/-14) (has conflicts)
6 files modified
config.yaml (+3/-3)
copyright (+17/-0)
glance.yaml (+0/-6)
hooks/glance-common (+1/-1)
hooks/glance-relations (+56/-4)
metadata.yaml (+2/-0)
Conflict adding file copyright.  Moved existing file to copyright.moved.
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+129228@code.launchpad.net

This proposal has been superseded by 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

Unmerged revisions

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 2011-12-16 01:26:01 +0000
3+++ config.yaml 2012-10-11 15:59:24 +0000
4@@ -15,7 +15,7 @@
5 default: glance
6 type: string
7 description: Database username
8- nova-db:
9- default: nova
10+ glance-db:
11+ default: glance
12 type: string
13- description: Nova database name
14+ description: Glance database name.
15
16=== added file 'copyright'
17--- copyright 1970-01-01 00:00:00 +0000
18+++ copyright 2012-10-11 15:59:24 +0000
19@@ -0,0 +1,17 @@
20+Format: http://dep.debian.net/deps/dep5/
21+
22+Files: *
23+Copyright: Copyright 2012, Canonical Ltd., All Rights Reserved.
24+License: GPL-3
25+ This program is free software: you can redistribute it and/or modify
26+ it under the terms of the GNU General Public License as published by
27+ the Free Software Foundation, either version 3 of the License, or
28+ (at your option) any later version.
29+ .
30+ This program is distributed in the hope that it will be useful,
31+ but WITHOUT ANY WARRANTY; without even the implied warranty of
32+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33+ GNU General Public License for more details.
34+ .
35+ You should have received a copy of the GNU General Public License
36+ along with this program. If not, see <http://www.gnu.org/licenses/>.
37
38=== renamed file 'copyright' => 'copyright.moved'
39=== removed file 'glance.yaml'
40--- glance.yaml 2011-12-16 01:26:01 +0000
41+++ glance.yaml 1970-01-01 00:00:00 +0000
42@@ -1,6 +0,0 @@
43-glance:
44- glance-release: trunk
45- registry-config: /etc/glance/glance-registry.conf
46- api-config: /etc/glance/glance-api.conf
47- db-user: glance
48- nova-db: nova
49
50=== added symlink 'hooks/ceph-relation-changed'
51=== target is u'glance-relations'
52=== added symlink 'hooks/ceph-relation-joined'
53=== target is u'glance-relations'
54=== modified file 'hooks/glance-common'
55--- hooks/glance-common 2012-03-02 20:45:12 +0000
56+++ hooks/glance-common 2012-10-11 15:59:24 +0000
57@@ -9,7 +9,7 @@
58 GLANCE_API_PASTE_INI="/etc/glance/glance-api-paste.ini"
59
60 DB_USER=$(config-get db-user)
61-NOVA_DB=$(config-get nova-db)
62+GLANCE_DB=$(config-get glance-db)
63 PPA=$(config-get glance-release)
64
65 HOSTNAME=`hostname -f`
66
67=== modified file 'hooks/glance-relations'
68--- hooks/glance-relations 2012-04-13 22:46:42 +0000
69+++ hooks/glance-relations 2012-10-11 15:59:24 +0000
70@@ -35,8 +35,8 @@
71 }
72
73 function db_joined {
74- juju-log "glance: db_joined: requesting access to $NOVA_DB for $DB_USER@`unit-get private-address`"
75- relation-set database=$NOVA_DB
76+ juju-log "glance: db_joined: requesting access to $GLANCE_DB for $DB_USER@`unit-get private-address`"
77+ relation-set database=$GLANCE_DB
78 relation-set username=$DB_USER
79 relation-set hostname=`unit-get private-address`
80 }
81@@ -50,9 +50,10 @@
82 else
83 echo "db_changed: Received password from $DB_HOST"
84 fi
85- juju-log "glance: db_changed: Configuring registry for access to $NOVA_DB@$DB_HOST"
86+ juju-log "glance: db_changed: Configuring registry for access to $GLANCE_DB@$DB_HOST"
87 glance_ctl all stop
88- set_or_update sql_connection "mysql://$DB_USER:$DB_PASSWORD@$DB_HOST/$NOVA_DB" registry
89+ set_or_update sql_connection "mysql://$DB_USER:$DB_PASSWORD@$DB_HOST/$GLANCE_DB" registry
90+ set_or_update sql_connection "mysql://$DB_USER:$DB_PASSWORD@$DB_HOST/$GLANCE_DB" api
91 # Set the db version to 0 if its not under version control. We assume that any existing
92 # database we are being related to was created WITH version control.
93 if ! glance-manage db_version ; then
94@@ -85,6 +86,55 @@
95 glance_ctl glance-api restart
96 }
97
98+
99+function ceph_joined {
100+ mkdir -p /etc/ceph
101+ apt-get -y install ceph-common python-ceph || exit 1
102+}
103+
104+function ceph_changed {
105+ SERVICE_NAME=`echo $JUJU_UNIT_NAME | cut -d / -f 1`
106+ KEYRING=/etc/ceph/ceph.client.$SERVICE_NAME.keyring
107+ KEY=`relation-get key`
108+ if [ -n "$KEY" ]; then
109+ # But only once
110+ if [ ! -f $KEYRING ]; then
111+ ceph-authtool $KEYRING \
112+ --create-keyring --name=client.$SERVICE_NAME \
113+ --add-key="$KEY"
114+ chmod +r $KEYRING
115+ fi
116+ else
117+ # No key - bail for the time being
118+ exit 0
119+ fi
120+
121+ MONS=`relation-list`
122+ mon_hosts=""
123+ for mon in $MONS; do
124+ mon_hosts="$mon_hosts `relation-get private-address $mon`:6789"
125+ done
126+ cat > /etc/ceph/ceph.conf << EOF
127+[global]
128+ auth supported = cephx
129+ keyring = /etc/ceph/\$cluster.\$name.keyring
130+ mon host = $mon_hosts
131+EOF
132+
133+ # Create the images pool if it does not already exist
134+ if ! rados --id $SERVICE_NAME lspools | grep -q images; then
135+ rados --id $SERVICE_NAME mkpool images
136+ fi
137+
138+ # Configure glance for ceph storage options
139+ set_or_update default_store rbd api
140+ set_or_update rbd_store_ceph_conf /etc/ceph/ceph.conf api
141+ set_or_update rbd_store_user $SERVICE_NAME api
142+ set_or_update rbd_store_pool images api
143+ set_or_update rbd_store_chunk_size 8 api
144+ glance_ctl glance-api restart
145+}
146+
147 function keystone_joined {
148 # advertise our API endpoint to keystone
149 url="http://$(unit-get private-address):9292/v1"
150@@ -137,5 +187,7 @@
151 "object-store-relation-changed") object-store_changed ;;
152 "identity-service-relation-joined") keystone_joined ;;
153 "identity-service-relation-changed") keystone_changed ;;
154+ "ceph-relation-joined") ceph_joined;;
155+ "ceph-relation-changed") ceph_changed;;
156 esac
157
158
159=== modified file 'metadata.yaml'
160--- metadata.yaml 2012-06-07 17:53:19 +0000
161+++ metadata.yaml 2012-10-11 15:59:24 +0000
162@@ -17,3 +17,5 @@
163 interface: swift
164 identity-service:
165 interface: keystone
166+ ceph:
167+ interface: ceph-client

Subscribers

People subscribed via source and target branches

to all changes: