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

Proposed by Adam Gandelman
Status: Merged
Merged at revision: 69
Proposed branch: lp:~gandelman-a/charms/precise/nova-cloud-controller/avoid_restarts
Merge into: lp:~openstack-charmers/charms/precise/nova-cloud-controller/ha-support
Diff against target: 109 lines (+21/-5)
7 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-cloud-controller-relations (+2/-3)
revision (+1/-1)
To merge this branch: bzr merge lp:~gandelman-a/charms/precise/nova-cloud-controller/avoid_restarts
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+157479@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-22 00:53:54 +0000
3+++ hooks/lib/nova/essex 2013-04-05 20:55:28 +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-22 00:53:54 +0000
13+++ hooks/lib/nova/folsom 2013-04-05 20:55:28 +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:53:54 +0000
25+++ hooks/lib/nova/grizzly 2013-04-05 20:55:28 +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:24:04 +0000
37+++ hooks/lib/nova/nova-common 2013-04-05 20:55:28 +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-19 22:41:03 +0000
50+++ hooks/lib/openstack-common 2013-04-05 20:55:28 +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-cloud-controller-relations'
86--- hooks/nova-cloud-controller-relations 2013-03-20 23:24:35 +0000
87+++ hooks/nova-cloud-controller-relations 2013-04-05 20:55:28 +0000
88@@ -183,12 +183,11 @@
89 set_or_update sql_connection "mysql://quantum:$quantum_db_password@$db_host/quantum?charset=utf8" \
90 $QUANTUM_PLUGIN_CONF "DATABASE"
91 fi
92- determine_services
93- service_ctl all stop
94
95 eligible_leader 'res_nova_vip' && /usr/bin/nova-manage db sync
96
97- service_ctl all start
98+ determine_services
99+ service_ctl all restart
100
101 if [ "$NET_MANAGER" == "Quantum" ]; then
102 configure_quantum_networking
103
104=== modified file 'revision'
105--- revision 2013-03-20 23:24:35 +0000
106+++ revision 2013-04-05 20:55:28 +0000
107@@ -1,1 +1,1 @@
108-240
109+261

Subscribers

People subscribed via source and target branches