Refactor overcloud scripts

This commit is contained in:
James Slagle 2014-02-25 15:24:48 -05:00
parent d9c6f1774f
commit 12760ffe5c
4 changed files with 102 additions and 151 deletions

@ -3,113 +3,40 @@ Overcloud
This page details how to deploy and use an Overcloud once the Undercloud is
installed.
Deploying
---------
There are 3 scripts for convenience.
1. In case you're still using the same shell, the install script has to manipulate your $PATH (until we get everything
packaged), so you'll need to start a new shell environment.
Note that deploy-overcloud can be configured for individual environments via
environment variables. The variables you can set are documented below before
the calls to the script. For their default values, see the deploy-overcloud
script itself.
bash
1. Run the prepare-for-overcloud script to get setup. This script will
re-downloading images if they already exist in the current working directory.
If you want to force a redownload of the images, delete them first.
4. Copy the stackrc file to your homedir so that you can use it a normal user.
prepare-for-overcloud
source /etc/sysconfig/stackrc
1. If you're testing an all VM setup, copy the ssh key for the virtual power
driver user to your authorized keys file. Define $UNDERCLOUD_IP for your
environment. Skip this step if you are using all baremetal.
4. Add your ssh key pair to nova
ssh $UNDERCLOUD_IP cat /opt/stack/boot-stack/virtual-power-key.pub >> ~/.ssh/authorized_keys
1. Run the deploy-overcloud script to actually deploy the overcloud
user-config
# CPU: number of cpus on baremetal nodes
# MEM: amount of ram on baremetal nodes, in MB
# DISK: amount of disk on baremetal nodes, in GB
# ARCH: architecture of baremetal nodes, amd64 or i386
# MACS: list of MAC addresses of baremetal nodes
# PM_IPS: list of Power Management IP addresses
# PM_USERS: list of Power Management Users
# PM_PASSWORDS: list of Power Management Passwords
# NeutronPublicInterface: Overcloud management interface name
# OVERCLOUD_LIBVIRT_TYPE: Overcloud libvirt type, qemu or kvm
deploy-overcloud
5. Download the deployment kernel and ramdisk
1. Run the test-overcloud script to launch a cirros image on the overcloud and
wait until it pings successfully
curl -L -O http://file.rdu.redhat.com/~jslagle/tripleo-images-rdo-icehouse/deploy-ramdisk.initramfs
curl -L -O http://file.rdu.redhat.com/~jslagle/tripleo-images-rdo-icehouse/deploy-ramdisk.kernel
5. Download overcloud images
curl -L -O http://file.rdu.redhat.com/~jslagle/tripleo-images-rdo-icehouse/overcloud-control.qcow2
curl -L -O http://file.rdu.redhat.com/~jslagle/tripleo-images-rdo-icehouse/overcloud-compute.qcow2
5. Load images into glance
load-image overcloud-control.qcow2
load-image overcloud-compute.qcow2
6. Use the setup-baremetal script to add your baremetal nodes
# setup-baremetal requires this to be set
export TRIPLEO_ROOT=.
# $CPU = cpu count per node
# $MEM = memory per node in MB
# $DISK = disk per node in GB
# $ARCH = architecture of each node, i386 or amd64
# $MACS = space separated list of node mac addresses
# $PM_IPS = space separated list of power management IP addresses
# $PM_USERS = space separated list of power management users
# $PM_PASSWORDS = space separated list of power management passwords
# $MACS and $PM_* variables should be in the same node order, e.g., the
# first MAC address should correspond to the first power management
# IP, etc.
setup-baremetal $CPU $MEM $DISK $ARCH "$MACS" undercloud "$PM_IPS" "$PM_USERS" "$PM_PASSWORDS"
7. Create your overcloud heat template. You can adjust COMPUTESCALE to launch
more than one compute node if you choose to.
tripleo-heat-merge \
--included-template-dir /usr/share/tripleo-heat-templates \
--scale NovaCompute=1 \
/usr/share/tripleo-heat-templates/overcloud-source.yaml \
/usr/share/tripleo-heat-templates/swift-source.yaml \
/usr/share/tripleo-heat-templates/ssl-source.yaml \
> overcloud.yaml
8. Create and source the overcloud passwords
setup-overcloud-passwords
source tripleo-overcloud-passwords
9. Deploy the overcloud
# Define the interface that will be bridged onto the Neutron defined
# network.
NeutronPublicInterface=eth0
# Define the overcloud libvirt type for virtualization. kvm for
# baremetal, qemu for an overcloud running in vm's.
OVERCLOUD_LIBVIRT_TYPE=kvm
heat stack-create -f overcloud.yaml \
-P AdminToken=${OVERCLOUD_ADMIN_TOKEN} \
-P AdminPassword=${OVERCLOUD_ADMIN_PASSWORD} \
-P CinderPassword=${OVERCLOUD_CINDER_PASSWORD} \
-P GlancePassword=${OVERCLOUD_GLANCE_PASSWORD} \
-P HeatPassword=${OVERCLOUD_HEAT_PASSWORD} \
-P NeutronPassword=${OVERCLOUD_NEUTRON_PASSWORD} \
-P NovaPassword=${OVERCLOUD_NOVA_PASSWORD} \
-P NeutronPublicInterface=$NeutronPublicInterface \
-P SwiftPassword=${OVERCLOUD_SWIFT_PASSWORD} \
-P SwiftHashSuffix=${OVERCLOUD_SWIFT_HASH} \
-P NovaComputeLibvirtType=$OVERCLOUD_LIBVIRT_TYPE \
overcloud
Using the Overcloud
-------------------
The scripted steps for configuring and using the Overcloud by launching a
single cirros instance in it are scripted at scripts/overcloud.
You can also use the devtest instructions to walk through it manually. Start off with step 11 from
http://docs.openstack.org/developer/tripleo-incubator/devtest_overcloud.html.
You won't be able to follow the steps exactly. Here's what you need to modify:
* When source'ing the rc files use the following paths instead of what's shown:
source /etc/tripleo/overcloudrc
source /etc/tripleo/overcloudrc-user
* When running setup-neutron, correct subnet ranges will need to be used if
192.0.2.0/24 is not applicable to the environment.
* When loading the user.qcow2 image into glance, I would use a cirros image
instead. Download the cirros image from
https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img
and specify the path to the downloaded file when you run the glance command.
test-overcloud

