Skip to content

Commit

Permalink
On the road to Icehouse. Further work needed but nearly there.
Browse files Browse the repository at this point in the history
  • Loading branch information
uksysadmin committed Apr 22, 2014
1 parent a08afd4 commit 766751c
Show file tree
Hide file tree
Showing 13 changed files with 1,002 additions and 37 deletions.
6 changes: 4 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Vagrant.configure("2") do |config|
#config.proxy.no_proxy = "localhost,127.0.0.1"


config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.box = "trusty64"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"

#Default is 2200..something, but port 2200 is used by forescout NAC agent.
config.vm.usable_port_range= 2800..2900
Expand Down Expand Up @@ -58,11 +58,13 @@ Vagrant.configure("2") do |config|
if prefix == "compute"
vbox.customize ["modifyvm", :id, "--memory", 2048]
vbox.customize ["modifyvm", :id, "--cpus", 2]
vbox.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
vbox.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"]
elsif prefix == "controller"
vbox.customize ["modifyvm", :id, "--memory", 2048]
elsif prefix == "network"
vbox.customize ["modifyvm", :id, "--memory", 1024]
vbox.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
vbox.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"]
elsif prefix == "proxy"
vbox.customize ["modifyvm", :id, "--memory", 512]
Expand Down
1 change: 1 addition & 0 deletions ceilometer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ keystone service-create --name=ceilometer --type=metering --description="Ceilome
METERING_SERVICE_ID=$(keystone service-list | awk '/\ metering\ / {print $2}')

keystone endpoint-create \
--region regionOne \
--service-id=${METERING_SERVICE_ID} \
--publicurl=http://${CONTROLLER_HOST}:8777 \
--internalurl=http://${CONTROLLER_HOST}:8777 \
Expand Down
12 changes: 6 additions & 6 deletions common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ fi
sudo apt-get update
# Havana Goodness
sudo apt-get -y install ubuntu-cloud-keyring
H_SOURCES="/etc/apt/sources.list.d/havana.list"
if [[ ! -f ${H_SOURCES} ]]
then
echo "deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/havana main" | sudo tee -a ${H_SOURCES}
echo "deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-proposed/havana main" | sudo tee -a ${H_SOURCES}
fi
#H_SOURCES="/etc/apt/sources.list.d/havana.list"
#if [[ ! -f ${H_SOURCES} ]]
#then
# echo "deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/havana main" | sudo tee -a ${H_SOURCES}
# echo "deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-proposed/havana main" | sudo tee -a ${H_SOURCES}
#fi

sudo apt-get update && apt-get upgrade -y

Expand Down
1 change: 0 additions & 1 deletion compute.sh

This file was deleted.

242 changes: 242 additions & 0 deletions compute.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
#!/bin/bash

# compute.sh

# Authors: Kevin Jackson ([email protected])
# Cody Bunch ([email protected])

# Vagrant scripts used by the OpenStack Cloud Computing Cookbook, 2nd Edition, October 2013
# Website: http://www.openstackcookbook.com/
# Suitable for OpenStack Havana

# There are lots of bits adapted from:
# https://github.com/mseknibilel/OpenStack-Grizzly-Install-Guide/blob/OVS_MultiNode/OpenStack_Grizzly_Install_Guide.rst

# Source in common env vars
. /vagrant/common.sh

# The routeable IP of the node is on our eth1 interface
MY_IP=$(ifconfig eth1 | awk '/inet addr/ {split ($2,A,":"); print A[2]}')
ETH3_IP=$(ifconfig eth3 | awk '/inet addr/ {split ($2,A,":"); print A[2]}')

# Must define your environment
MYSQL_HOST=${CONTROLLER_HOST}
GLANCE_HOST=${CONTROLLER_HOST}

nova_compute_install() {

# Install some packages:
sudo apt-get -y install nova-api-metadata nova-compute nova-compute-qemu nova-doc novnc nova-novncproxy nova-consoleauth
sudo apt-get install -y vlan bridge-utils
sudo apt-get install -y libvirt-bin pm-utils sysfsutils
sudo service ntp restart
}

