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

Proposed by Adam Gandelman
Status: Merged
Merged at revision: 55
Proposed branch: lp:~gandelman-a/charms/precise/nova-compute/avoid_restarts
Merge into: lp:~openstack-charmers/charms/precise/nova-compute/ha-support
Diff against target: 146 lines (+38/-13)
8 files modified
hooks/lib/nova/essex (+1/-0)
hooks/lib/nova/folsom (+1/-0)
hooks/lib/nova/grizzly (+1/-0)
hooks/lib/nova/nova-common (+2/-0)
hooks/lib/openstack-common (+13/-1)
hooks/nova-compute-common (+2/-0)
hooks/nova-compute-relations (+17/-11)
revision (+1/-1)
To merge this branch: bzr merge lp:~gandelman-a/charms/precise/nova-compute/avoid_restarts
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+157483@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/lib/nova/essex'
2--- hooks/lib/nova/essex 2012-12-17 23:27:41 +0000
3+++ hooks/lib/nova/essex 2013-04-05 20:56:24 +0000
4@@ -39,4 +39,5 @@
5 juju-log "$CHARM: Setting new option $key=$value in $conf_file"
6 echo "$out$value" >>$conf_file
7 fi
8+ CONFIG_CHANGED=True
9 }
10
11=== modified file 'hooks/lib/nova/folsom'
12--- hooks/lib/nova/folsom 2012-12-17 23:45:59 +0000
13+++ hooks/lib/nova/folsom 2013-04-05 20:56:24 +0000
14@@ -62,6 +62,7 @@
15 fi
16 ;;
17 esac
18+ CONFIG_CHANGED="True"
19 }
20
21 # Upgrade Helpers
22
23=== modified file 'hooks/lib/nova/grizzly'
24--- hooks/lib/nova/grizzly 2012-12-22 00:55:24 +0000
25+++ hooks/lib/nova/grizzly 2013-04-05 20:56:24 +0000
26@@ -63,6 +63,7 @@
27 fi
28 ;;
29 esac
30+ CONFIG_CHANGED="True"
31 }
32
33 # Upgrade Helpers
34
35=== modified file 'hooks/lib/nova/nova-common'
36--- hooks/lib/nova/nova-common 2013-01-08 23:25:48 +0000
37+++ hooks/lib/nova/nova-common 2013-04-05 20:56:24 +0000
38@@ -2,6 +2,8 @@
39
40 # Common utility functions used across all nova charms.
41
42+CONFIG_CHANGED=False
43+
44 # Load the common OpenStack helper library.
45 if [[ -e $CHARM_DIR/lib/openstack-common ]] ; then
46 . $CHARM_DIR/lib/openstack-common
47
48=== modified file 'hooks/lib/openstack-common'
49--- hooks/lib/openstack-common 2013-03-15 19:08:54 +0000
50+++ hooks/lib/openstack-common 2013-04-05 20:56:24 +0000
51@@ -20,6 +20,9 @@
52
53 function service_ctl {
54 # control a specific service, or all (as defined by $SERVICES)
55+ # service restarts will only occur depending on global $CONFIG_CHANGED,
56+ # which should be updated in charm's set_or_update().
57+ local config_changed=${CONFIG_CHANGED:-True}
58 if [[ $1 == "all" ]] ; then
59 ctl="$SERVICES"
60 else
61@@ -37,12 +40,21 @@
62 "stop")
63 service_ctl_status $i && service $i stop || return 0 ;;
64 "restart")
65- service_ctl_status $i && service $i restart || service $i start ;;
66+ if [[ "$config_changed" == "True" ]] ; then
67+ service_ctl_status $i && service $i restart || service $i start
68+ fi
69+ ;;
70 esac
71 if [[ $? != 0 ]] ; then
72 juju-log "$CHARM: service_ctl ERROR - Service $i failed to $action"
73 fi
74 done
75+ # all configs should have been reloaded on restart of all services, reset
76+ # flag if its being used.
77+ if [[ "$action" == "restart" ]] && [[ -n "$CONFIG_CHANGED" ]] &&
78+ [[ "$ctl" == "all" ]]; then
79+ CONFIG_CHANGED="False"
80+ fi
81 }
82
83 function configure_install_source {
84
85=== modified file 'hooks/nova-compute-common'
86--- hooks/nova-compute-common 2013-03-25 16:23:50 +0000
87+++ hooks/nova-compute-common 2013-04-05 20:56:24 +0000
88@@ -124,6 +124,8 @@
89 local keystone_host=$(relation-get keystone_host)
90 [[ -z $keystone_host ]] && juju-log "nova-compute: Missing keystone host" \
91 && exit 0
92+ # XXX(adam_g): Need to check for unset values here, otherwise it errors
93+ # if nova-c-c<->nova-compute is made before keystone<->nova-c-c
94 set_or_update "network_api_class" "nova.network.quantumv2.api.API"
95 set_or_update "quantum_auth_strategy" "keystone"
96 set_or_update "quantum_url" "$(relation-get quantum_url)"
97
98=== modified file 'hooks/nova-compute-relations'
99--- hooks/nova-compute-relations 2013-04-04 20:48:36 +0000
100+++ hooks/nova-compute-relations 2013-04-05 20:56:24 +0000
101@@ -178,21 +178,27 @@
102 done
103 # Rabbit MQ relation may also already be in place
104 # shared vhost with nova so just grab settings and
105- # configure
106+ # configure. need to be sure to use VIP if clustered.
107+ local rabbit_clustered="" rabbit_vip="" rabbit_host="" rabbit_password=""
108 r_ids="$(relation-ids amqp)"
109 for id in $r_ids ; do
110 for unit in $(relation-list -r $id) ; do
111- local rabbit_host=$(relation-get -r $id private-address $unit)
112- local rabbit_password=$(relation-get -r $id password $unit)
113- if [[ -n $rabbit_host ]] && \
114- [[ -n $rabbit_password ]]; then
115- set_or_update rabbit_host "$rabbit_host" "$QUANTUM_CONF"
116- set_or_update rabbit_userid "$(config-get rabbit-user)" "$QUANTUM_CONF"
117- set_or_update rabbit_password "$rabbit_password" "$QUANTUM_CONF"
118- set_or_update rabbit_virtual_host "$(config-get rabbit-vhost)" "$QUANTUM_CONF"
119- fi
120- done
121+ rabbit_clustered=$(relation-get -r $id clustered $unit)
122+ rabbit_vip=$(relation-get -r $id vip $unit)
123+ rabbit_host=$(relation-get -r $id private-address $unit)
124+ rabbit_password=$(relation-get -r $id password $unit)
125+ done
126 done
127+ if [[ -n "$rabbit_clustered" ]] ; then
128+ rabbit_host="$rabbit_vip"
129+ fi
130+ if [[ -n $rabbit_host ]] && \
131+ [[ -n $rabbit_password ]]; then
132+ set_or_update rabbit_host "$rabbit_host" "$QUANTUM_CONF"
133+ set_or_update rabbit_userid "$(config-get rabbit-user)" "$QUANTUM_CONF"
134+ set_or_update rabbit_password "$rabbit_password" "$QUANTUM_CONF"
135+ set_or_update rabbit_virtual_host "$(config-get rabbit-vhost)" "$QUANTUM_CONF"
136+ fi
137 else
138 configure_network_manager "$network_manager"
139 fi
140
141=== modified file 'revision'
142--- revision 2013-04-04 20:48:36 +0000
143+++ revision 2013-04-05 20:56:24 +0000
144@@ -1,1 +1,1 @@
145-88
146+89

Subscribers

People subscribed via source and target branches