@ -2,62 +2,46 @@
set -eux
source /etc/sysconfig/stackrc
# generate ssh authentication keys if they don't exist
if [ ! -f ~/.ssh/id_rsa ]; then
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
fi
user-config
if [ ! -f deploy-ramdisk.initramfs ]; then
curl -L -O http://file.rdu.redhat.com/~jslagle/tripleo-images-rdo-icehouse/deploy-ramdisk.initramfs
fi
if [ ! -f deploy-ramdisk.kernel ]; then
curl -L -O http://file.rdu.redhat.com/~jslagle/tripleo-images-rdo-icehouse/deploy-ramdisk.kernel
fi
if [ ! -f overcloud-control.qcow2 ]; then
curl -L -O http://file.rdu.redhat.com/~jslagle/tripleo-images-rdo-icehouse/overcloud-control.qcow2
fi
if [ ! -f overcloud-compute.qcow2 ]; then
curl -L -O http://file.rdu.redhat.com/~jslagle/tripleo-images-rdo-icehouse/overcloud-compute.qcow2
fi
load-image overcloud-control.qcow2
load-image overcloud-compute.qcow2
# setup-baremetal requires this to be set
export TRIPLEO_ROOT=.
CPU=1
MEM=2048
DISK=30
ARCH=amd64
MACS="52:54:00:b5:bd:f0 52:54:00:f2:be:f0"
setup-baremetal $CPU $MEM $DISK $ARCH "$MACS" undercloud
CPU=${CPU:-1}
MEM=${MEM:-2048}
DISK=${DISK:-30}
ARCH=${ARCH:-amd64}
MACS=${MACS:-"52:54:00:b5:bd:f0 52:54:00:f2:be:f0"}
PM_IPS=${PM_IPS:-}
PM_USERS=${PM_USERS:-}
PM_PASSWORDS=${PM_PASSWORDS:-}
setup-baremetal $CPU $MEM $DISK $ARCH "$MACS" undercloud "$PM_IPS" "$PM_USERS" "$PM_PASSWORDS"
sleep 30
# Must wait for baremetal nodes to register as nova hypervisors
sleep 60
setup-overcloud-passwords
setup-overcloud-passwords -o
source tripleo-overcloud-passwords
# Define the interface that will be bridged onto the Neutron defined
# network.
NeutronPublicInterface=eth0
NeutronPublicInterface=${NeutronPublicInterface:-eth0}
# Define the overcloud libvirt type for virtualization. kvm for
# baremetal, qemu for an overcloud running in vm's.
OVERCLOUD_LIBVIRT_TYPE=qemu
OVERCLOUD_LIBVIRT_TYPE=${OVERCLOUD_LIBVIRT_TYPE:-qemu}
if [ -d /usr/share/tripleo-heat-templates ]; then
tripleo-heat-merge \
--included-template-dir /usr/share/tripleo-heat-templates \
--scale NovaCompute=1 \
/usr/share/tripleo-heat-templates/overcloud-source.yaml \
/usr/share/tripleo-heat-templates/swift-source.yaml \
/usr/share/tripleo-heat-templates/ssl-source.yaml \
> overcloud.yaml
OVERCLOUD_YAML_PATH=overcloud.yaml
else
sudo make -C /opt/stack/tripleo-heat-templates overcloud.yaml COMPUTESCALE=1
OVERCLOUD_YAML_PATH=/opt/stack/tripleo-heat-templates/overcloud.yaml
fi
# TODO
# steps below here will be replaced with calls to python-tuskarclient
sudo make -C /opt/stack/tripleo-heat-templates overcloud.yaml COMPUTESCALE=1
heat stack-create -f /opt/stack/tripleo-heat-templates/overcloud.yaml \
heat stack-create -f $OVERCLOUD_YAML_PATH \
-P AdminToken=${OVERCLOUD_ADMIN_TOKEN} \
-P AdminPassword=${OVERCLOUD_ADMIN_PASSWORD} \
-P CinderPassword=${OVERCLOUD_CINDER_PASSWORD} \
@ -70,3 +54,7 @@ heat stack-create -f /opt/stack/tripleo-heat-templates/overcloud.yaml \
-P SwiftHashSuffix=${OVERCLOUD_SWIFT_HASH} \
-P NovaComputeLibvirtType=$OVERCLOUD_LIBVIRT_TYPE \
overcloud
wait_for 220 10 stack-ready overcloud
echo "Overcloud CREATE_COMPLETE"

