forked from BeyondTheClouds/kolla-g5k
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit
More file actions
79 lines (68 loc) · 3.1 KB
/
Copy pathinit
File metadata and controls
79 lines (68 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
#
# 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 networking and nova quotas to allow 40 m1.small instances
# to be created.
# Sanitize language settings to avoid commands bailing out
# with "unsupported locale setting" errors.
unset LANG
unset LANGUAGE
LC_ALL=C
export LC_ALL
for i in curl nova neutron openstack; do
if [[ ! $(which $i) ]]; then
echo "$i not installed. Please install $i before proceeding"
exit 1
fi
done
# Move to top level directory
REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")
cd "$(dirname "$REAL_PATH")/.."
NETWORK_MANAGER="neutron"
# 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 -q cirros; 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.4/
IMAGE=cirros-0.3.4-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 --progress --disk-format qcow2 --container-format bare --progress --file ./$IMAGE
echo Configuring neutron.
neutron net-create public1 --router:external --provider:physical_network physnet1 --provider:network_type flat
neutron subnet-create --name subnet-1 --disable-dhcp --allocation-pool start={{ public_net_start }},{{ public_net_end }} public1 {{ public_net_cidr }} --gateway {{ public_net_gateway }}
# Sec Group Config
neutron security-group-rule-create default --direction ingress --ethertype IPv4 --protocol icmp --remote-ip-prefix 0.0.0.0/0
neutron security-group-rule-create default --direction ingress --ethertype IPv4 --protocol tcp --port-range-min 22 --port-range-max 22 --remote-ip-prefix 0.0.0.0/0
# Open heat-cfn so it can run on a different host
neutron security-group-rule-create default --direction ingress --ethertype IPv4 --protocol tcp --port-range-min 8000 --port-range-max 8000 --remote-ip-prefix 0.0.0.0/0
neutron security-group-rule-create default --direction ingress --ethertype IPv4 --protocol tcp --port-range-min 8080 --port-range-max 8080 --remote-ip-prefix 0.0.0.0/0
if [ -r ~/.ssh/id_rsa.pub ]; then
echo Configuring nova public key and quotas.
nova keypair-add --pub-key ~/.ssh/id_rsa.pub mykey
fi
# Increase the quota to allow 40 m1.small instances to be created
# Get admin user and tenant IDs
ADMIN_USER_ID=$(openstack user list | awk '/ admin / {print $2}')
ADMIN_PROJECT_ID=$(openstack project list | awk '/ admin / {print $2}')
# 40 instances
#nova quota-update --instances 40 $ADMIN_PROJECT_ID
#nova quota-update --user $ADMIN_USER_ID --instances 40 $ADMIN_PROJECT_ID
#
## 40 cores
#nova quota-update --cores 40 $ADMIN_PROJECT_ID
#nova quota-update --user $ADMIN_USER_ID --cores 40 $ADMIN_PROJECT_ID
#
## 96GB ram
#nova quota-update --ram 96000 $ADMIN_PROJECT_ID
#nova quota-update --user $ADMIN_USER_ID --ram 96000 $ADMIN_PROJECT_ID