Merge "Custom init-runonce values"

This commit is contained in:
Jenkins 2017-02-09 12:16:46 +00:00 committed by Gerrit Code Review
commit 6761120111

View File

@ -5,6 +5,13 @@
# configures networking and nova quotas to allow 40 m1.small instances # configures networking and nova quotas to allow 40 m1.small instances
# to be created. # to be created.
IMAGE_URL=http://download.cirros-cloud.net/0.3.4/
IMAGE=cirros-0.3.4-x86_64-disk.img
IMAGE_NAME=cirros
EXT_NET_CIDR='10.0.2.0/24'
EXT_NET_RANGE='start=10.0.2.150,end=10.0.2.199'
EXT_NET_GATEWAY='10.0.2.1'
# Sanitize language settings to avoid commands bailing out # Sanitize language settings to avoid commands bailing out
# with "unsupported locale setting" errors. # with "unsupported locale setting" errors.
unset LANG unset LANG
@ -12,9 +19,9 @@ unset LANGUAGE
LC_ALL=C LC_ALL=C
export LC_ALL export LC_ALL
for i in curl openstack; do for i in curl openstack; do
if [[ ! $(type $i 2>/dev/null) ]]; then if [[ ! $(type ${i} 2>/dev/null) ]]; then
if [ "$i" == 'curl' ]; then if [ "${i}" == 'curl' ]; then
echo "Please install $i before proceeding" echo "Please install ${i} before proceeding"
else else
echo "Please install python-${i}client before proceeding" echo "Please install python-${i}client before proceeding"
fi fi
@ -38,21 +45,19 @@ if openstack image list | grep -q cirros; then
fi fi
echo Downloading glance image. echo Downloading glance image.
IMAGE_URL=http://download.cirros-cloud.net/0.3.4/ if ! [ -f "${IMAGE}" ]; then
IMAGE=cirros-0.3.4-x86_64-disk.img curl -L -o ./${IMAGE} ${IMAGE_URL}/${IMAGE}
if ! [ -f "$IMAGE" ]; then
curl -L -o ./$IMAGE $IMAGE_URL/$IMAGE
fi fi
echo Creating glance image. echo Creating glance image.
openstack image create --disk-format qcow2 --container-format bare --public \ openstack image create --disk-format qcow2 --container-format bare --public \
--file ./$IMAGE cirros --file ./${IMAGE} ${IMAGE_NAME}
echo Configuring neutron. echo Configuring neutron.
openstack network create --external --provider-physical-network physnet1 \ openstack network create --external --provider-physical-network physnet1 \
--provider-network-type flat public1 --provider-network-type flat public1
openstack subnet create --no-dhcp \ openstack subnet create --no-dhcp \
--allocation-pool start=10.0.2.150,end=10.0.2.199 --network public1 \ --allocation-pool ${EXT_NET_RANGE} --network public1 \
--subnet-range 10.0.2.0/24 --gateway 10.0.2.1 public1-subnet --subnet-range ${EXT_NET_CIDR} --gateway ${EXT_NET_GATEWAY} public1-subnet
openstack network create --provider-network-type vxlan demo-net openstack network create --provider-network-type vxlan demo-net
openstack subnet create --subnet-range 10.0.0.0/24 --network demo-net \ openstack subnet create --subnet-range 10.0.0.0/24 --network demo-net \
@ -90,13 +95,13 @@ fi
# Increase the quota to allow 40 m1.small instances to be created # Increase the quota to allow 40 m1.small instances to be created
# 40 instances # 40 instances
openstack quota set --instances 40 $ADMIN_PROJECT_ID openstack quota set --instances 40 ${ADMIN_PROJECT_ID}
# 40 cores # 40 cores
openstack quota set --cores 40 $ADMIN_PROJECT_ID openstack quota set --cores 40 ${ADMIN_PROJECT_ID}
# 96GB ram # 96GB ram
openstack quota set --ram 96000 $ADMIN_PROJECT_ID openstack quota set --ram 96000 ${ADMIN_PROJECT_ID}
# add default flavors, if they don't already exist # add default flavors, if they don't already exist
if ! openstack flavor list | grep -q m1.tiny; then if ! openstack flavor list | grep -q m1.tiny; then
@ -116,7 +121,7 @@ Done.
To deploy a demo instance, run: To deploy a demo instance, run:
openstack server create \\ openstack server create \\
--image cirros \\ --image ${IMAGE_NAME} \\
--flavor m1.tiny \\ --flavor m1.tiny \\
--key-name mykey \\ --key-name mykey \\
--nic net-id=${DEMO_NET_ID} \\ --nic net-id=${DEMO_NET_ID} \\