Merge "Add a conf-novanet to configure nova"

This commit is contained in:
Jenkins 2015-04-27 22:27:33 +00:00 committed by Gerrit Code Review
commit ca1d1c0fa6
3 changed files with 61 additions and 18 deletions

View File

@ -14,12 +14,7 @@ to use the installation:
```
# source openrc
# nova network-create vmnet --fixed-range-v4=10.0.0.0/24 --bridge=br100 --multi-host=T
# nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
# nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
#
# nova keypair-add mykey > mykey.pem
# chmod 600 mykey.pem
# tools/conf-novanet
# nova boot --flavor m1.medium --key_name mykey --image puffy_clouds instance_name
# ssh -i mykey.pem cirros@<ip>
# ssh cirros@<ip>
```

55
tools/conf-novanet Executable file
View File

@ -0,0 +1,55 @@
# This script is meant to be run once after running start for the first
# time. This script downloads a cirros image and registers it. Then it
# configures nova networking and nova quotas to allow 40 m1.small instances
#to be created.
# Move to top level directory
REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")
cd "$(dirname "$REAL_PATH")/.."
# Test for credentials set
if [[ "${OS_USERNAME}" == "" ]]; then
echo "No Keystone credentials specified. Try running source openrc"
exit
fi
# Test to ensure configure script is run only once
if [[ `glance image-list | grep cirros | wc -l` -gt 0 ]]; then
echo "This tool should only be run once per deployment."
exit
fi
echo Downloading glance image.
IMAGE_URL=http://download.cirros-cloud.net/0.3.3/
IMAGE=cirros-0.3.3-x86_64-disk.img
if ! [ -f "$IMAGE" ]; then
curl -L -o ./$IMAGE $IMAGE_URL/$IMAGE
fi
echo Creating glance image.
glance image-create --name cirros --is-public false --disk-format qcow2 --container-format bare --file ./$IMAGE
echo Configuring nova networking.
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
nova network-create vmnet --fixed-range-v4=10.0.0.0/24 --bridge=br100 --multi-host=T
echo Configuring nova public key and quotas.
nova keypair-add --pub-key ~/.ssh/id_rsa.pub mykey
# Increase the quota to allow 40 m1.small instances to be created
# Get admin user and tenant IDs
ADMIN_USER=$(keystone user-list | awk '/admin/ {print $2'})
ADMIN_TENANT=$(keystone tenant-list | awk '/admin/ {print $2}')
# 40 instances
nova quota-update --instances 40 $ADMIN_TENANT
nova quota-update --user $ADMIN_USER --instances 40 $ADMIN_TENANT
# 40 cores
nova quota-update --cores 40 $ADMIN_TENANT
nova quota-update --user $ADMIN_USER --cores 40 $ADMIN_TENANT
# 96GB ram
nova quota-update --ram 96000 $ADMIN_TENANT
nova quota-update --user $ADMIN_USER --ram 96000 $ADMIN_TENANT

View File

@ -80,18 +80,11 @@ function post_start {
sleep 3
echo Creating glance image.
glance image-create --name cirros --is-public false --disk-format qcow2 --container-format bare --file ./$IMAGE
echo Example Usage:
echo source openrc # source keystone credentials
echo Example usage:
echo
echo nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
echo nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
echo nova network-create vmnet --fixed-range-v4=10.0.0.0/24 --bridge=br100 --multi-host=T
echo
echo nova keypair-add mykey > mykey.pem
echo chmod 600 mykey.pem
echo nova boot --flavor m1.medium --key_name mykey --image cirros kolla_vm
echo Configure your environment once by running:
echo tools/conf-novanet # configure OpenStack with Nova Networking
}
function usage {