final bash8 files for the rest of devstack

With this devstack/master is bash8 clean, and ready for enforcement

Change-Id: I03fc89b401e6b7a23224d71472122c1bfa3ad0bd
This commit is contained in:
Sean Dague 2013-10-22 11:37:35 -04:00
parent 02d7fe13bb
commit 0b865a55f2
7 changed files with 106 additions and 106 deletions

View File

@ -22,8 +22,8 @@ run_bm STACKMASTER $HEAD_HOST "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vn
if [ ! "$TERMINATE" = "1" ]; then if [ ! "$TERMINATE" = "1" ]; then
echo "Waiting for head node ($HEAD_HOST) to start..." echo "Waiting for head node ($HEAD_HOST) to start..."
if ! timeout 60 sh -c "while ! wget -q -O- http://$HEAD_HOST | grep -q username; do sleep 1; done"; then if ! timeout 60 sh -c "while ! wget -q -O- http://$HEAD_HOST | grep -q username; do sleep 1; done"; then
echo "Head node did not start" echo "Head node did not start"
exit 1 exit 1
fi fi
fi fi

View File

@ -229,8 +229,8 @@ EOF
# (re)start a metadata service # (re)start a metadata service
( (
pid=`lsof -iTCP@192.168.$GUEST_NETWORK.1:4567 -n | awk '{print $2}' | tail -1` pid=`lsof -iTCP@192.168.$GUEST_NETWORK.1:4567 -n | awk '{print $2}' | tail -1`
[ -z "$pid" ] || kill -9 $pid [ -z "$pid" ] || kill -9 $pid
) )
cd $vm_dir/uec cd $vm_dir/uec
python meta.py 192.168.$GUEST_NETWORK.1:4567 & python meta.py 192.168.$GUEST_NETWORK.1:4567 &
@ -268,7 +268,7 @@ if [ "$WAIT_TILL_LAUNCH" = "1" ]; then
sleep 2 sleep 2
while [ ! -e "$vm_dir/console.log" ]; do while [ ! -e "$vm_dir/console.log" ]; do
sleep 1 sleep 1
done done
tail -F $vm_dir/console.log & tail -F $vm_dir/console.log &

View File

@ -105,15 +105,15 @@ if [ -z "$OS_PASSWORD" ]; then
fi fi
if [ -z "$OS_TENANT_NAME" -a -z "$OS_TENANT_ID" ]; then if [ -z "$OS_TENANT_NAME" -a -z "$OS_TENANT_ID" ]; then
export OS_TENANT_NAME=admin export OS_TENANT_NAME=admin
fi fi
if [ -z "$OS_USERNAME" ]; then if [ -z "$OS_USERNAME" ]; then
export OS_USERNAME=admin export OS_USERNAME=admin
fi fi
if [ -z "$OS_AUTH_URL" ]; then if [ -z "$OS_AUTH_URL" ]; then
export OS_AUTH_URL=http://localhost:5000/v2.0/ export OS_AUTH_URL=http://localhost:5000/v2.0/
fi fi
USER_PASS=${USER_PASS:-$OS_PASSWORD} USER_PASS=${USER_PASS:-$OS_PASSWORD}
@ -249,7 +249,7 @@ if [ $MODE != "create" ]; then
for user_id_at_name in `keystone user-list --tenant-id $tenant_id | awk 'BEGIN {IGNORECASE = 1} /true[[:space:]]*\|[^|]*\|$/ {print $2 "@" $4}'`; do for user_id_at_name in `keystone user-list --tenant-id $tenant_id | awk 'BEGIN {IGNORECASE = 1} /true[[:space:]]*\|[^|]*\|$/ {print $2 "@" $4}'`; do
read user_id user_name <<< `echo "$user_id_at_name" | sed 's/@/ /'` read user_id user_name <<< `echo "$user_id_at_name" | sed 's/@/ /'`
if [ $MODE = one -a "$user_name" != "$USER_NAME" ]; then if [ $MODE = one -a "$user_name" != "$USER_NAME" ]; then
continue; continue;
fi fi
add_entry "$user_id" "$user_name" "$tenant_id" "$tenant_name" "$USER_PASS" add_entry "$user_id" "$user_name" "$tenant_id" "$tenant_name" "$USER_PASS"
done done

View File

