Merge lp:~gandelman-a/charms/precise/nova-cloud-controller/trunk into lp:~charmers/charms/precise/nova-cloud-controller/trunk

Proposed by Adam Gandelman
Status: Merged
Merge reported by: Adam Gandelman
Merged at revision: not available
Proposed branch: lp:~gandelman-a/charms/precise/nova-cloud-controller/trunk
Merge into: lp:~charmers/charms/precise/nova-cloud-controller/trunk
Diff against target: 222 lines (+120/-10)
5 files modified
config.yaml (+1/-1)
hooks/nova-cloud-controller-common (+32/-5)
hooks/nova-cloud-controller-relations (+84/-1)
metadata.yaml (+2/-2)
revision (+1/-1)
To merge this branch: bzr merge lp:~gandelman-a/charms/precise/nova-cloud-controller/trunk
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+86845@code.launchpad.net
To post a comment you must log in.

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-10-26 22:22:12 +0000
3+++ config.yaml 2012-01-05 01:21:26 +0000
4@@ -2,7 +2,7 @@
5 nova-release:
6 default: distro
7 type: string
8- description: Nova PPA from which to install. (distro, trunk, milestone, milestone-proposed)
9+ description: Nova PPA from which to install. (distro, trunk, milestone, milestone-proposed or ppa:somewhere/else)
10 nova-config:
11 default: /etc/nova/nova.conf
12 type: string
13
14=== added symlink 'hooks/identity-service-relation-changed'
15=== target is u'nova-cloud-controller-relations'
16=== added symlink 'hooks/identity-service-relation-joined'
17=== target is u'nova-cloud-controller-relations'
18=== modified file 'hooks/nova-cloud-controller-common'
19--- hooks/nova-cloud-controller-common 2011-11-15 01:00:20 +0000
20+++ hooks/nova-cloud-controller-common 2012-01-05 01:21:26 +0000
21@@ -1,8 +1,9 @@
22 #!/bin/bash
23 SERVICES="nova-api nova-objectstore nova-scheduler"
24-PACKAGES="$SERVICES python-mysqldb"
25+PACKAGES="$SERVICES python-mysqldb python-keystone openstackx"
26
27 NOVA_CONF=$(config-get nova-config)
28+API_CONF="/etc/nova/api-paste.ini"
29
30 # we'll request credentials via the amqp relation for this user
31 RABBIT_USER=$(config-get rabbit-user)
32@@ -30,6 +31,19 @@
33 fi
34 }
35
36+function update_pipeline {
37+ # updates pipeline middleware definitions in api-paste.ini
38+ local pipeline="$1"
39+ local new="$2"
40+ local tag="\[pipeline:$pipeline\]"
41+ if ! grep -q "$tag" $API_CONF ; then
42+ echo "ERROR: pipeline not found: $pipeline"
43+ return 1
44+ fi
45+ juju-log "Updating pipeline:$pipeline in $API_CONF"
46+ sed -i "/$tag/, +1 s/\(pipeline = \).*/\1$new/g" $API_CONF
47+}
48+
49 function nova_ctl_status {
50 SERVICE=$1
51 # workaround upstarts lack of scriptable return codes
52@@ -114,11 +128,24 @@
53 }
54
55 function add_ppa {
56- # don't setup PPA, install from archive
57+ # Install from archive instead of PPA.
58 [[ $PPA == "distro" ]] && return 0
59- juju-log "nova-cloud-controller: Configuring PPA access for $PPA"
60 . /etc/lsb-release
61- PPA_URL="deb http://ppa.launchpad.net/nova-core/$PPA/ubuntu $DISTRIB_CODENAME main"
62- add-apt-repository "$PPA_URL" || exit 1
63+ [[ -z $PPA ]] && return 0
64+ # if referenced by name, setup ppa to upstream PPAs
65+ if [[ "$PPA" == "trunk" ]] ||
66+ [[ "$PPA" == "milestone" ]] ||
67+ [[ "$PPA" == "milestone-proposed" ]] ; then
68+ juju-log "nova: Configuring installation from upstream PPA ($PPA)"
69+ PPA_URL="deb http://ppa.launchpad.net/nova-core/$PPA/ubuntu $DISTRIB_CODENAME main"
70+ add-apt-repository "$PPA_URL" || exit 1
71+ return
72+ fi
73+ if [[ "${PPA:0:4}" == "ppa:" ]] ; then
74+ juju-log "nova: Configuring installation from custom PPA ($PPA)"
75+ add-apt-repository -y "$PPA" || exit 1
76+ return
77+ fi
78+ juju-log "nova: No PPA specified. Falling back to installation from Ubuntu archive."
79 }
80
81
82=== modified file 'hooks/nova-cloud-controller-relations'
83--- hooks/nova-cloud-controller-relations 2011-11-15 01:00:20 +0000
84+++ hooks/nova-cloud-controller-relations 2012-01-05 01:21:26 +0000
85@@ -17,6 +17,17 @@
86 DEBIAN_FRONTEND=noninteractive apt-get -y \
87 install --no-install-recommends $PACKAGES || exit 1
88 configure_network_manager $NETWORK_MANAGER
89+
90+ # setup osapi extensions required for dashboard
91+ # these are the required middleware extensions as of 12/20/2011
92+ extensions="openstackx.extensions.admin.Admin
93+ nova.api.openstack.v2.contrib.standard_extensions"
94+
95+ for e in $extensions ; do
96+ grep -q "^--osapi_extension=$e" "$NOVA_CONF" ||
97+ echo "--osapi_extension=$e" >>"$NOVA_CONF"
98+ done
99+
100 nova_ctl all stop
101 }
102
103@@ -58,7 +69,7 @@
104 }
105
106 function db_changed {
107- DB_HOST=`relation-get db_host`
108+ DB_HOST=`relation-get private-address`
109 DB_PASSWORD=`relation-get password`
110 if [[ -z $DB_HOST ]] || [[ -z $DB_PASSWORD ]] ; then
111 echo "db_changed: DB_HOST || DB_PASSWORD not yet set. Exit 0 and retry"
112@@ -89,6 +100,76 @@
113 relation-set network_manager=$manager ec2_host=$(unit-get private-address)
114 }
115
116+function keystone_joined {
117+ # inform keystone about our service and register its endpoints
118+ # note: all 3 endpoint urls point to the same nova endpoint.
119+ url="http://$(unit-get private-address):8774/v1.1/%tenant_id%"
120+ relation-set service="nova" \
121+ region="RegionOne" public_url=$url admin_url=$url internal_url=$url
122+}
123+
124+function keystone_changed {
125+ token=$(relation-get admin_token)
126+ service_port=$(relation-get service_port)
127+ auth_port=$(relation-get auth_port)
128+ [[ -z "$token" ]] || [[ -z "$service_port" ]] || [[ -z "$auth_port" ]] &&
129+ juju-log "keystone_changed: Peer not ready" && exit 0
130+ [[ "$token" == "-1" ]] &&
131+ juju-log "keystone_changed: admin token error" && exit 1
132+ juju-log "keystone_changed: Acquired admin token"
133+
134+ keystone_host=`dig +short +search $(relation-get private-address)`
135+ set_or_update "keystone_ec2_url" "http://$(relation-get private-address):5000/v2.0/ec2tokens"
136+
137+ # as of now (12/19/11), the default ec2 api pipelines need updating for keystone to work
138+ # could/should be fixed in packaged config
139+ ec2pipeline="ec2faultwrap logrequest totoken authtoken keystonecontext cloudrequest authorizer ec2executor"
140+ osapipipeline="faultwrap authtoken keystonecontext ratelimit serialize extensions osapi_app_v2"
141+
142+ update_pipeline "ec2cloud" "$ec2pipeline"
143+ update_pipeline "ec2admin" "$ec2pipeline"
144+ update_pipeline "openstack_api_v2" "$osapipipeline"
145+
146+ if grep -q use_deprecated_auth $NOVA_CONF ; then
147+ juju-log "keystone_changed: Disabling '--use_deprecated_auth"
148+ sed -i '/--use_deprecated_auth/d' $NOVA_CONF
149+ fi
150+
151+ ### This should be added to the default api-paste.ini
152+ juju-log "Appending filter:totoken to paste config"
153+ cat <<END >>$API_CONF
154+
155+[filter:totoken]
156+paste.filter_factory = keystone.middleware.ec2_token:EC2Token.factory
157+
158+END
159+
160+ ## Append keystone auth config to the bottom of the paste ini
161+ # this will probably need to be fixed so we dont append everytime
162+ # the relation is run
163+ juju-log "Updating $API_CONF with filter:keystonecontext and filter:authtoken"
164+ cat <<END >>$API_CONF
165+
166+####
167+# Keystone auth config added by Juju
168+###
169+[filter:keystonecontext]
170+paste.filter_factory = keystone.middleware.nova_keystone_context:NovaKeystoneContext.factory
171+
172+[filter:authtoken]
173+paste.filter_factory = keystone.middleware.auth_token:filter_factory
174+service_protocol = http
175+service_host = $keystone_host
176+service_port = $service_port
177+auth_host = $keystone_host
178+auth_port = $auth_port
179+auth_protocol = http
180+auth_uri = http://$keystone_host:$service_port/
181+admin_token = $token
182+END
183+ nova_ctl nova-api restart
184+}
185+
186 case $ARG0 in
187 "start"|"stop") nova_ctl all $ARG0 ;;
188 "install") install_hook ;;
189@@ -99,5 +180,7 @@
190 "image-service-relation-joined") exit 0 ;;
191 "image-service-relation-changed") image-service_changed ;;
192 "nova-network-relation-joined") nova-network_joined ;;
193+ "identity-service-relation-joined") keystone_joined ;;
194+ "identity-service-relation-changed") keystone_changed ;;
195 *) exit 0 ;;
196 esac
197
198=== modified file 'metadata.yaml'
199--- metadata.yaml 2011-10-12 06:08:13 +0000
200+++ metadata.yaml 2012-01-05 01:21:26 +0000
201@@ -5,8 +5,6 @@
202 Cloud controller node for Openstack nova. Contains nova-schedule,
203 nova-api, nova-network and nova-objectstore.
204 provides:
205- cloud-controller:
206- interface: nova
207 nova-network:
208 interface: nova
209 requires:
210@@ -16,3 +14,5 @@
211 interface: rabbitmq
212 image-service:
213 interface: glance
214+ identity-service:
215+ interface: keystone
216
217=== modified file 'revision'
218--- revision 2011-10-12 06:08:13 +0000
219+++ revision 2012-01-05 01:21:26 +0000
220@@ -1,1 +1,1 @@
221-55
222+71

Subscribers

People subscribed via source and target branches