Merge lp:~gandelman-a/charms/precise/cinder/upgrade into lp:~openstack-charmers/charms/precise/cinder/ha-support

Proposed by Adam Gandelman
Status: Merged
Merged at revision: 48
Proposed branch: lp:~gandelman-a/charms/precise/cinder/upgrade
Merge into: lp:~openstack-charmers/charms/precise/cinder/ha-support
Diff against target: 183 lines (+88/-20)
3 files modified
hooks/cinder-common (+43/-0)
hooks/cinder-hooks (+44/-19)
revision (+1/-1)
To merge this branch: bzr merge lp:~gandelman-a/charms/precise/cinder/upgrade
Reviewer Review Type Date Requested Status
James Page Approve
Adam Gandelman (community) Needs Resubmitting
Review via email: mp+164995@code.launchpad.net

Description of the change

This adds the charm bits around upgrading Openstack releases.

Upgrading /w ceph relations still needs some testing / isn't perfect:

- When upgrading OS release, librbd1 needs upgrading as well (cinders use of the library isn't backward compatable)
- After upgrading librdb1, the remote ceph cluster may need upgrading as well?

Testing fine with local storage/iscsi.

To post a comment you must log in.
51. By Adam Gandelman

Move librbd1 upgrade out of for loop.

Revision history for this message
James Page (james-page) wrote :

Borked syntax:

+ [[ -n "$ceph_ids"] && apt-get -y install librbd1

I'd also recommend that you upgrade ceph-common; it has a hard dependency on the newer version of librdb1 so will do the same thing (thats what we install in the _joined hook).

The problem you are hitting is that cinder determines ceph backend features by looking at the options from the rbd and ceph command line tools; if the backend is not upgraded first, then cinder will try to use features which are not supported by the backend ceph.

This sucks.

review: Needs Fixing
Revision history for this message
James Page (james-page) wrote :

cinder-volume suggests ceph-common only; and no versioned dependency (we should sort that out).

52. By Adam Gandelman

Fix bad syntax, upgrade ceph-common instead of only librbd1.

Revision history for this message
Adam Gandelman (gandelman-a) wrote :

Fix syntax and upgrading ceph-common instead of librbd, to pull in all its deps.

review: Needs Resubmitting
53. By Adam Gandelman

Also upgrade python-ceph.

Revision history for this message
James Page (james-page) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/cinder-common'
2--- hooks/cinder-common 2013-04-26 18:52:36 +0000
3+++ hooks/cinder-common 2013-05-24 18:35:30 +0000
4@@ -259,3 +259,46 @@
5 keystone_joined "$r_id"
6 done
7 }
8+
9+do_openstack_upgrade() {
10+ local rel="$1"
11+ shift
12+ local packages=$@
13+ configure_install_source "$rel"
14+ apt-get update
15+ DEBIAN_FRONTEND=noninteractive apt-get \
16+ --option Dpkg::Options::=--force-confnew -y \
17+ install --no-install-recommends $packages
18+ # update new configs for all possible relations
19+ # mysql
20+ for r_id in $(relation-ids shared-db); do
21+ for unit in $(relation-list -r $r_id) ; do
22+ juju-log "$CHARM: Configuring database after upgrade."
23+ db_changed $r_id $unit
24+ done
25+ done
26+ # rabbitmq-server
27+ for r_id in $(relation-ids amqp); do
28+ for unit in $(relation-list -r $r_id) ; do
29+ juju-log "$CHARM: Configuring amqp after upgrade."
30+ amqp_changed $r_id $unit
31+ done
32+ done
33+ # keystone
34+ for r_id in $(relation-ids identity-service); do
35+ for unit in $(relation-list -r $r_id) ; do
36+ juju-log "$CHARM: Configuring identity service after upgrade."
37+ keystone_changed $r_id $unit
38+ done
39+ done
40+ # ceph
41+ local ceph_ids="$(relation-ids ceph)"
42+ [[ -n "$ceph_ids" ]] && apt-get -y install ceph-common python-ceph
43+ for r_id in $ceph_ids ; do
44+ # ensure librbd gets updated with openstack
45+ for unit in $(relation-list -r $r_id) ; do
46+ juju-log "$CHARM: Configuring ceph client after upgarde."
47+ ceph_changed $r_id $unit
48+ done
49+ done
50+}
51
52=== modified file 'hooks/cinder-hooks'
53--- hooks/cinder-hooks 2013-05-20 10:29:08 +0000
54+++ hooks/cinder-hooks 2013-05-24 18:35:30 +0000
55@@ -45,8 +45,12 @@
56 }
57
58 db_changed() {
59- db_host=$(relation-get db_host)
60- db_password=$(relation-get password)
61+ local r_id="$1"
62+ local unit_id="$2"
63+ local r_arg=""
64+ [[ -n "$r_id" ]] && r_arg="-r $r_id"
65+ db_host=$(relation-get $r_arg db_host $unit_id)
66+ db_password=$(relation-get $r_arg password $unit_id)
67
68 [[ -z "$db_host" ]] || [[ -z "$db_password" ]] &&
69 juju-log "Missing DB_HOST|DB_PASSWORD, peer not ready? Will retry." &&
70@@ -69,15 +73,19 @@
71 }
72
73 amqp_changed() {
74- rabbit_host=$(relation-get private-address)
75- rabbit_password=$(relation-get password)
76+ local r_id="$1"
77+ local unit_id="$2"
78+ local r_arg=""
79+ [[ -n "$r_id" ]] && r_arg="-r $r_id"
80+ rabbit_host=$(relation-get $r_arg private-address $unit_id)
81+ rabbit_password=$(relation-get $r_arg password $unit_id)
82 [[ -z "$rabbit_host" ]] || [[ -z "$rabbit_password" ]] &&
83 juju-log "Missing rabbit_host||rabbit_passwd, peer not ready? Will retry." && exit 0
84- local clustered=$(relation-get clustered)
85+ local clustered=$(relation-get $r_arg clustered $unit_id)
86 if [[ -n "$clustered" ]] ; then
87 juju-log "$CHARM - amqp_changed: Configuring for access to haclustered "\
88 "rabbitmq service."
89- local vip=$(relation-get vip)
90+ local vip=$(relation-get $r_arg vip $unit_id)
91 [[ -z "$vip" ]] && juju-log "$CHARM - amqp_changed: Clustered bu no vip."\
92 && exit 0
93 rabbit_host="$vip"
94@@ -111,20 +119,22 @@
95 }
96
97 keystone_changed() {
98- service_port=$(relation-get service_port)
99- auth_port=$(relation-get auth_port)
100- service_username=$(relation-get service_username)
101- service_password=$(relation-get service_password)
102- service_tenant=$(relation-get service_tenant)
103+ local r_id="$1"
104+ local unit_id="$2"
105+ local r_arg=""
106+ [[ -n "$r_id" ]] && r_arg="-r $r_id"
107+ service_port=$(relation-get $r_arg service_port $unit_id)
108+ auth_port=$(relation-get $r_arg auth_port $unit_id)
109+ service_username=$(relation-get $r_arg service_username $unit_id)
110+ service_password=$(relation-get $r_arg service_password $unit_id)
111+ service_tenant=$(relation-get $r_arg service_tenant $unit_id)
112+ service_host=$(relation-get $r_arg service_host $unit_id)
113+ auth_host=$(relation-get $r_arg auth_host $unit_id)
114
115 [[ -z "$service_port" ]] || [[ -z "$auth_port" ]] ||
116 [[ -z "$service_username" ]] || [[ -z "$service_password" ]] ||
117 [[ -z "$service_tenant" ]] && juju-log "keystone_changed: Peer not ready" &&
118 exit 0
119-
120- service_host=$(relation-get service_host)
121- auth_host=$(relation-get auth_host)
122-
123 # update keystone authtoken settings accordingly
124 set_or_update "service_host" "$service_host" "$API_CONF"
125 set_or_update "service_port" "$service_port" "$API_CONF"
126@@ -146,9 +156,13 @@
127 }
128
129 function ceph_changed {
130+ local r_id="$1"
131+ local unit_id="$2"
132+ local r_arg=""
133+ [[ -n "$r_id" ]] && r_arg="-r $r_id"
134 SERVICE_NAME=`echo $JUJU_UNIT_NAME | cut -d / -f 1`
135 KEYRING=/etc/ceph/ceph.client.$SERVICE_NAME.keyring
136- KEY=`relation-get key`
137+ KEY=`relation-get $r_arg key $unit_id`
138 if [ -n "$KEY" ]; then
139 # But only once
140 if [ ! -f $KEYRING ]; then
141@@ -162,14 +176,14 @@
142 exit 0
143 fi
144
145- MONS=`relation-list`
146+ MONS=`relation-list $r_arg`
147 mon_hosts=""
148 for mon in $MONS; do
149- mon_hosts="$mon_hosts $(get_ip $(relation-get private-address $mon)):6789"
150+ mon_hosts="$mon_hosts $(get_ip $(relation-get $r_arg private-address $mon)):6789"
151 done
152 cat > /etc/ceph/ceph.conf << EOF
153 [global]
154- auth supported = $(relation-get auth)
155+ auth supported = $(relation-get $r_id auth $unit_id)
156 keyring = /etc/ceph/\$cluster.\$name.keyring
157 mon host = $mon_hosts
158 EOF
159@@ -270,6 +284,17 @@
160 }
161
162 function config_changed() {
163+ # possibly upgrade if openstack-origin has been bumped
164+ local install_src=$(config-get openstack-origin)
165+ local cur=$(get_os_codename_package "cinder-common")
166+ local available=$(get_os_codename_install_source "$install_src")
167+ if dpkg --compare-versions $(get_os_version_codename "$cur") lt \
168+ $(get_os_version_codename "$available") ; then
169+ juju-log "$CHARM: Upgrading OpenStack release: $cur -> $available."
170+ # need to explicitly upgrade ksc b/c (LP: 1182689)
171+ do_openstack_upgrade "$install_src" $(determine_packages) python-keystoneclient
172+ fi
173+
174 configure_https
175 # Save our scriptrc env variables for health checks
176 declare -a env_vars=(
177
178=== modified file 'revision'
179--- revision 2013-05-20 10:29:08 +0000
180+++ revision 2013-05-24 18:35:30 +0000
181@@ -1,1 +1,1 @@
182-26
183+27

Subscribers

People subscribed via source and target branches