Merge "Cleanup stack/unstack"

This commit is contained in:
Jenkins 2012-07-06 15:41:58 +00:00 committed by Gerrit Code Review
commit 08bc3048b1
2 changed files with 35 additions and 26 deletions

View File

@ -245,7 +245,6 @@ sudo chown `whoami` $DATA_DIR
# Get project function libraries # Get project function libraries
source $TOP_DIR/lib/cinder source $TOP_DIR/lib/cinder
# Set the destination directories for openstack projects # Set the destination directories for openstack projects
NOVA_DIR=$DEST/nova NOVA_DIR=$DEST/nova
HORIZON_DIR=$DEST/horizon HORIZON_DIR=$DEST/horizon
@ -463,9 +462,9 @@ fi
GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$SERVICE_HOST:9292} GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$SERVICE_HOST:9292}
# SWIFT # Swift
# ----- # -----
# TODO: implement glance support
# TODO: add logging to different location. # TODO: add logging to different location.
# By default the location of swift drives and objects is located inside # By default the location of swift drives and objects is located inside
@ -477,7 +476,7 @@ SWIFT_DATA_DIR=${SWIFT_DATA_DIR:-${DEST}/data/swift}
# directory, change SWIFT_CONFIG_DIR if you want to adjust that. # directory, change SWIFT_CONFIG_DIR if you want to adjust that.
SWIFT_CONFIG_DIR=${SWIFT_CONFIG_DIR:-/etc/swift} SWIFT_CONFIG_DIR=${SWIFT_CONFIG_DIR:-/etc/swift}
# devstack will create a loop-back disk formatted as XFS to store the # DevStack will create a loop-back disk formatted as XFS to store the
# swift data. By default the disk size is 1 gigabyte. The variable # swift data. By default the disk size is 1 gigabyte. The variable
# SWIFT_LOOPBACK_DISK_SIZE specified in bytes allow you to change # SWIFT_LOOPBACK_DISK_SIZE specified in bytes allow you to change
# that. # that.
@ -512,6 +511,7 @@ fi
# Set default port for nova-objectstore # Set default port for nova-objectstore
S3_SERVICE_PORT=${S3_SERVICE_PORT:-3333} S3_SERVICE_PORT=${S3_SERVICE_PORT:-3333}
# Keystone # Keystone
# -------- # --------
@ -609,10 +609,10 @@ set -o xtrace
# Install Packages # Install Packages
# ================ # ================
#
# Openstack uses a fair number of other projects. # Openstack uses a fair number of other projects.
# install package requirements # Install package requirements
if [[ "$os_PACKAGE" = "deb" ]]; then if [[ "$os_PACKAGE" = "deb" ]]; then
apt_get update apt_get update
install_package $(get_packages $FILES/apts) install_package $(get_packages $FILES/apts)
@ -620,12 +620,13 @@ else
install_package $(get_packages $FILES/rpms) install_package $(get_packages $FILES/rpms)
fi fi
# install python requirements # Install python requirements
pip_install $(get_packages $FILES/pips | sort -u) pip_install $(get_packages $FILES/pips | sort -u)
# compute service # Check out OpenStack sources
git_clone $NOVA_REPO $NOVA_DIR $NOVA_BRANCH git_clone $NOVA_REPO $NOVA_DIR $NOVA_BRANCH
# python client library to nova that horizon (and others) use
# Check out the client libs that are used most
git_clone $KEYSTONECLIENT_REPO $KEYSTONECLIENT_DIR $KEYSTONECLIENT_BRANCH git_clone $KEYSTONECLIENT_REPO $KEYSTONECLIENT_DIR $KEYSTONECLIENT_BRANCH
git_clone $NOVACLIENT_REPO $NOVACLIENT_DIR $NOVACLIENT_BRANCH git_clone $NOVACLIENT_REPO $NOVACLIENT_DIR $NOVACLIENT_BRANCH
git_clone $OPENSTACKCLIENT_REPO $OPENSTACKCLIENT_DIR $OPENSTACKCLIENT_BRANCH git_clone $OPENSTACKCLIENT_REPO $OPENSTACKCLIENT_DIR $OPENSTACKCLIENT_BRANCH
@ -678,7 +679,7 @@ fi
# Initialization # Initialization
# ============== # ==============
# setup our checkouts so they are installed into python path # Set up our checkouts so they are installed into python path
# allowing ``import nova`` or ``import glance.client`` # allowing ``import nova`` or ``import glance.client``
setup_develop $KEYSTONECLIENT_DIR setup_develop $KEYSTONECLIENT_DIR
setup_develop $NOVACLIENT_DIR setup_develop $NOVACLIENT_DIR
@ -874,16 +875,17 @@ function screen_it {
fi fi
} }
# create a new named screen to run processes in # Create a new named screen to run processes in
screen -d -m -S stack -t stack -s /bin/bash screen -d -m -S stack -t stack -s /bin/bash
sleep 1 sleep 1
# set a reasonable statusbar # Set a reasonable statusbar
screen -r stack -X hardstatus alwayslastline "$SCREEN_HARDSTATUS" screen -r stack -X hardstatus alwayslastline "$SCREEN_HARDSTATUS"
# Horizon # Horizon
# ------- # -------
# Setup the django horizon application to serve via apache/wsgi # Set up the django horizon application to serve via apache/wsgi
if is_service_enabled horizon; then if is_service_enabled horizon; then
@ -900,7 +902,7 @@ if is_service_enabled horizon; then
python manage.py syncdb python manage.py syncdb
cd $TOP_DIR cd $TOP_DIR
# create an empty directory that apache uses as docroot # Create an empty directory that apache uses as docroot
sudo mkdir -p $HORIZON_DIR/.blackhole sudo mkdir -p $HORIZON_DIR/.blackhole
if [[ "$os_PACKAGE" = "deb" ]]; then if [[ "$os_PACKAGE" = "deb" ]]; then
@ -1007,8 +1009,10 @@ if is_service_enabled g-reg; then
fi fi
# Quantum (for controller or agent nodes)
# Quantum
# ------- # -------
if is_service_enabled quantum; then if is_service_enabled quantum; then
# Put config files in /etc/quantum for everyone to find # Put config files in /etc/quantum for everyone to find
if [[ ! -d /etc/quantum ]]; then if [[ ! -d /etc/quantum ]]; then
@ -1034,7 +1038,7 @@ if is_service_enabled quantum; then
exit 1 exit 1
fi fi
# if needed, move config file from $QUANTUM_DIR/etc/quantum to /etc/quantum # If needed, move config file from $QUANTUM_DIR/etc/quantum to /etc/quantum
mkdir -p /$Q_PLUGIN_CONF_PATH mkdir -p /$Q_PLUGIN_CONF_PATH
Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME
if [[ -e $QUANTUM_DIR/$Q_PLUGIN_CONF_FILE ]]; then if [[ -e $QUANTUM_DIR/$Q_PLUGIN_CONF_FILE ]]; then
@ -1143,7 +1147,6 @@ if is_service_enabled m-svc; then
fi fi
# Nova # Nova
# ---- # ----
@ -1279,7 +1282,7 @@ if is_service_enabled n-cpu; then
QEMU_CONF=/etc/libvirt/qemu.conf QEMU_CONF=/etc/libvirt/qemu.conf
if is_service_enabled quantum && [[ $Q_PLUGIN = "openvswitch" ]] && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF ; then if is_service_enabled quantum && [[ $Q_PLUGIN = "openvswitch" ]] && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF ; then
# add /dev/net/tun to cgroup_device_acls, needed for type=ethernet interfaces # Add /dev/net/tun to cgroup_device_acls, needed for type=ethernet interfaces
sudo chmod 666 $QEMU_CONF sudo chmod 666 $QEMU_CONF
sudo cat <<EOF >> /etc/libvirt/qemu.conf sudo cat <<EOF >> /etc/libvirt/qemu.conf
cgroup_device_acl = [ cgroup_device_acl = [
@ -1363,7 +1366,10 @@ if is_service_enabled n-net; then
sudo sysctl -w net.ipv4.ip_forward=1 sudo sysctl -w net.ipv4.ip_forward=1
fi fi
# Storage Service # Storage Service
# ---------------
if is_service_enabled swift; then if is_service_enabled swift; then
# Install memcached for swift. # Install memcached for swift.
install_package memcached install_package memcached
@ -1663,7 +1669,7 @@ function add_nova_opt {
echo "$1" >> $NOVA_CONF_DIR/$NOVA_CONF echo "$1" >> $NOVA_CONF_DIR/$NOVA_CONF
} }
# remove legacy nova.conf # Remove legacy nova.conf
rm -f $NOVA_DIR/bin/nova.conf rm -f $NOVA_DIR/bin/nova.conf
# (re)create nova.conf # (re)create nova.conf
@ -1924,7 +1930,7 @@ if is_service_enabled key; then
iniset $KEYSTONE_CONF_DIR/logging.conf logger_root level "DEBUG" iniset $KEYSTONE_CONF_DIR/logging.conf logger_root level "DEBUG"
iniset $KEYSTONE_CONF_DIR/logging.conf logger_root handlers "devel,production" iniset $KEYSTONE_CONF_DIR/logging.conf logger_root handlers "devel,production"
# Set up the keystone database # Initialize keystone database
$KEYSTONE_DIR/bin/keystone-manage db_sync $KEYSTONE_DIR/bin/keystone-manage db_sync
# launch keystone and wait for it to answer before continuing # launch keystone and wait for it to answer before continuing
@ -1950,7 +1956,7 @@ if is_service_enabled key; then
export OS_USERNAME=admin export OS_USERNAME=admin
export OS_PASSWORD=$ADMIN_PASSWORD export OS_PASSWORD=$ADMIN_PASSWORD
# create an access key and secret key for nova ec2 register image # Create an access key and secret key for nova ec2 register image
if is_service_enabled swift && is_service_enabled nova; then if is_service_enabled swift && is_service_enabled nova; then
NOVA_USER_ID=$(keystone user-list | grep ' nova ' | get_field 1) NOVA_USER_ID=$(keystone user-list | grep ' nova ' | get_field 1)
NOVA_TENANT_ID=$(keystone tenant-list | grep " $SERVICE_TENANT_NAME " | get_field 1) NOVA_TENANT_ID=$(keystone tenant-list | grep " $SERVICE_TENANT_NAME " | get_field 1)
@ -1963,7 +1969,7 @@ if is_service_enabled key; then
fi fi
fi fi
# launch the nova-api and wait for it to answer before continuing # Launch the nova-api and wait for it to answer before continuing
if is_service_enabled n-api; then if is_service_enabled n-api; then
add_nova_opt "enabled_apis=$NOVA_ENABLED_APIS" add_nova_opt "enabled_apis=$NOVA_ENABLED_APIS"
screen_it n-api "cd $NOVA_DIR && $NOVA_DIR/bin/nova-api" screen_it n-api "cd $NOVA_DIR && $NOVA_DIR/bin/nova-api"
@ -1977,13 +1983,13 @@ fi
# If we're using Quantum (i.e. q-svc is enabled), network creation has to # If we're using Quantum (i.e. q-svc is enabled), network creation has to
# happen after we've started the Quantum service. # happen after we've started the Quantum service.
if is_service_enabled mysql && is_service_enabled nova; then if is_service_enabled mysql && is_service_enabled nova; then
# create a small network # Create a small network
$NOVA_DIR/bin/nova-manage network create private $FIXED_RANGE 1 $FIXED_NETWORK_SIZE $NETWORK_CREATE_ARGS $NOVA_DIR/bin/nova-manage network create private $FIXED_RANGE 1 $FIXED_NETWORK_SIZE $NETWORK_CREATE_ARGS
# create some floating ips # Create some floating ips
$NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE $NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE
# create a second pool # Create a second pool
$NOVA_DIR/bin/nova-manage floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL $NOVA_DIR/bin/nova-manage floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL
fi fi
@ -2012,6 +2018,7 @@ screen_it swift "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONF
is_service_enabled swift || \ is_service_enabled swift || \
screen_it n-obj "cd $NOVA_DIR && $NOVA_DIR/bin/nova-objectstore" screen_it n-obj "cd $NOVA_DIR && $NOVA_DIR/bin/nova-objectstore"
# Install Images # Install Images
# ============== # ==============

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# **unstack.sh**
# Stops that which is started by ``stack.sh`` (mostly) # Stops that which is started by ``stack.sh`` (mostly)
# mysql and rabbit are left running as OpenStack code refreshes # mysql and rabbit are left running as OpenStack code refreshes
# do not require them to be restarted. # do not require them to be restarted.