nova_configure() {

# Networking
# ip forwarding
sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
# To save you from rebooting, perform the following
sysctl net.ipv4.ip_forward=1
# Kill default bridge
virsh net-destroy default
virsh net-undefine default

# Enable Live migrate
#sudo sed -i 's/listen_tls = 0//g' /etc/libvirt/libvirt.conf
#listen_tcp = 1
#auth_tcp = "none"'

# Enable libvirtd_opts
# env libvirtd_opts="-d -l"
# /etc/default/libvirt-bin
#libvirtd_opts="-d -l"

# restart libvirt
sudo service libvirt-bin restart

# OpenVSwitch
sudo apt-get install -y linux-headers-`uname -r` build-essential
sudo apt-get install -y openvswitch-switch openvswitch-datapath-dkms

# Edit the /etc/network/interfaces file for eth2?
sudo ifconfig eth2 0.0.0.0 up
sudo ip link set eth2 promisc on

# OpenVSwitch Configuration
#br-int will be used for VM integration
sudo ovs-vsctl add-br br-int

sudo ovs-vsctl add-br br-ex
sudo ovs-vsctl add-port br-ex eth3

# Edit the /etc/network/interfaces file for eth3?
sudo ifconfig eth3 0.0.0.0 up
sudo ip link set eth3 promisc on
# Assign IP to br-ex so it is accessible
sudo ifconfig br-ex $ETH3_IP netmask 255.255.255.0

# Quantum
sudo apt-get install -y neutron-plugin-openvswitch-agent python-cinderclient

# Configure Quantum
# /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
echo "
[DATABASE]
reconnect_interval = 2
connection=mysql://neutron:openstack@${CONTROLLER_HOST}/neutron
[AGENT]
# Agent's polling interval in seconds
polling_interval = 2
[OVS]
tenant_network_type=gre
tunnel_id_ranges=1:1000
integration_bridge=br-int
tunnel_bridge=br-tun
local_ip=${MY_IP}
enable_tunneling=True
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
[SECURITYGROUP]
# Firewall driver for realizing neutron security group function
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
" | sudo tee -a /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini

# Configure Neutron
sudo sed -i "s/# rabbit_host = localhost/rabbit_host = ${CONTROLLER_HOST}/g" /etc/neutron/neutron.conf
sudo sed -i 's/# auth_strategy = keystone/auth_strategy = keystone/g' /etc/neutron/neutron.conf
sudo sed -i "s/auth_host = 127.0.0.1/auth_host = ${CONTROLLER_HOST}/g" /etc/neutron/neutron.conf
sudo sed -i 's/admin_tenant_name = %SERVICE_TENANT_NAME%/admin_tenant_name = service/g' /etc/neutron/neutron.conf
sudo sed -i 's/admin_user = %SERVICE_USER%/admin_user = neutron/g' /etc/neutron/neutron.conf
sudo sed -i 's/admin_password = %SERVICE_PASSWORD%/admin_password = neutron/g' /etc/neutron/neutron.conf
sudo sed -i 's/^root_helper.*/root_helper = sudo/g' /etc/neutron/neutron.conf
sudo sed -i 's/# allow_overlapping_ips = False/allow_overlapping_ips = True/g' /etc/neutron/neutron.conf
sudo sed -i "s,^connection.*,connection = mysql://neutron:${MYSQL_NEUTRON_PASS}@${MYSQL_HOST}/neutron," /etc/neutron/neutron.conf


echo "
Defaults !requiretty
neutron ALL=(ALL:ALL) NOPASSWD:ALL" | tee -a /etc/sudoers

# Restart Quantum Services
service neutron-plugin-openvswitch-agent restart


# Clobber the nova.conf file with the following
NOVA_CONF=/etc/nova/nova.conf
NOVA_API_PASTE=/etc/nova/api-paste.ini

cat > /tmp/nova.conf << EOF
[DEFAULT]
dhcpbridge_flagfile=/etc/nova/nova.conf
dhcpbridge=/usr/bin/nova-dhcpbridge
logdir=/var/log/nova
state_path=/var/lib/nova
lock_path=/var/lock/nova
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
verbose=True
api_paste_config=/etc/nova/api-paste.ini
enabled_apis=ec2,osapi_compute,metadata
# Libvirt and Virtualization
libvirt_use_virtio_for_bridges=True
connection_type=libvirt
libvirt_type=qemu
# Database
sql_connection=mysql://nova:openstack@${MYSQL_HOST}/nova
# Messaging
rabbit_host=${MYSQL_HOST}
# EC2 API Flags
ec2_host=${MYSQL_HOST}
ec2_dmz_host=${MYSQL_HOST}
ec2_private_dns_show_ip=True
# Network settings
network_api_class=nova.network.neutronv2.api.API
neutron_url=http://${CONTROLLER_HOST}:9696
neutron_auth_strategy=keystone
neutron_admin_tenant_name=service
neutron_admin_username=neutron
neutron_admin_password=neutron
neutron_admin_auth_url=http://${CONTROLLER_HOST}:5000/v2.0
libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver
linuxnet_interface_driver=nova.network.linux_net.LinuxOVSInterfaceDriver
firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
security_group_api=neutron
#Metadata
service_neutron_metadata_proxy = True
neutron_metadata_proxy_shared_secret = foo
#metadata_host = ${MY_IP}
#metadata_listen = 127.0.0.1
#metadata_listen_port = 8775
# Cinder #
volume_driver=nova.volume.driver.ISCSIDriver
enabled_apis=ec2,osapi_compute,metadata
volume_api_class=nova.volume.cinder.API
iscsi_helper=tgtadm
iscsi_ip_address=${CONTROLLER_HOST}
# Images
image_service=nova.image.glance.GlanceImageService
glance_api_servers=${GLANCE_HOST}:9292
# Scheduler
scheduler_default_filters=AllHostsFilter
# Auth
auth_strategy=keystone
keystone_ec2_url=http://${KEYSTONE_ENDPOINT}:5000/v2.0/ec2tokens
# NoVNC
novnc_enabled=true
novncproxy_host=${CONTROLLER_HOST}
novncproxy_base_url=http://${CONTROLLER_HOST}:6080/vnc_auto.html
novncproxy_port=6080
xvpvncproxy_port=6081
xvpvncproxy_host=${CONTROLLER_HOST}
xvpvncproxy_base_url=http://${CONTROLLER_HOST}:6081/console
vncserver_proxyclient_address=${MY_IP}
vncserver_listen=0.0.0.0
EOF


sudo rm -f $NOVA_CONF
sudo mv /tmp/nova.conf $NOVA_CONF
sudo chmod 0640 $NOVA_CONF
sudo chown nova:nova $NOVA_CONF

# Paste file
sudo sed -i "s/127.0.0.1/'$KEYSTONE_ENDPOINT'/g" $NOVA_API_PASTE
sudo sed -i "s/%SERVICE_TENANT_NAME%/'service'/g" $NOVA_API_PASTE
sudo sed -i "s/%SERVICE_USER%/nova/g" $NOVA_API_PASTE
sudo sed -i "s/%SERVICE_PASSWORD%/'$SERVICE_PASS'/g" $NOVA_API_PASTE

sudo nova-manage db sync
}

nova_ceilometer() {
/vagrant/ceilometer-compute.sh
}

nova_restart() {
for P in $(ls /etc/init/nova* | cut -d'/' -f4 | cut -d'.' -f1)
do
sudo stop ${P}
sudo start ${P}
done
}

# Main
nova_compute_install
nova_configure
nova_ceilometer
nova_restart
Loading

0 comments on commit 766751c

Please sign in to comment.