31
scripts/prepare-for-overcloud Executable file

@ -0,0 +1,31 @@
#!/bin/bash
set -eux
source /etc/sysconfig/stackrc
# generate ssh authentication keys if they don't exist
if [ ! -f ~/.ssh/id_rsa ]; then
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
fi
user-config
if [ ! -f deploy-ramdisk.initramfs ]; then
curl -L -O http://file.rdu.redhat.com/~jslagle/tripleo-images-rdo-icehouse/deploy-ramdisk.initramfs
fi
if [ ! -f deploy-ramdisk.kernel ]; then
curl -L -O http://file.rdu.redhat.com/~jslagle/tripleo-images-rdo-icehouse/deploy-ramdisk.kernel
fi
if [ ! -f overcloud-control.qcow2 ]; then
curl -L -O http://file.rdu.redhat.com/~jslagle/tripleo-images-rdo-icehouse/overcloud-control.qcow2
fi
if [ ! -f overcloud-compute.qcow2 ]; then
curl -L -O http://file.rdu.redhat.com/~jslagle/tripleo-images-rdo-icehouse/overcloud-compute.qcow2
fi
load-image overcloud-control.qcow2
load-image overcloud-compute.qcow2

@ -2,20 +2,23 @@
set -eux
TRIPLEO_ROOT=/opt/stack
if [ -d /etc/tripleo ]; then
TRIPLEO_ROOT=/etc/tripleo
else
TRIPLEO_ROOT=/opt/stack/tripleo-incubator
fi
source /etc/sysconfig/stackrc
source tripleo-overcloud-passwords
wait_for 220 10 stack-ready overcloud
export OVERCLOUD_IP=$(nova list | grep notCompute0.*ctlplane | sed -e "s/.*=\\([0-9.]*\\).*/\1/")
touch ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
ssh-keygen -R $OVERCLOUD_IP
source $TRIPLEO_ROOT/tripleo-incubator/overcloudrc
source $TRIPLEO_ROOT/overcloudrc
export no_proxy=${no_proxy:-""}
export no_proxy=$no_proxy,$OVERCLOUD_IP
@ -39,7 +42,9 @@ os-adduser -p $OVERCLOUD_DEMO_PASSWORD demo demo@example.com
nova flavor-delete m1.tiny
nova flavor-create m1.tiny 1 512 2 1
curl -L -O https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img
if [ ! -f cirros-0.3.0-x86_64-disk.img ]; then
curl -L -O https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img
fi
glance image-create --name user --public --disk-format qcow2 \
--container-format bare --file cirros-0.3.0-x86_64-disk.img
@ -48,7 +53,7 @@ wait_for 30 10 nova service-list --binary nova-compute 2\>/dev/null \| grep 'ena
wait_for 30 10 neutron agent-list -f csv -c alive -c agent_type -c host \| grep "\":-).*Open vSwitch agent.*overcloud-novacompute\""
source $TRIPLEO_ROOT/tripleo-incubator/overcloudrc-user
source $TRIPLEO_ROOT/overcloudrc-user
user-config