@ -6,8 +6,8 @@ set -o errexit
# Make sure only root can run our script # Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" echo "This script must be run as root"
exit 1 exit 1
fi fi
# This directory # This directory
@ -31,15 +31,15 @@ apt-get install -y --force-yes $DEPS
# Install jenkins # Install jenkins
if [ ! -e /var/lib/jenkins ]; then if [ ! -e /var/lib/jenkins ]; then
echo "Jenkins installation failed" echo "Jenkins installation failed"
exit 1 exit 1
fi fi
# Make sure user has configured a jenkins ssh pubkey # Make sure user has configured a jenkins ssh pubkey
if [ ! -e /var/lib/jenkins/.ssh/id_rsa.pub ]; then if [ ! -e /var/lib/jenkins/.ssh/id_rsa.pub ]; then
echo "Public key for jenkins is missing. This is used to ssh into your instances." echo "Public key for jenkins is missing. This is used to ssh into your instances."
echo "Please run "su -c ssh-keygen jenkins" before proceeding" echo "Please run "su -c ssh-keygen jenkins" before proceeding"
exit 1 exit 1
fi fi
# Setup sudo # Setup sudo
@ -96,7 +96,7 @@ PLUGINS=http://hudson-ci.org/downloads/plugins/build-timeout/1.6/build-timeout.h
# Configure plugins # Configure plugins
for plugin in ${PLUGINS//,/ }; do for plugin in ${PLUGINS//,/ }; do
name=`basename $plugin` name=`basename $plugin`
dest=/var/lib/jenkins/plugins/$name dest=/var/lib/jenkins/plugins/$name
if [ ! -e $dest ]; then if [ ! -e $dest ]; then
curl -L $plugin -o $dest curl -L $plugin -o $dest

View File

@ -44,9 +44,9 @@ source $THIS_DIR/xenrc
xe_min() xe_min()
{ {
local cmd="$1" local cmd="$1"
shift shift
xe "$cmd" --minimal "$@" xe "$cmd" --minimal "$@"
} }
# #
@ -132,8 +132,8 @@ HOST_IP=$(xenapi_ip_on "$MGT_BRIDGE_OR_NET_NAME")
# Set up ip forwarding, but skip on xcp-xapi # Set up ip forwarding, but skip on xcp-xapi
if [ -a /etc/sysconfig/network ]; then if [ -a /etc/sysconfig/network ]; then
if ! grep -q "FORWARD_IPV4=YES" /etc/sysconfig/network; then if ! grep -q "FORWARD_IPV4=YES" /etc/sysconfig/network; then
# FIXME: This doesn't work on reboot! # FIXME: This doesn't work on reboot!
echo "FORWARD_IPV4=YES" >> /etc/sysconfig/network echo "FORWARD_IPV4=YES" >> /etc/sysconfig/network
fi fi
fi fi
# Also, enable ip forwarding in rc.local, since the above trick isn't working # Also, enable ip forwarding in rc.local, since the above trick isn't working

View File

@ -42,69 +42,69 @@ EOF
get_params() get_params()
{ {
while getopts "hbn:r:l:t:" OPTION; while getopts "hbn:r:l:t:" OPTION;
do do
case $OPTION in case $OPTION in
h) usage h) usage
exit 1 exit 1
;; ;;
n) n)
BRIDGE=$OPTARG BRIDGE=$OPTARG
;; ;;
l) l)
NAME_LABEL=$OPTARG NAME_LABEL=$OPTARG
;; ;;
t) t)
TEMPLATE_NAME=$OPTARG TEMPLATE_NAME=$OPTARG
;; ;;
?) ?)
usage usage
exit exit
;; ;;
esac esac
done done
if [[ -z $BRIDGE ]] if [[ -z $BRIDGE ]]
then then
BRIDGE=xenbr0 BRIDGE=xenbr0
fi fi
if [[ -z $TEMPLATE_NAME ]]; then if [[ -z $TEMPLATE_NAME ]]; then
echo "Please specify a template name" >&2 echo "Please specify a template name" >&2
exit 1 exit 1
fi fi
if [[ -z $NAME_LABEL ]]; then if [[ -z $NAME_LABEL ]]; then
echo "Please specify a name-label for the new VM" >&2 echo "Please specify a name-label for the new VM" >&2
exit 1 exit 1
fi fi
} }
xe_min() xe_min()
{ {
local cmd="$1" local cmd="$1"
shift shift
xe "$cmd" --minimal "$@" xe "$cmd" --minimal "$@"
} }
find_network() find_network()
{ {
result=$(xe_min network-list bridge="$1") result=$(xe_min network-list bridge="$1")
if [ "$result" = "" ] if [ "$result" = "" ]
then then
result=$(xe_min network-list name-label="$1") result=$(xe_min network-list name-label="$1")
fi fi
echo "$result" echo "$result"
} }
create_vif() create_vif()
{ {
local v="$1" local v="$1"
echo "Installing VM interface on [$BRIDGE]" echo "Installing VM interface on [$BRIDGE]"
local out_network_uuid=$(find_network "$BRIDGE") local out_network_uuid=$(find_network "$BRIDGE")
xe vif-create vm-uuid="$v" network-uuid="$out_network_uuid" device="0" xe vif-create vm-uuid="$v" network-uuid="$out_network_uuid" device="0"
} }
@ -112,20 +112,20 @@ create_vif()
# Make the VM auto-start on server boot. # Make the VM auto-start on server boot.
set_auto_start() set_auto_start()
{ {
local v="$1" local v="$1"
xe vm-param-set uuid="$v" other-config:auto_poweron=true xe vm-param-set uuid="$v" other-config:auto_poweron=true
} }
destroy_vifs() destroy_vifs()
{ {
local v="$1" local v="$1"
IFS=, IFS=,
for vif in $(xe_min vif-list vm-uuid="$v") for vif in $(xe_min vif-list vm-uuid="$v")
do do
xe vif-destroy uuid="$vif" xe vif-destroy uuid="$vif"
done done
unset IFS unset IFS
} }

