Configure network bridge. image-service + nova-network relations
This commit is contained in:
parent
91383339a1
commit
ae0d911110
1
hooks/image-service-relation-changed
Symbolic link
1
hooks/image-service-relation-changed
Symbolic link
@ -0,0 +1 @@
|
||||
nova-compute-relations
|
1
hooks/image-service-relation-joined
Symbolic link
1
hooks/image-service-relation-joined
Symbolic link
@ -0,0 +1 @@
|
||||
nova-compute-relations
|
@ -4,6 +4,11 @@ NOVA_CONF="/etc/nova/nova.conf"
|
||||
RABBIT_USER="nova-compute"
|
||||
DB_USER="nova"
|
||||
NOVA_DB="nova"
|
||||
|
||||
NETWORK_MANAGER="FlatManager"
|
||||
NETWORK_BRIDGE="br100"
|
||||
BRIDGE_IP="11.0.0.2"
|
||||
|
||||
DEFAULT_ETH=$(ip route | grep default | awk '{ print $5 }')
|
||||
IP=$(ifconfig $DEFAULT_ETH | grep 'inet addr' | awk '{ print $2 }' | cut -d: -f2)
|
||||
|
||||
@ -41,3 +46,43 @@ function nova_ctl {
|
||||
done
|
||||
}
|
||||
|
||||
function setup_bridge {
|
||||
# XXX This is required by nova-network and will likely move somewhere else
|
||||
# once we can split these services up into seperate formulas.
|
||||
br=$1
|
||||
ip=$2
|
||||
netmask=$3
|
||||
[[ -z $br ]] && br="br100"
|
||||
[[ -z $ip ]] && ip="11.0.0.1"
|
||||
[[ -z $netmask ]] && netmask="255.255.255.0"
|
||||
|
||||
apt-get -y install bridge-utils augeas-lenses augeas-tools
|
||||
echo "Configuring bridge $br ($ip $netmask)"
|
||||
context="/files/etc/network/interfaces"
|
||||
augtool <<EOF
|
||||
set $context/auto[child::1 = "$br"]/1 $br
|
||||
set $context/iface[. = '$br'] $br
|
||||
set $context/iface[. = '$br']/family inet
|
||||
set $context/iface[. = '$br']/method static
|
||||
set $context/iface[. = '$br']/address $ip
|
||||
set $context/iface[. = '$br']/netmask $netmask
|
||||
set $context/iface[. = '$br']/bridge_ports none
|
||||
save
|
||||
EOF
|
||||
ifdown -a ; ifup -a
|
||||
}
|
||||
|
||||
function configure_network_manager {
|
||||
# needed by the nova-network bits
|
||||
# to be expanded later to cover flatDhcp and VLAN
|
||||
echo "$0: configuring $1 network manager"
|
||||
case $1 in
|
||||
"FlatManager")
|
||||
setup_bridge $NETWORK_BRIDGE $BRIDGE_IP $BRIDGE_NETMASK
|
||||
set_or_update network_manager nova.network.manager.FlatManager
|
||||
set_or_update flat_network_bridge $NETWORK_BRIDGE
|
||||
;;
|
||||
*) echo "ERROR: Invalid network manager $1" && exit 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -58,9 +58,29 @@ function db_changed {
|
||||
nova_ctl all restart
|
||||
}
|
||||
|
||||
function nova-network_changed {
|
||||
MANAGER=`relation-get network_manager`
|
||||
if [[ -z $MANAGER ]] ; then
|
||||
echo "nova-network_changed: MANAGER not yet set. Exit 0 and retry"
|
||||
exit 0
|
||||
fi
|
||||
configure_network_manager $MANAGER
|
||||
}
|
||||
|
||||
function image-service_changed {
|
||||
GLANCE_API_SERVER=`relation-get glance-api-server`
|
||||
if [[ -z $GLANCE_API_SERVER ]] ; then
|
||||
echo "image-service_changed: GLANCE_API_SERVER not yet set. Exit 0 and retry"
|
||||
exit 0
|
||||
fi
|
||||
set_or_update glance_api_servers $GLANCE_API_SERVER
|
||||
nova_ctl all restart
|
||||
}
|
||||
|
||||
function cc_joined {
|
||||
relation-set nova-api-server=$IP
|
||||
}
|
||||
|
||||
case $ARG0 in
|
||||
"install") install_hook ;;
|
||||
"start"|"stop") exit 0 ;;
|
||||
@ -68,6 +88,10 @@ case $ARG0 in
|
||||
"amqp-relation-changed") amqp_changed ;;
|
||||
"shared-db-relation-joined") db_joined ;;
|
||||
"shared-db-relation-changed") db_changed ;;
|
||||
"nova-network-relation-joined") exit 0 ;;
|
||||
"nova-network-relation-changed") nova-network_changed ;;
|
||||
"image-service-relation-joined") exit 0 ;;
|
||||
"image-service-relation-changed") image-service_changed ;;
|
||||
esac
|
||||
|
||||
|
||||
|
1
hooks/nova-network-relation-changed
Symbolic link
1
hooks/nova-network-relation-changed
Symbolic link
@ -0,0 +1 @@
|
||||
nova-compute-relations
|
1
hooks/nova-network-relation-joined
Symbolic link
1
hooks/nova-network-relation-joined
Symbolic link
@ -0,0 +1 @@
|
||||
nova-compute-relations
|
@ -1,6 +1,6 @@
|
||||
ensemble: formula
|
||||
name: nova-compute
|
||||
revision: 5
|
||||
revision: 10
|
||||
summary: "OpenStack compute"
|
||||
description: |
|
||||
OpenStack Compute, codenamed Nova, is a cloud computing fabric controller. In
|
||||
@ -18,3 +18,5 @@ requires:
|
||||
interface: glance
|
||||
cloud-controller:
|
||||
interface: nova
|
||||
nova-network:
|
||||
interface: nova
|
||||
|
Loading…
x
Reference in New Issue
Block a user