Merge lp:~aglenyoung/charms/precise/nova-cloud-controller/configurable-multi_host into lp:~charmers/charms/precise/nova-cloud-controller/trunk

Proposed by Andrew Glen-Young
Status: Rejected
Rejected by: James Page
Proposed branch: lp:~aglenyoung/charms/precise/nova-cloud-controller/configurable-multi_host
Merge into: lp:~charmers/charms/precise/nova-cloud-controller/trunk
Diff against target: 202 lines (+116/-2)
6 files modified
config.yaml (+34/-0)
hooks/lib/nova/nova-common (+21/-0)
hooks/lib/openstack-common (+3/-0)
hooks/nova-cloud-controller-common (+2/-2)
hooks/nova-cloud-controller-relations (+53/-0)
metadata.yaml (+3/-0)
To merge this branch: bzr merge lp:~aglenyoung/charms/precise/nova-cloud-controller/configurable-multi_host
Reviewer Review Type Date Requested Status
Adam Gandelman (community) Needs Fixing
Review via email: mp+151111@code.launchpad.net

Description of the change

Add options for multi_host which requires the cloud-controller to run nova-network.
Create nova networks automatically if FlatManager or FlatDHCPManager is used.
Add config options to support nrpe-external-master subordinate.

To post a comment you must log in.
Revision history for this message
Adam Gandelman (gandelman-a) wrote :

Hey Andrew-

Some comments:

- I'd prefer if nova-network were not configured by default, and instead enabled by a config option (similar to conf-ext-net for quantum)

- It would be cool if we could not have nova-api-metadata in list of SERVICES by default, and only have it added when non-multi_host nova-network is configured. Also, if nova-network were added to SERVICES as well, you could avoid the special case in lib/openstack-common.service_ctl().

- I'd prefer if the bits that do the network configuration move to their own function somewhere in hooks/nova-cloud-controller-common. This will make it easier to merge with some big changes were working on elsewhere [1]. Similar to configure_quantum_netowrking().

[1] https://code.launchpad.net/~openstack-charmers/charms/precise/nova-cloud-controller/ha-support

review: Needs Fixing

Unmerged revisions

49. By Andrew Glen-Young

Make multi_host configurable, automatically create floating and fixed ip ranges.
Add support for nrpe-external-master subordinate charm.

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 2012-12-03 15:06:35 +0000
3+++ config.yaml 2013-02-28 21:47:21 +0000
4@@ -104,3 +104,37 @@
5 default: None
6 type: string
7 description: Comma separated list of key=value config flags to be set in nova.conf.
8+ nova-network-name:
9+ default: nova
10+ type: string
11+ description: Name of the nova-network network
12+ nova-fixed-range:
13+ default: 172.16.0.0/24
14+ type: string
15+ description: Fixed IPv4 address range in CIDR format
16+ nova-floating-range:
17+ default: 172.16.1.0/24
18+ type: string
19+ description: Floating IPv4 address range in CIDR format
20+ nova-public-interface:
21+ default: eth0
22+ type: string
23+ description: Name of the network interface for public/floating IP addresses
24+ nova-flat-interface:
25+ default: eth0
26+ type: string
27+ description: Name of the network interface for flat/fixed IP addresses
28+ nova-multi-host:
29+ default: "yes"
30+ type: string
31+ description: Whether to use Vishy-HA.
32+ nagios_context:
33+ default: "juju"
34+ type: string
35+ description: |
36+ Used by the nrpe-external-master subordinate charm.
37+ A string that will be prepended to instance name to set the host name
38+ in nagios. So for instance the hostname would be something like:
39+ juju-myservice-0
40+ If you're running multiple environments with the same services in them
41+ this allows you to differentiate between them.
42
43=== modified file 'hooks/lib/nova/nova-common'
44--- hooks/lib/nova/nova-common 2012-12-06 21:32:44 +0000
45+++ hooks/lib/nova/nova-common 2013-02-28 21:47:21 +0000
46@@ -42,13 +42,29 @@
47
48 function configure_network_manager {
49 local manager="$1"
50+ local bridge_interface=$(config-get bridge-interface)
51+ local multi_host=$(config-get nova-multi-host)
52 echo "$CHARM: configuring $manager network manager"
53 case $1 in
54 "FlatManager")
55 set_or_update "network_manager" "nova.network.manager.FlatManager"
56+ if [[ -n "$bridge_interface" && "$multi_host" == "no" ]] ; then
57+ set_or_update "flat_network_bridge" "$bridge_interface"
58+ DEBIAN_FRONTEND=noninteractive apt-get -y install nova-network
59+ fi
60+ if [[ "$multi_host" == "yes" ]] ; then
61+ set_or_update "multi_host" "True"
62+ fi
63 ;;
64 "FlatDHCPManager")
65 set_or_update "network_manager" "nova.network.manager.FlatDHCPManager"
66+ if [[ -n "$bridge_interface" && "$multi_host" == "no" ]] ; then
67+ set_or_update "flat_network_bridge" "$bridge_interface"
68+ DEBIAN_FRONTEND=noninteractive apt-get -y install nova-network
69+ fi
70+ if [[ "$multi_host" == "yes" ]] ; then
71+ set_or_update "multi_host" "True"
72+ fi
73 ;;
74 "Quantum")
75 local local_ip=$(get_ip `unit-get private-address`)
76@@ -118,3 +134,8 @@
77 nova_post_upgrade "$orig_os_rel"
78
79 }
80+
81+function get_network_size() {
82+ local network=$1
83+ python -c "import ipaddr; print int(ipaddr.IPv4Network('$network').numhosts)"
84+}
85
86=== modified file 'hooks/lib/openstack-common'
87--- hooks/lib/openstack-common 2012-12-06 10:20:34 +0000
88+++ hooks/lib/openstack-common 2013-02-28 21:47:21 +0000
89@@ -21,6 +21,9 @@
90 function service_ctl {
91 # control a specific service, or all (as defined by $SERVICES)
92 if [[ $1 == "all" ]] ; then
93+ if dpkg -l | grep --quiet '^[hi]i\s*nova-network'; then
94+ SERVICES="$SERVICES nova-network"
95+ fi
96 ctl="$SERVICES"
97 else
98 ctl="$1"
99
100=== modified file 'hooks/nova-cloud-controller-common'
101--- hooks/nova-cloud-controller-common 2012-12-03 11:17:36 +0000
102+++ hooks/nova-cloud-controller-common 2013-02-28 21:47:21 +0000
103@@ -3,7 +3,7 @@
104 CHARM="nova-cloud-controller"
105 CONF_DIR="/etc/nova"
106
107-SERVICES="nova-api-ec2 nova-api-os-compute nova-objectstore nova-cert nova-scheduler"
108+SERVICES="nova-api-ec2 nova-api-os-compute nova-objectstore nova-cert nova-scheduler nova-api-metadata"
109
110 # If we have a relation to nova-volume-service, we'll also manage its API
111 # endpoint here.
112@@ -13,7 +13,7 @@
113 dpkg -l | grep -q nova-api-os-volume || apt-get -y install nova-api-os-volume
114 fi
115
116-PACKAGES="$SERVICES python-mysqldb python-keystone uuid"
117+PACKAGES="$SERVICES python-mysqldb python-keystone uuid python-ipaddr"
118
119 NET_MANAGER=$(config-get network-manager)
120 if [ "$NET_MANAGER" == "Quantum" ]; then
121
122=== modified file 'hooks/nova-cloud-controller-relations'
123--- hooks/nova-cloud-controller-relations 2012-12-05 11:44:02 +0000
124+++ hooks/nova-cloud-controller-relations 2013-02-28 21:47:21 +0000
125@@ -10,6 +10,8 @@
126 fi
127
128 function install_hook {
129+ [[ -d exec.d ]] && ( for f in exec.d/*/charm-pre-install; do [[ -x $f ]] && $SHELL -c "$f";done )
130+
131 juju-log "$CHARM: Installing nova packages"
132 apt-get -y install python-software-properties || exit 1
133 configure_install_source "$(config-get openstack-origin)"
134@@ -149,6 +151,57 @@
135 fi
136 service_ctl all stop
137 /usr/bin/nova-manage db sync
138+
139+ local multi_host=$(config-get nova-multi-host)
140+
141+ # Quantum has it's own DB and networking config.
142+ if [[ "$NET_MANAGER" != "Quantum" ]] ; then
143+ # We set up nova-networking here after the intial database has been
144+ # initialized.
145+ # TODO:
146+ # - IPv6 support.
147+ # - Support more than one network.
148+ local network_name=$(config-get nova-network-name)
149+ local fixed_range=$(config-get nova-fixed-range)
150+ local floating_range=$(config-get nova-floating-range)
151+ local bridge_interface=$(config-get bridge-interface)
152+ local flat_interface=$(config-get nova-flat-interface)
153+ local public_interface=$(config-get nova-public-interface)
154+ local floating_interface="--interface=$public_interface"
155+ local network_size=$(get_network_size $fixed_range)
156+
157+ set_or_update fixed_range $fixed_range
158+ set_or_update floating_range $floating_range
159+ set_or_update flat_interface $flat_interface
160+ set_or_update public_interface $public_interface
161+
162+ # The nova-manage network and floating commands are not idempotent.
163+ if [[ ! -e /var/lib/nova/juju-fixed-network ]] ; then
164+ nova-manage network create --label=$network_name \
165+ --fixed_range_v4=$fixed_range --num_networks=1 \
166+ --bridge=$bridge_interface --network_size=$network_size
167+ echo $fixed_range > /var/lib/nova/juju-fixed-network
168+ fi
169+
170+ if [[ ! -e /var/lib/nova/juju-floating-network ]] ; then
171+ nova-manage floating create --ip_range=$floating_range \
172+ --pool=$network_name $floating_interface
173+ echo $floating_range > /var/lib/nova/juju-floating-network
174+ fi
175+
176+ # If the IP address interfaces are different, we need to enable forwarding
177+ # between them.
178+ if [[ -n "$public_interface" ]] && [[ -n "$flat_interface" ]] && \
179+ [[ "$public_interface" != "$flat_interface" ]] ; then
180+ if [[ -d /etc/sysctl.d ]] ; then
181+ echo 'net.ipv4.ip_forward = 1' > /etc/sysctl.d/60-ip_forward.conf
182+ else
183+ echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
184+ fi
185+ /sbin/sysctl -w net.ipv4.ip_forward=1
186+ fi
187+ fi
188+
189 service_ctl all start
190 if [ "$NET_MANAGER" == "Quantum" ]; then
191 configure_quantum_networking
192
193=== modified file 'metadata.yaml'
194--- metadata.yaml 2012-12-03 15:41:33 +0000
195+++ metadata.yaml 2013-02-28 21:47:21 +0000
196@@ -24,3 +24,6 @@
197 interface: nova-volume
198 quantum-network-service:
199 interface: quantum
200+ nrpe-external-master:
201+ interface: nrpe-external-master
202+ scope: container

Subscribers

People subscribed via source and target branches