Skip to content

Commit

Permalink
Fixes to flat networking: basically allow the demo to use a flat netw…
Browse files Browse the repository at this point in the history
…ork in eth3 subnet, so we can get to internet stuff from a guest
  • Loading branch information
uksysadmin committed Jan 10, 2016
1 parent 4809d40 commit 9524e39
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 9 deletions.
13 changes: 8 additions & 5 deletions compute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ EOF

cat > ${NEUTRON_PLUGIN_ML2_CONF_INI} << EOF
[ml2]
type_drivers = gre,vxlan
type_drivers = gre,vxlan,flat
tenant_network_types = vxlan
mechanism_drivers = openvswitch,l2population
Expand All @@ -213,6 +213,9 @@ tunnel_id_ranges = 1:1000
[ml2_type_vxlan]
vni_ranges = 1:1000
[ml2_tyep_flat]
flat_networks = eth3
#[vxlan]
#enable_vxlan = True
#vxlan_group =
Expand Down Expand Up @@ -413,10 +416,10 @@ start neutron-l3-agent

# Because live-migration
# Do some terrible things for GID/UID mapping on compute nodes:
UID=`ssh root@controller "id nova | awk {'print $1'} | cut -d '=' -f2 | cut -d '(' -f1"`
GID=`ssh root@controller "id nova | awk {'print $1'} | cut -d '=' -f2 | cut -d '(' -f1"`
sudo usermod -u $UID nova
sudo groupmod -g $GID nova
_UID=`ssh root@controller "id nova | awk {'print $1'} | cut -d '=' -f2 | cut -d '(' -f1"`
_GID=`ssh root@controller "id nova | awk {'print $1'} | cut -d '=' -f2 | cut -d '(' -f1"`
sudo usermod -u $_UID nova
sudo groupmod -g $_GID nova

# Logging
sudo stop rsyslog
Expand Down
5 changes: 4 additions & 1 deletion controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ EOF

cat > ${NEUTRON_PLUGIN_ML2_CONF_INI} <<EOF
[ml2]
type_drivers = vxlan,gre
type_drivers = vxlan,gre,flat
tenant_network_types = vxlan
mechanism_drivers = openvswitch,l2population
Expand All @@ -658,6 +658,9 @@ tunnel_id_ranges = 1:1000
vxlan_group =
vni_ranges = 1:1000
[ml2_type_flat]
flat_networks = eth3
[vxlan]
enable_vxlan = True
vxlan_group =
Expand Down
34 changes: 31 additions & 3 deletions demo.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
#!/bin/sh

# This scripts assumes *a lot*
# Run it once, as soon as you've booted the vagrant environment:

# vagrant up
# vagrant ssh controller
# /vagrant/demo.sh

# Yes, that's it!

# Crude lock to prevent multiple runs
if [[ -f ~/.demo.lock ]]
then
echo "~/.demo.lock in place. Already ran. Exiting."
exit 1
else
touch ~/.demo.lock
fi

export OS_TENANT_NAME=cookbook
export OS_USERNAME=admin
export OS_PASSWORD=openstack
Expand Down Expand Up @@ -60,13 +78,23 @@ UBUNTU=$(nova image-list \
| awk '/\ trusty/ {print $2}')

NET_ID=$(neutron net-list | awk '/cookbook_network_1/ {print $2}')
nova boot --flavor m1.tiny --block-device source=image,id=${UBUNTU},shutdown=preserve,dest=volume,size=15,bootindex=0 --key_name demokey --nic net-id=${NET_ID} --config-drive=true test1
#nova boot --flavor 1 --image ${UBUNTU} --key_name demokey --nic net-id=${NET_ID} test1

neutron net-create --tenant-id ${TENANT_ID} floatingNet --router:external=True
# If Cinder is available, boot from vol
if ping -c 1 cinder
then
nova boot --flavor m1.tiny --block-device source=image,id=${UBUNTU},shutdown=preserve,dest=volume,size=15,bootindex=0 --key_name demokey --nic net-id=${NET_ID} --config-drive=true CookbookInstance1
# Else ephemeral
else
nova boot --flavor 1 --image ${UBUNTU} --key_name demokey --nic net-id=${NET_ID} CookbookInstance1
fi

# Create an external network of type Flat (which goes out of eth3)
neutron net-create --tenant-id ${TENANT_ID} floatingNet --shared --provider:network_type flat --provider:physical_network eth3 --router:external=True

# Subnet matches subnet of eth3: 192.168.100.0/24, but we assign a small portion for floating IPs
neutron subnet-create --tenant-id ${TENANT_ID} --name cookbook_float_subnet_1 --allocation-pool start=192.168.100.10,end=192.168.100.20 --gateway 192.168.100.1 floatingNet 192.168.100.0/24 --enable_dhcp=False


ROUTER_ID=$(neutron router-list \
| awk '/\ cookbook_router_1\ / {print $2}')

Expand Down
3 changes: 3 additions & 0 deletions network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ tunnel_id_ranges = 1:1000
#vxlan_group =
vni_ranges = 1:1000
[ml2_type_flat]
flat_networks = eth3
#[vxlan]
#enable_vxlan = True
#vxlan_group =
Expand Down
1 change: 1 addition & 0 deletions rsyslog.conf

0 comments on commit 9524e39

Please sign in to comment.