Commit 684ff0f0 authored by David Johnson's avatar David Johnson

Add another data network.

parent 74eb450b
......@@ -84,7 +84,9 @@ EOM
#
# NOTE: we reduce the MTU arbitrarily here so that we can (easily) fit
# through a GRE tunnel.
# through a GRE tunnel. Also, add a second interface because our default
# config has two interfaces -- a GRE tunnel data net, and a flat data "control"
# net.
#
echo "*** adding networking for qemu ..."
{
......@@ -96,6 +98,10 @@ iface lo inet loopback
auto eth0
iface eth0 inet dhcp
post-up /sbin/ifconfig eth0 mtu 1300
auto eth1
iface eth1 inet dhcp
post-up /sbin/ifconfig eth1 mtu 1300
EOM
} | tee -a mnt/etc/network/interfaces >/dev/null
......@@ -126,13 +132,27 @@ glance image-update --property kernel_args="console=ttyAMA0 root=/dev/sda" ubunt
glance image-update --property kernel_id=${KERNEL_ID} ubuntu-core-14.04.1-core-arm64
glance image-update --property ramdisk_id=${RAMDISK_ID} ubuntu-core-14.04.1-core-arm64
echo "*** Creating data network and subnet ..."
echo "*** Creating GRE data network and subnet ..."
neutron net-create tun-data-net
neutron subnet-create tun-data-net --name tun-data-subnet 172.16/12
neutron router-create tun-data-router
neutron router-interface-add tun-data-router tun-data-subnet
neutron router-gateway-set tun-data-router ext-net
if [ ${SETUP_FLAT_DATA_NETWORK} -eq 1 ]; then
echo "*** Creating Flat data network and subnet ..."
neutron net-create ${EPID}-net
neutron subnet-create ${EPID}-net --name ${EPID}-subnet 172.16/12
neutron router-create ${EPID}-router
neutron router-interface-add ${EPID}-router ${EPID}-subnet
neutron router-gateway-set ${EPID}-router ext-net
nmdataip=`cat $OURDIR/data-hosts | grep networkmanager | sed -n -e 's/^\([0-9]*.[0-9]*.[0-9]*.[0-9]*\).*$/\1/p'`
neutron net-create flat-data-net --shared --router:external True --provider:physical_network data --provider:network_type flat
neutron subnet-create flat-data-net --name flat-data-subnet --allocation-pool start=10.254.1.1,end=10.254.254.254 --gateway $nmdataip 10.0.0.0/8
#neutron router-create ${EPID}-router
#neutron router-interface-add ${EPID}-router ${EPID}-subnet
#neutron router-gateway-set ${EPID}-router ext-net
fi
#
# Now do another one, with sshd installed
......
......@@ -28,7 +28,11 @@ if [ -f $SETTINGS ]; then
. $SETTINGS
fi
myip=`ip addr show ${DATA_NETWORK_INTERFACE} | sed -n -e 's/^.*inet \([0-9]*.[0-9]*.[0-9]*.[0-9]*\).*$/\1/p'`
if [ ${SETUP_FLAT_DATA_NETWORK} -eq 1 ]; then
myip=`ip addr show br-data | sed -n -e 's/^.*inet \([0-9]*.[0-9]*.[0-9]*.[0-9]*\).*$/\1/p'`
else
myip=`ip addr show ${DATA_NETWORK_INTERFACE} | sed -n -e 's/^.*inet \([0-9]*.[0-9]*.[0-9]*.[0-9]*\).*$/\1/p'`
fi
cat <<EOF >> /etc/sysctl.conf
net.ipv4.conf.all.rp_filter=0
......@@ -71,11 +75,11 @@ EOF
cat <<EOF >> /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
type_drivers = flat,gre
tenant_network_types = gre
tenant_network_types = flat,gre
mechanism_drivers = openvswitch
[ml2_type_flat]
flat_networks = external
flat_networks = external,data
[ml2_type_gre]
tunnel_id_ranges = 1:1000
......@@ -88,7 +92,7 @@ firewall_driver = neutron.agent.firewall.NoopFirewallDriver
[ovs]
local_ip = $myip
enable_tunneling = True
bridge_mappings = external:br-ex
bridge_mappings = external:br-ex,data:br-data
[agent]
tunnel_types = gre
......
......@@ -401,9 +401,12 @@ EOF
cat <<EOF >> /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
type_drivers = flat,gre
tenant_network_types = gre
tenant_network_types = flat,gre
mechanism_drivers = openvswitch
[ml2_type_flat]
flat_networks = external,data
[ml2_type_gre]
tunnel_id_ranges = 1:1000
......
......@@ -52,6 +52,7 @@ SETTINGS=$OURDIR/settings
mkdir -p $OURDIR
cd $OURDIR
SETUP_FLAT_DATA_NETWORK=1
USE_EXISTING_DATA_IPS=1
EXTERNAL_NETWORK_INTERFACE="eth0"
EXTERNAL_NETWORK_BRIDGE="br-ex"
......
......@@ -75,11 +75,11 @@ EOF
cat <<EOF >> /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
type_drivers = flat,gre
tenant_network_types = gre
tenant_network_types = flat,gre
mechanism_drivers = openvswitch
[ml2_type_flat]
flat_networks = external
flat_networks = external,data
[ml2_type_gre]
tunnel_id_ranges = 1:1000
......@@ -92,7 +92,7 @@ firewall_driver = neutron.agent.firewall.NoopFirewallDriver
[ovs]
local_ip = $dataip
enable_tunneling = True
bridge_mappings = external:br-ex
bridge_mappings = external:br-ex,data:br-data
[agent]
tunnel_types = gre
......
......@@ -87,25 +87,47 @@ route add default gw $mygw
service openvswitch-switch restart
#
# Setup the data network
# Make sure we have the integration bridge
#
ovs-vsctl add-br br-int
#ovs-vsctl add-port br-int ${DATA_NETWORK_INTERFACE}
if [ ${USE_EXISTING_DATA_IPS} -eq 0 ]; then
ifconfig ${DATA_NETWORK_INTERFACE} $dataip netmask 255.0.0.0 up
#
# (Maybe) Setup the data network
#
if [ ${SETUP_FLAT_DATA_NETWORK} -eq 1 ]; then
ovs-vsctl add-br br-data
ovs-vsctl add-port br-data ${DATA_NETWORK_INTERFACE}
ifconfig ${DATA_NETWORK_INTERFACE} 0 up
ifconfig br-data $dataip netmask 255.0.0.0 up
cat <<EOF >> /etc/network/interfaces
auto lo eth0 ${DATA_NETWORK_INTERFACE}
iface br-data inet static
address $dataip
netmask 255.0.0.0
iface ${DATA_NETWORK_INTERFACE} inet static
address 0.0.0.0
EOF
else
if [ ${USE_EXISTING_DATA_IPS} -eq 0 ]; then
ifconfig ${DATA_NETWORK_INTERFACE} $dataip netmask 255.0.0.0 up
cat <<EOF >> /etc/network/interfaces
auto lo eth0 ${DATA_NETWORK_INTERFACE}
iface ${DATA_NETWORK_INTERFACE} inet static
address $dataip
netmask 255.0.0.0
EOF
fi
fi
#service openvswitch-switch restart
service openvswitch-switch restart
ip route flush cache
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment