Setup Configurations Clean Up

Combine setup_allinone.sh and setup_standard_controller.sh to have one
single setup script to configure via input parameter allinone and
standardcontroller configurations:

  - setup_configuration.sh
  - destroy_configuration.sh

Change-Id: Id29d3eeeff43f0c0f43ab710a1179eaacdfb330d
Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com>
This commit is contained in:
Abraham Arce 2018-10-31 03:36:40 -06:00
parent b082b557f9
commit 3db9d36e85
7 changed files with 75 additions and 84 deletions

View File

@ -5,8 +5,8 @@ This is a quick reference for deploying StarlingX on libvirt/qemu systems.
It assumes you have a working libvirt/qemu installation for a non-root user
and that your user has NOPASSWD sudo permissions.
Refer also to pages "Installation Guide Virtual Environment", "Testing Guide"
on the StarlingX wiki: https://wiki.openstack.org/wiki/StarlingX
Refer also to pages "Installation Guide" on the StarlingX Documentation:
https://docs.starlingx.io/installation_guide/index.html
Overview
--------
@ -45,16 +45,19 @@ It should also only be used after all of the VMs created below have been destroy
Controllers
-----------
There are two scripts for creating the controllers: ``setup_allinone.sh`` and
``setup_standard_controller.sh``. They are operated in the same manner but build
different StarlingX cloud configurations. Choose wisely.
There is one script for creating the controllers: ``setup_configuration.sh``. It
builds different StarlingX cloud configurations:
You need an ISO file for the installation, these scripts take a name with the
- allinone
- standardcontroller
You need an StarlingX ISO file for the installation. The script takes the
configuration name with the ``-c`` option and the ISO file name with the
``-i`` option::
./setup_allinone.sh -i stx-2018-08-28-93.iso
./setup_configuration.sh -c allinone -i stx-2018-08-28-93.iso
And the setup will begin. The scripts create one or more VMs and start the boot
And the setup will begin. The script create one or more VMs and start the boot
of the first controller, named oddly enough ``controller-0``. If you have Xwindows
available you will get virt-manager running.
If not, Ctrl-C out of that attempt if it doesn't return to a shell prompt.
@ -64,4 +67,6 @@ Then connect to the serial console::
Continue the usual StarlingX installation from this point forward.
Tear down the VMs using ``destroy_allinone.sh`` and ``destroy_standard_controller.sh``.
Tear down the VMs giving the configuration name with the ``-c`` option::
>-------./destroy_configuration.sh -c allinone

View File

@ -1,11 +0,0 @@
#!/usr/bin/env bash
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
source ${SCRIPT_DIR}/functions.sh
CONFIGURATION="allinone"
CONTROLLER=${CONTROLLER:-controller}
DOMAIN_DIRECTORY=vms
destroy_controller ${CONFIGURATION} ${CONTROLLER}

View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
source ${SCRIPT_DIR}/functions.sh
while getopts "c:" o; do
case "${o}" in
c)
CONFIGURATION=${OPTARG}
;;
*)
usage_destroy
exit 1
;;
esac
done
shift $((OPTIND-1))
if [[ -z ${CONFIGURATION} ]]; then
usage_destroy
exit -1
fi
CONFIGURATION=${CONFIGURATION:-allinone}
CONTROLLER=${CONTROLLER:-controller}
DOMAIN_DIRECTORY=vms
destroy_controller ${CONFIGURATION} ${CONTROLLER}
if ([ "$CONFIGURATION" == "standardcontroller" ]); then
COMPUTE=${COMPUTE:-compute}
COMPUTE_NODES_NUMBER=${COMPUTE_NODES_NUMBER:-1}
for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do
COMPUTE_NODE=${COMPUTE}-${i}
destroy_compute $COMPUTE_NODE
done
fi

View File

@ -1,18 +0,0 @@
#!/usr/bin/env bash
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
source ${SCRIPT_DIR}/functions.sh
CONFIGURATION="standardcontroller"
CONTROLLER=${CONTROLLER:-controller}
COMPUTE=${COMPUTE:-compute}
COMPUTE_NODES_NUMBER=${COMPUTE_NODES_NUMBER:-1}
DOMAIN_DIRECTORY=vms
destroy_controller ${CONFIGURATION} ${CONTROLLER}
for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do
COMPUTE_NODE=${COMPUTE}-${i}
destroy_compute $COMPUTE_NODE
done

View File

@ -1,13 +1,22 @@
#!/usr/bin/env bash
usage() {
echo "$0 [-h] [-i <iso image>]"
echo "$0 [-h] [-c <configuration>] [-i <iso image>]"
echo ""
echo "Options:"
echo " -c: Configuration: allinone, standardcontroller"
echo " -i: StarlingX ISO image"
echo ""
}
usage_destroy() {
echo "$0 [-h] [-c <configuration>]"
echo ""
echo "Options:"
echo " -c: Configuration: allinone, standardcontroller"
echo ""
}
iso_image_check() {
local ISOIMAGE=$1
FILETYPE=$(file --mime-type -b ${ISOIMAGE})

View File

@ -1,37 +0,0 @@
#!/usr/bin/env bash
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
source ${SCRIPT_DIR}/functions.sh
while getopts "i:" o; do
case "${o}" in
i)
ISOIMAGE=$(readlink -f "$OPTARG")
;;
*)
usage
exit 1
;;
esac
done
shift $((OPTIND-1))
if [ -z "${ISOIMAGE}" ]; then
usage
exit -1
fi
iso_image_check ${ISOIMAGE}
CONFIGURATION="allinone"
BRIDGE_INTERFACE=${BRIDGE_INTERFACE:-stxbr}
CONTROLLER=${CONTROLLER:-controller}
DOMAIN_DIRECTORY=vms
bash ${SCRIPT_DIR}/destroy_allinone.sh
[ ! -d ${DOMAIN_DIRECTORY} ] && mkdir ${DOMAIN_DIRECTORY}
create_controller $CONFIGURATION $CONTROLLER $BRIDGE_INTERFACE $ISOIMAGE
sudo virt-manager

View File

@ -3,8 +3,11 @@
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
source ${SCRIPT_DIR}/functions.sh
while getopts "i:" o; do
while getopts "c:i:" o; do
case "${o}" in
c)
CONFIGURATION="$OPTARG"
;;
i)
ISOIMAGE=$(readlink -f "$OPTARG")
;;
@ -16,29 +19,31 @@ while getopts "i:" o; do
done
shift $((OPTIND-1))
if [ -z "${ISOIMAGE}" ]; then
if [[ -z ${CONFIGURATION} ]] || [[ -z "${ISOIMAGE}" ]]; then
usage
exit -1
fi
iso_image_check ${ISOIMAGE}
CONFIGURATION="standardcontroller"
CONFIGURATION=${CONFIGURATION:-allinone}
BRIDGE_INTERFACE=${BRIDGE_INTERFACE:-stxbr}
CONTROLLER=${CONTROLLER:-controller}
COMPUTE=${COMPUTE:-compute}
COMPUTE_NODES_NUMBER=${COMPUTE_NODES_NUMBER:-1}
DOMAIN_DIRECTORY=vms
bash ${SCRIPT_DIR}/destroy_standard_controller.sh
bash ${SCRIPT_DIR}/destroy_configuration.sh -c $CONFIGURATION
[ ! -d ${DOMAIN_DIRECTORY} ] && mkdir ${DOMAIN_DIRECTORY}
create_controller $CONFIGURATION $CONTROLLER $BRIDGE_INTERFACE $ISOIMAGE
for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do
COMPUTE_NODE=${COMPUTE}-${i}
create_compute ${COMPUTE_NODE}
done
if ([ "$CONFIGURATION" == "standardcontroller" ]); then
for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do
COMPUTE_NODE=${COMPUTE}-${i}
create_compute ${COMPUTE_NODE}
done
fi
sudo virt-manager