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

Proposed by Adam Gandelman
Status: Merged
Merged at revision: 44
Proposed branch: lp:~gandelman-a/charms/precise/cinder/avoid_restarts
Merge into: lp:~openstack-charmers/charms/precise/cinder/ha-support
Diff against target: 100 lines (+20/-14)
4 files modified
hooks/cinder-common (+5/-10)
hooks/cinder-hooks (+1/-2)
hooks/lib/openstack-common (+13/-1)
revision (+1/-1)
To merge this branch: bzr merge lp:~gandelman-a/charms/precise/cinder/avoid_restarts
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+157480@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 'hooks/cinder-common'
2--- hooks/cinder-common 2013-02-20 01:42:47 +0000
3+++ hooks/cinder-common 2013-04-05 20:55:29 +0000
4@@ -10,6 +10,8 @@
5 CINDER_CONF="/etc/cinder/cinder.conf"
6 API_CONF="/etc/cinder/api-paste.ini"
7
8+CONFIG_CHANGED="False"
9+
10 if [[ -e $CHARM_DIR/lib/openstack-common ]] ; then
11 . $CHARM_DIR/lib/openstack-common
12 else
13@@ -77,6 +79,7 @@
14 juju-log "cinder: Setting new option $KEY=$VALUE in $CONF_FILE"
15 echo "$out$VALUE" >>$CONF_FILE
16 fi
17+ CONFIG_CHANGED="True"
18 }
19
20 cinder_ctl() {
21@@ -90,16 +93,8 @@
22 else
23 svcs=$svc
24 fi
25- for s in $svcs ; do
26- case "$action" in
27- "start")
28- service_ctl_status $s || service $s start ;;
29- "stop")
30- service_ctl_status $s && service $s stop || return 0 ;;
31- "restart")
32- service_ctl_status $s && service $s restart || service $s start ;;
33- esac
34- done
35+ SERVICES=$svcs
36+ service_ctl all $action
37 }
38
39 clean_storage() {
40
41=== modified file 'hooks/cinder-hooks'
42--- hooks/cinder-hooks 2013-03-27 14:56:53 +0000
43+++ hooks/cinder-hooks 2013-04-05 20:55:29 +0000
44@@ -56,11 +56,10 @@
45 cinder_db=$(config-get cinder-db)
46 juju-log "cinder: Configuring cinder for database access to $cinder_db@$db_host"
47 set_or_update sql_connection "mysql://$db_user:$db_password@$db_host/$cinder_db"
48- cinder_ctl all stop
49 if eligible_leader 'res_cinder_vip'; then
50 /usr/bin/cinder-manage db sync
51 fi
52- cinder_ctl all start
53+ cinder_ctl all restart
54 }
55
56 amqp_joined() {
57
58=== modified file 'hooks/lib/openstack-common'
59--- hooks/lib/openstack-common 2013-03-15 19:08:12 +0000
60+++ hooks/lib/openstack-common 2013-04-05 20:55:29 +0000
61@@ -20,6 +20,9 @@
62
63 function service_ctl {
64 # control a specific service, or all (as defined by $SERVICES)
65+ # service restarts will only occur depending on global $CONFIG_CHANGED,
66+ # which should be updated in charm's set_or_update().
67+ local config_changed=${CONFIG_CHANGED:-True}
68 if [[ $1 == "all" ]] ; then
69 ctl="$SERVICES"
70 else
71@@ -37,12 +40,21 @@
72 "stop")
73 service_ctl_status $i && service $i stop || return 0 ;;
74 "restart")
75- service_ctl_status $i && service $i restart || service $i start ;;
76+ if [[ "$config_changed" == "True" ]] ; then
77+ service_ctl_status $i && service $i restart || service $i start
78+ fi
79+ ;;
80 esac
81 if [[ $? != 0 ]] ; then
82 juju-log "$CHARM: service_ctl ERROR - Service $i failed to $action"
83 fi
84 done
85+ # all configs should have been reloaded on restart of all services, reset
86+ # flag if its being used.
87+ if [[ "$action" == "restart" ]] && [[ -n "$CONFIG_CHANGED" ]] &&
88+ [[ "$ctl" == "all" ]]; then
89+ CONFIG_CHANGED="False"
90+ fi
91 }
92
93 function configure_install_source {
94
95=== modified file 'revision'
96--- revision 2013-03-27 14:56:53 +0000
97+++ revision 2013-04-05 20:55:29 +0000
98@@ -1,1 +1,1 @@
99-23
100+25

Subscribers

People subscribed via source and target branches