View File

@ -22,63 +22,63 @@ set -ex
# By default, don't remove the templates # By default, don't remove the templates
REMOVE_TEMPLATES=${REMOVE_TEMPLATES:-"false"} REMOVE_TEMPLATES=${REMOVE_TEMPLATES:-"false"}
if [ "$1" = "--remove-templates" ]; then if [ "$1" = "--remove-templates" ]; then
REMOVE_TEMPLATES=true REMOVE_TEMPLATES=true
fi fi
xe_min() xe_min()
{ {
local cmd="$1" local cmd="$1"
shift shift
xe "$cmd" --minimal "$@" xe "$cmd" --minimal "$@"
} }
destroy_vdi() destroy_vdi()
{ {
local vbd_uuid="$1" local vbd_uuid="$1"
local type=$(xe_min vbd-list uuid=$vbd_uuid params=type) local type=$(xe_min vbd-list uuid=$vbd_uuid params=type)
local dev=$(xe_min vbd-list uuid=$vbd_uuid params=userdevice) local dev=$(xe_min vbd-list uuid=$vbd_uuid params=userdevice)
local vdi_uuid=$(xe_min vbd-list uuid=$vbd_uuid params=vdi-uuid) local vdi_uuid=$(xe_min vbd-list uuid=$vbd_uuid params=vdi-uuid)
if [ "$type" == 'Disk' ] && [ "$dev" != 'xvda' ] && [ "$dev" != '0' ]; then if [ "$type" == 'Disk' ] && [ "$dev" != 'xvda' ] && [ "$dev" != '0' ]; then
xe vdi-destroy uuid=$vdi_uuid xe vdi-destroy uuid=$vdi_uuid
fi fi
} }
uninstall() uninstall()
{ {
local vm_uuid="$1" local vm_uuid="$1"
local power_state=$(xe_min vm-list uuid=$vm_uuid params=power-state) local power_state=$(xe_min vm-list uuid=$vm_uuid params=power-state)
if [ "$power_state" != "halted" ]; then if [ "$power_state" != "halted" ]; then
xe vm-shutdown vm=$vm_uuid force=true xe vm-shutdown vm=$vm_uuid force=true
fi fi
for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do
destroy_vdi "$v" destroy_vdi "$v"
done done
xe vm-uninstall vm=$vm_uuid force=true >/dev/null xe vm-uninstall vm=$vm_uuid force=true >/dev/null
} }
uninstall_template() uninstall_template()
{ {
local vm_uuid="$1" local vm_uuid="$1"
for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do
destroy_vdi "$v" destroy_vdi "$v"
done done
xe template-uninstall template-uuid=$vm_uuid force=true >/dev/null xe template-uninstall template-uuid=$vm_uuid force=true >/dev/null
} }
# remove the VMs and their disks # remove the VMs and their disks
for u in $(xe_min vm-list other-config:os-vpx=true | sed -e 's/,/ /g'); do for u in $(xe_min vm-list other-config:os-vpx=true | sed -e 's/,/ /g'); do
uninstall "$u" uninstall "$u"
done done
# remove the templates # remove the templates
if [ "$REMOVE_TEMPLATES" == "true" ]; then if [ "$REMOVE_TEMPLATES" == "true" ]; then
for u in $(xe_min template-list other-config:os-vpx=true | sed -e 's/,/ /g'); do for u in $(xe_min template-list other-config:os-vpx=true | sed -e 's/,/ /g'); do
uninstall_template "$u" uninstall_template "$u"
done done
fi fi