Update samples

* Skip commands for services that are not started in local.sh
* Rename localrc to local.conf

Change-Id: Ida3a8cc836d56db94da4a133fbeb81c7f5fc5f26
This commit is contained in:
Dean Troyer 2014-01-10 12:05:51 -06:00
parent bd49958794
commit 38e38fb16d
2 changed files with 42 additions and 37 deletions

View File

@ -1,19 +1,22 @@
# Sample ``localrc`` for user-configurable variables in ``stack.sh``
# Sample ``local.conf`` for user-configurable variables in ``stack.sh``
# NOTE: Copy this file to the root ``devstack`` directory for it to
# work properly.
# ``localrc`` is a user-maintained setings file that is sourced from ``stackrc``.
# ``local.conf`` is a user-maintained setings file that is sourced from ``stackrc``.
# This gives it the ability to override any variables set in ``stackrc``.
# Also, most of the settings in ``stack.sh`` are written to only be set if no
# value has already been set; this lets ``localrc`` effectively override the
# value has already been set; this lets ``local.conf`` effectively override the
# default values.
# This is a collection of some of the settings we have found to be useful
# in our DevStack development environments. Additional settings are described
# in http://devstack.org/localrc.html
# in http://devstack.org/local.conf.html
# These should be considered as samples and are unsupported DevStack code.
# The ``localrc`` section replaces the old ``localrc`` configuration file.
# Note that if ``localrc`` is present it will be used in favor of this section.
[[local|localrc]]
# Minimal Contents
# ----------------
@ -22,7 +25,7 @@
# there are a few minimal variables set:
# If the ``*_PASSWORD`` variables are not set here you will be prompted to enter
# values for them by ``stack.sh`` and they will be added to ``localrc``.
# values for them by ``stack.sh`` and they will be added to ``local.conf``.
ADMIN_PASSWORD=nomoresecrete
MYSQL_PASSWORD=stackdb
RABBIT_PASSWORD=stackqueue

View File

@ -23,45 +23,47 @@ source $TOP_DIR/stackrc
# Destination path for installation ``DEST``
DEST=${DEST:-/opt/stack}
if is_service_enabled nova; then
# Import ssh keys
# ---------------
# Import ssh keys
# ---------------
# Import keys from the current user into the default OpenStack user (usually
# ``demo``)
# Import keys from the current user into the default OpenStack user (usually
# ``demo``)
# Get OpenStack auth
source $TOP_DIR/openrc
# Get OpenStack user auth
source $TOP_DIR/openrc
# Add first keypair found in localhost:$HOME/.ssh
for i in $HOME/.ssh/id_rsa.pub $HOME/.ssh/id_dsa.pub; do
if [[ -r $i ]]; then
nova keypair-add --pub_key=$i `hostname`
break
# Add first keypair found in localhost:$HOME/.ssh
for i in $HOME/.ssh/id_rsa.pub $HOME/.ssh/id_dsa.pub; do
if [[ -r $i ]]; then
nova keypair-add --pub_key=$i `hostname`
break
fi
done
# Create A Flavor
# ---------------
# Get OpenStack admin auth
source $TOP_DIR/openrc admin admin
# Name of new flavor
# set in ``localrc`` with ``DEFAULT_INSTANCE_TYPE=m1.micro``
MI_NAME=m1.micro
# Create micro flavor if not present
if [[ -z $(nova flavor-list | grep $MI_NAME) ]]; then
nova flavor-create $MI_NAME 6 128 0 1
fi
done
# Create A Flavor
# ---------------
# Other Uses
# ----------
# Get OpenStack admin auth
source $TOP_DIR/openrc admin admin
# Add tcp/22 and icmp to default security group
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
# Name of new flavor
# set in ``localrc`` with ``DEFAULT_INSTANCE_TYPE=m1.micro``
MI_NAME=m1.micro
# Create micro flavor if not present
if [[ -z $(nova flavor-list | grep $MI_NAME) ]]; then
nova flavor-create $MI_NAME 6 128 0 1
fi
# Other Uses
# ----------
# Add tcp/22 and icmp to default security group
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