summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
Diffstat (limited to 'ci')
-rwxr-xr-xci/build.sh33
-rwxr-xr-xci/clean.sh31
-rwxr-xr-xci/deploy.sh343
3 files changed, 312 insertions, 95 deletions
diff --git a/ci/build.sh b/ci/build.sh
index 7a1ef523..82d5b637 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -24,7 +24,7 @@ fi;' EXIT
usage ()
{
cat << EOF
-$0 Builds the Foreman OPNFV Deployment ISO
+$0 Builds the Apex OPNFV Deployment Toolchain
usage: $0 [-s spec-file] [-c cache-URI] [-l log-file] [-f Flags] build-directory
@@ -41,6 +41,7 @@ OPTIONS:
o s: Do nothing, succeed
o f: Do nothing, fail
o t: run build unit tests
+ o M: Use master branch code
o i: run interactive (-t flag to docker run)
o P: Populate a new local cache and push it to the (-c cache-URI) cache artifactory if -c option is present, currently file://, http:// and ftp:// are supported
o d: Detatch - NOT YET SUPPORTED
@@ -58,7 +59,7 @@ To reduce build time it uses build cache on a local or remote location. The cach
- The git Commit-Id on the remote repos/HEAD defined in the spec file does not correspont with the Commit-Id for what the cache was built with.
3) A valid cache does not exist on the specified -c cache-base-URI.
-The cache URI object name is foreman_cache-"md5sum(spec file)"
+The cache URI object name is apex_cache-"md5sum(spec file)"
Logging by default to console, but can be directed elsewhere with the -l option in which case both stdout and stderr is redirected to that destination.
@@ -72,7 +73,7 @@ Return codes:
- 200 Build failure
Examples:
-build -c http://opnfv.org/artifactory/foreman/cache -d ~/jenkins/genesis/foreman/ci/output -f ti
+build -c http://opnfv.org/artifactory/apex/cache -d ~/jenkins/genesis/apex/ci/output -f ti
NOTE: At current the build scope is set to the git root of the repository, -d destination locations outside that scope will not work
EOF
}
@@ -87,8 +88,8 @@ BUILD_BASE=$(readlink -e ../build/)
RESULT_DIR="${BUILD_BASE}/release"
BUILD_SPEC="${BUILD_BASE}/config.mk"
CACHE_DIR="cache"
-LOCAL_CACHE_ARCH_NAME="foreman-cache"
-REMOTE_CACHE_ARCH_NAME="foreman_cache-$(md5sum ${BUILD_SPEC}| cut -f1 -d " ")"
+LOCAL_CACHE_ARCH_NAME="apex-cache"
+REMOTE_CACHE_ARCH_NAME="apex_cache-$(md5sum ${BUILD_SPEC}| cut -f1 -d " ")"
REMOTE_ACCESS_METHD=curl
INCLUDE_DIR=../include
#
@@ -104,6 +105,7 @@ CACHE_TMP="${SCRIPT_DIR}/tmp"
TEST_SUCCEED=0
TEST_FAIL=0
UNIT_TEST=0
+USE_MASTER=0
UPDATE_CACHE=0
POPULATE_CACHE=0
RECURSIV=0
@@ -210,6 +212,10 @@ for ((i=0; i<${#BUILD_FLAGS};i++)); do
UNIT_TEST=1
;;
+ M)
+ USE_MASTER=1
+ ;;
+
i)
INTERACTIVE=1
;;
@@ -303,7 +309,7 @@ if [ ! -z ${BUILD_CACHE_URI} ]; then
POPULATE_CACHE=1
else
echo "Unpacking cache file ..."
- tar -C ${CACHE_TMP}/cache -xvf ${CACHE_TMP}/cache/${LOCAL_CACHE_ARCH_NAME}.tgz
+ tar --atime-preserve -C ${CACHE_TMP}/cache -xvf ${CACHE_TMP}/cache/${LOCAL_CACHE_ARCH_NAME}.tgz
cp ${CACHE_TMP}/cache/cache/.versions ${BUILD_BASE}/.
set +e
make -C ${BUILD_BASE} validate-cache;
@@ -345,6 +351,10 @@ else
MAKE_ARGS+="UNIT_TEST=FALSE "
fi
+if [ ${USE_MASTER} -eq 1 ]; then
+ MAKE_ARGS+="USE_MASTER=-master "
+fi
+
if [ ${INTERACTIVE} -eq 1 ]; then
MAKE_ARGS+="INTERACTIVE=TRUE "
else
@@ -376,16 +386,19 @@ if [ $rc -gt 0 ]; then
rc=100
exit $rc
fi
-echo "Copying built OPNFV .iso file to target directory ${BUILD_DIR} ..."
+echo "Linking built OPNFV .iso file to target directory ${BUILD_DIR} ..."
rm -rf ${BUILD_DIR}
mkdir -p ${BUILD_DIR}
-cp ${BUILD_BASE}/.versions ${BUILD_DIR}
-cp ${RESULT_DIR}/*.iso* ${BUILD_DIR}
+ln -s ${BUILD_BASE}/.versions ${BUILD_DIR}
+ln -s ${RESULT_DIR}/*.iso* ${BUILD_DIR}
+echo "Linking built OPNFV .rpm files to target directory ${BUILD_DIR} ..."
+ln -s ${BUILD_BASE}/*.rpm ${BUILD_DIR}
+ln -s ${BUILD_BASE}/noarch/*.rpm ${BUILD_DIR}
if [ $POPULATE_CACHE -eq 1 ]; then
if [ ! -z ${BUILD_CACHE_URI} ]; then
echo "Building cache ..."
- tar --dereference -C ${BUILD_BASE} -caf ${BUILD_BASE}/${LOCAL_CACHE_ARCH_NAME}.tgz ${CACHE_DIR}
+ tar --atime-preserve --dereference -C ${BUILD_BASE} -caf ${BUILD_BASE}/${LOCAL_CACHE_ARCH_NAME}.tgz ${CACHE_DIR}
echo "Uploading cache ${BUILD_CACHE_URI}/${REMOTE_CACHE_ARCH_NAME}"
${REMOTE_ACCESS_METHD} -T ${BUILD_BASE}/${LOCAL_CACHE_ARCH_NAME}.tgz ${BUILD_CACHE_URI}/${REMOTE_CACHE_ARCH_NAME}.tgz
rm ${BUILD_BASE}/${LOCAL_CACHE_ARCH_NAME}.tgz
diff --git a/ci/clean.sh b/ci/clean.sh
new file mode 100755
index 00000000..492b0dc2
--- /dev/null
+++ b/ci/clean.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+#Clean script to uninstall provisioning server for Apex
+#author: Dan Radez (dradez@redhat.com)
+#
+vm_index=4
+
+# Clean off instack VM
+virsh destroy instack 2> /dev/null || echo -n ''
+virsh undefine instack --remove-all-storage 2> /dev/null || echo -n ''
+virsh vol-delete instack.qcow2 default 2> /dev/null
+rm -f /var/lib/libvirt/images/instack.qcow2 2> /dev/null
+
+# Clean off baremetal VMs in case they exist
+for i in $(seq 0 $vm_index); do
+ virsh destroy baremetalbrbm_brbm1_$i 2> /dev/null || echo -n ''
+ virsh undefine baremetalbrbm_brbm1_$i --remove-all-storage 2> /dev/null || echo -n ''
+ virsh vol-delete baremetalbrbm_brbm1_${i}.qcow2 default 2> /dev/null
+ rm -f /var/lib/libvirt/images/baremetalbrbm_brbm1_${i}.qcow2 2> /dev/null
+done
+
+# Clean off brbm bridges
+virsh net-destroy brbm 2> /dev/null
+virsh net-undefine brbm 2> /dev/null
+vs-vsctl del-br brbm 2> /dev/null
+
+virsh net-destroy brbm1 2> /dev/null
+virsh net-undefine brbm1 2> /dev/null
+vs-vsctl del-br brbm1 2> /dev/null
+
+echo "Cleanup Completed"
diff --git a/ci/deploy.sh b/ci/deploy.sh
index ae01cedd..004f6d52 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -19,187 +19,360 @@
set -e
##VARIABLES
+#reset=`tput sgr0`
+#blue=`tput setaf 4`
+#red=`tput setaf 1`
+#green=`tput setaf 2`
+
+vm_index=4
+ha_enabled="TRUE"
declare -i CNT
declare UNDERCLOUD
+SSH_OPTIONS=(-o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -o LogLevel=error)
+DEPLOY_OPTIONS=""
+RESOURCES=/var/opt/opnfv/stack
+CONFIG=/var/opt/opnfv
+INSTACKENV=$CONFIG/instackenv.json
+NETENV=$CONFIG/network-environment.yaml
+
##FUNCTIONS
+##verify internet connectivity
+#params: none
+function verify_internet {
+ if ping -c 2 8.8.8.8 > /dev/null; then
+ if ping -c 2 www.google.com > /dev/null; then
+ echo "${blue}Internet connectivity detected${reset}"
+ return 0
+ else
+ echo "${red}Internet connectivity detected, but DNS lookup failed${reset}"
+ return 1
+ fi
+ else
+ echo "${red}No internet connectivity detected${reset}"
+ return 1
+ fi
+}
+
+##download dependencies if missing and configure host
+#params: none
+function configure_deps {
+ if ! verify_internet; then
+ echo "${red}Will not download dependencies${reset}"
+ internet=false
+ else
+ internet=true
+ fi
+
+ # ensure brbm networks are configured
+ systemctl start openvswitch
+ ovs-vsctl list-br | grep brbm > /dev/null || ovs-vsctl add-br brbm
+ virsh net-list --all | grep brbm > /dev/null || virsh net-create $CONFIG/brbm-net.xml
+ virsh net-list | grep -E "brbm\s+active" > /dev/null || virsh net-start brbm
+ ovs-vsctl list-br | grep brbm1 > /dev/null || ovs-vsctl add-br brbm1
+ virsh net-list --all | grep brbm1 > /dev/null || virsh net-create $CONFIG/brbm1-net.xml
+ virsh net-list | grep -E "brbm1\s+active" > /dev/null || virsh net-start brbm1
+
+ # ensure storage pool exists and is started
+ virsh pool-list --all | grep default > /dev/null || virsh pool-create $CONFIG/default-pool.xml
+ virsh pool-list | grep -Eo "default\s+active" > /dev/null || virsh pool-start default
+
+ if virsh net-list | grep default > /dev/null; then
+ num_ints_same_subnet=$(ip addr show | grep "inet 192.168.122" | wc -l)
+ if [ "$num_ints_same_subnet" -gt 1 ]; then
+ virsh net-destroy default
+ ##go edit /etc/libvirt/qemu/networks/default.xml
+ sed -i 's/192.168.122/192.168.123/g' /etc/libvirt/qemu/networks/default.xml
+ sed -i 's/192.168.122/192.168.123/g' instackenv-virt.json
+ sleep 5
+ virsh net-start default
+ virsh net-autostart default
+ fi
+ fi
+
+ if ! egrep '^flags.*(vmx|svm)' /proc/cpuinfo > /dev/null; then
+ echo "${red}virtualization extensions not found, kvm kernel module insertion may fail.\n \
+Are you sure you have enabled vmx in your bios or hypervisor?${reset}"
+ fi
+
+ modprobe kvm
+ modprobe kvm_intel
+
+ if ! lsmod | grep kvm > /dev/null; then
+ echo "${red}kvm kernel modules not loaded!${reset}"
+ return 1
+ fi
+
+ ##sshkeygen for root
+ if [ ! -e ~/.ssh/id_rsa.pub ]; then
+ ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
+ fi
+
+ echo "${blue}All dependencies installed and running${reset}"
+}
##verify vm exists, an has a dhcp lease assigned to it
##params: none
function setup_instack_vm {
- if ! virsh list | grep instack > /dev/null; then
+ if ! virsh list --all | grep instack > /dev/null; then
#virsh vol-create default instack.qcow2.xml
- virsh define instack.xml
+ virsh define $CONFIG/instack.xml
- #Copy instack machine
- cp instack.qcow2 /var/lib/libvirt/images
- restorecon /var/lib/libvirt/images/instack.qcow2
+ #Upload instack image
+ #virsh vol-create default --file instack.qcow2.xml
+ virsh vol-create-as default instack.qcow2 30G --format qcow2
+ virsh vol-upload --pool default --vol instack.qcow2 --file $CONFIG/stack/instack.qcow2
+
+ sleep 1 # this was to let the copy settle, needed with vol-upload?
- sleep 1
- virsh start instack
else
echo "Found Instack VM, using existing VM"
fi
-
+
+ # if the VM is not running update the authkeys and start it
+ if ! virsh list | grep instack > /dev/null; then
+ echo "Injecting ssh key to instack VM"
+ virt-customize -c qemu:///system -d instack --upload ~/.ssh/id_rsa.pub:/root/.ssh/authorized_keys \
+ --run-command "chmod 600 /root/.ssh/authorized_keys && restorecon /root/.ssh/authorized_keys" \
+ --run-command "cp /root/.ssh/authorized_keys /home/stack/.ssh/" \
+ --run-command "chown stack:stack /home/stack/.ssh/authorized_keys && chmod 600 /home/stack/.ssh/authorized_keys"
+ virsh start instack
+ fi
+
sleep 3 # let DHCP happen
CNT=10
- echo -n "Waiting for instack's dhcp address"
- while ! virsh net-dhcp-leases default | grep instack > /dev/null && [ $CNT -gt 0 ]; do
+ echo -n "${blue}Waiting for instack's dhcp address${reset}"
+ while ! grep instack /var/lib/libvirt/dnsmasq/default.leases > /dev/null && [ $CNT -gt 0 ]; do
echo -n "."
sleep 3
CNT=CNT-1
done
# get the instack VM IP
- UNDERCLOUD=$(virsh net-dhcp-leases default | grep instack | awk '{print $5}' | awk -F '/' '{print $1}')
+ UNDERCLOUD=$(grep instack /var/lib/libvirt/dnsmasq/default.leases | awk '{print $3}' | head -n 1)
CNT=10
- echo -en "\rValidating instack VM connectivity"
+ echo -en "${blue}\rValidating instack VM connectivity${reset}"
while ! ping -c 1 $UNDERCLOUD > /dev/null && [ $CNT -gt 0 ]; do
echo -n "."
sleep 3
CNT=CNT-1
done
CNT=10
- while ! ssh -T -o "StrictHostKeyChecking no" root@$UNDERCLOUD "echo ''" 1>&2> /dev/null && [ $CNT -gt 0 ]; do
+ while ! ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "echo ''" 2>&1> /dev/null && [ $CNT -gt 0 ]; do
echo -n "."
sleep 3
CNT=CNT-1
done
# extra space to overwrite the previous connectivity output
- echo -e "\rInstack VM has IP $UNDERCLOUD "
+ echo -e "${blue}\rInstack VM has IP $UNDERCLOUD ${reset}"
- #ssh -T -o "StrictHostKeyChecking no" root@$UNDERCLOUD "systemctl stop openstack-nova-compute.service"
- ssh -T -o "StrictHostKeyChecking no" root@$UNDERCLOUD "ip a a 192.0.2.1/24 dev eth1"
+ ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "if ! ip a s eth1 | grep 192.0.2.1 > /dev/null; then ip a a 192.0.2.1/24 dev eth1; fi"
+
+ #add the instack brbm1 interface
+ virsh attach-interface --domain instack --type network --source brbm1 --model rtl8139 --config --live
+ sleep 1
+ ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "if ! ip a s eth2 | grep 192.168.37.1 > /dev/null; then ip a a 192.168.37.252/24 dev eth2; ip link set up dev eth2; fi"
+
+ # ssh key fix for stack user
+ ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "restorecon -r /home/stack"
+}
+
+##Create virtual nodes in virsh
+##params: none
+function setup_virtual_baremetal {
+ for i in $(seq 0 $vm_index); do
+ if ! virsh list --all | grep baremetalbrbm_brbm1_${i} > /dev/null; then
+ if [ ! -e $CONFIG/baremetalbrbm_brbm1_${i}.xml ]; then
+ define_virtual_node baremetalbrbm_brbm1_${i}
+ fi
+ virsh define $CONFIG/baremetalbrbm_brbm1_${i}.xml
+ else
+ echo "Found Baremetal ${i} VM, using existing VM"
+ fi
+ virsh vol-list default | grep baremetalbrbm_brbm1_${i} 2>&1> /dev/null || virsh vol-create-as default baremetalbrbm_brbm1_${i}.qcow2 40G --format qcow2
+ done
}
##Copy over the glance images and instack json file
-##params: none
+##params: none
function copy_materials {
- scp stack/deploy-ramdisk-ironic.initramfs stack@$UNDERCLOUD:
- scp stack/deploy-ramdisk-ironic.kernel stack@$UNDERCLOUD:
- scp stack/discovery-ramdisk.initramfs stack@$UNDERCLOUD:
- scp stack/discovery-ramdisk.kernel stack@$UNDERCLOUD:
- scp stack/fedora-user.qcow2 stack@$UNDERCLOUD:
- scp stack/overcloud-full.initrd stack@$UNDERCLOUD:
- scp stack/overcloud-full.qcow2 stack@$UNDERCLOUD:
- scp stack/overcloud-full.vmlinuz stack@$UNDERCLOUD:
+ echo
+ echo "Copying configuration file and disk images to instack"
+ scp ${SSH_OPTIONS[@]} $RESOURCES/deploy-ramdisk-ironic.initramfs "stack@$UNDERCLOUD":
+ scp ${SSH_OPTIONS[@]} $RESOURCES/deploy-ramdisk-ironic.kernel "stack@$UNDERCLOUD":
+ scp ${SSH_OPTIONS[@]} $RESOURCES/ironic-python-agent.initramfs "stack@$UNDERCLOUD":
+ scp ${SSH_OPTIONS[@]} $RESOURCES/ironic-python-agent.kernel "stack@$UNDERCLOUD":
+ scp ${SSH_OPTIONS[@]} $RESOURCES/ironic-python-agent.vmlinuz "stack@$UNDERCLOUD":
+ scp ${SSH_OPTIONS[@]} $RESOURCES/overcloud-full.initrd "stack@$UNDERCLOUD":
+ scp ${SSH_OPTIONS[@]} $RESOURCES/overcloud-full.qcow2 "stack@$UNDERCLOUD":
+ scp ${SSH_OPTIONS[@]} $RESOURCES/overcloud-full.vmlinuz "stack@$UNDERCLOUD":
+ scp ${SSH_OPTIONS[@]} $NETENV "stack@$UNDERCLOUD":
+ scp ${SSH_OPTIONS[@]} $CONFIG/opendaylight.yaml "stack@$UNDERCLOUD":
+ scp ${SSH_OPTIONS[@]} -r $CONFIG/nics/ "stack@$UNDERCLOUD":
+
+ ## WORK AROUND
+ # when OpenDaylight lands in upstream RDO manager this can be removed
+ # apply the opendaylight patch
+ scp ${SSH_OPTIONS[@]} $CONFIG/opendaylight.patch "root@$UNDERCLOUD":
+ ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "cd /usr/share/openstack-tripleo-heat-templates/; patch -Np1 < /root/opendaylight.patch"
+ ## END WORK AROUND
+
+ # ensure stack user on instack machine has an ssh key
+ ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "if [ ! -e ~/.ssh/id_rsa.pub ]; then ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa; fi"
- scp instackenv.json stack@$UNDERCLOUD:
+ if [ $virtual == "TRUE" ]; then
+ # fix MACs to match new setup
+ for i in $(seq 0 $vm_index); do
+ pyscript="import json
+data = json.load(open('$CONFIG/instackenv-virt.json'))
+print data['nodes'][$i]['mac'][0]"
+
+ old_mac=$(python -c "$pyscript")
+ new_mac=$(virsh dumpxml baremetalbrbm_brbm1_$i | grep "mac address" | cut -d = -f2 | grep -Eo "[0-9a-f:]+")
+ # this doesn't work with multiple vnics on the vms
+ #if [ "$old_mac" != "$new_mac" ]; then
+ # echo "${blue}Modifying MAC for node from $old_mac to ${new_mac}${reset}"
+ # sed -i 's/'"$old_mac"'/'"$new_mac"'/' $CONFIG/instackenv-virt.json
+ #fi
+ done
+
+ DEPLOY_OPTIONS+="--libvirt-type qemu"
+ INSTACKENV=$CONFIG/instackenv-virt.json
+ NETENV=$CONFIG/network-environment.yaml
+ fi
+
+ # upload instackenv file to Instack
+ scp ${SSH_OPTIONS[@]} $INSTACKENV "stack@$UNDERCLOUD":instackenv.json
+
+
+ # allow stack to control power management on the hypervisor via sshkey
+ # only if this is a virtual deployment
+ if [ $virtual == "TRUE" ]; then
+ ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
+while read -r line; do
+ stack_key=\${stack_key}\\\\\\\\n\${line}
+done < <(cat ~/.ssh/id_rsa)
+stack_key=\$(echo \$stack_key | sed 's/\\\\\\\\n//')
+sed -i 's~INSERT_STACK_USER_PRIV_KEY~'"\$stack_key"'~' instackenv.json
+EOI
+ fi
+
+# copy stack's ssh key to this users authorized keys
+ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "cat /home/stack/.ssh/id_rsa.pub" >> ~/.ssh/authorized_keys
}
-##Seed the undercloud openstack installation
##preping it for deployment and launch the deploy
-##params: none
+##params: none
function undercloud_prep_overcloud_deploy {
- ssh -T -o "StrictHostKeyChecking no" stack@$UNDERCLOUD <<EOI
+ # check if HA is enabled
+ if [ $ha_enabled == "TRUE" ]; then
+ DEPLOY_OPTIONS+=" --control-scale 3 --compute-scale 2"
+ DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml"
+ DEPLOY_OPTIONS+=" --ntp-server pool.ntp.org"
+ fi
+
+ ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
source stackrc
-echo "Configuring undercloud and discovering nodes"
+set -o errexit
+echo "Uploading overcloud glance images"
openstack overcloud image upload
+echo "Configuring undercloud and discovering nodes"
openstack baremetal import --json instackenv.json
openstack baremetal configure boot
openstack baremetal introspection bulk start
-openstack flavor create --id auto --ram 4096 --disk 40 --vcpus 1 baremetal
+echo "Configuring flavors"
+openstack flavor list | grep baremetal || openstack flavor create --id auto --ram 4096 --disk 39 --vcpus 1 baremetal
openstack flavor set --property "cpu_arch"="x86_64" --property "capabilities:boot_option"="local" baremetal
-neutron subnet-update $(neutron subnet-list | grep -v id | grep -v \\-\\- | awk {'print $2'}) --dns-nameserver 8.8.8.8
-openstack overcloud deploy --plan overcloud
+echo "Configuring nameserver on ctlplane network"
+neutron subnet-update \$(neutron subnet-list | grep -v id | grep -v \\\\-\\\\- | awk {'print \$2'}) --dns-nameserver 8.8.8.8
+echo "Executing overcloud deployment, this should run for an extended period without output."
+sleep 60 #wait for Hypervisor stats to check-in to nova
+openstack overcloud deploy --templates $DEPLOY_OPTIONS -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml -e network-environment.yaml -e opendaylight.yaml
EOI
}
display_usage() {
echo -e "\n\n${blue}This script is used to deploy the Apex Installer and Provision OPNFV Target System${reset}\n\n"
- echo -e "\n${green}Make sure you have the latest kernel installed before running this script! (yum update kernel +reboot)${reset}\n"
echo -e "\nUsage:\n$0 [arguments] \n"
- echo -e "\n -no_parse : No variable parsing into config. Flag. \n"
- echo -e "\n -base_config : Full path of settings file to parse. Optional. Will provide a new base settings file rather than the default. Example: -base_config /opt/myinventory.yml \n"
- echo -e "\n -virtual : Node virtualization instead of baremetal. Flag. \n"
- echo -e "\n -enable_virtual_dhcp : Run dhcp server instead of using static IPs. Use this with -virtual only. \n"
- echo -e "\n -static_ip_range : static IP range to define when using virtual and when dhcp is not being used (default), must at least a 20 IP block. Format: '192.168.1.1,192.168.1.20' \n"
- echo -e "\n -ping_site : site to use to verify IP connectivity from the VM when -virtual is used. Format: -ping_site www.blah.com \n"
- echo -e "\n -floating_ip_count : number of IP address from the public range to be used for floating IP. Default is 20.\n"
+ echo -e "\n -c|--config : Directory to configuration files. Optional. Defaults to /var/opt/opnfv/ \n"
+ echo -e "\n -i|--instackenv : Full path to instack environment file. Optional. Defaults to \$CONFIG/instackenv.json \n"
+ echo -e "\n -n|--netenv : Full path to network environment file. Optional. Defaults to \$CONFIG/network-environment.json \n"
+ echo -e "\n -p|--ping-site : site to use to verify IP connectivity. Optional. Defaults to 8.8.8.8 \n"
+ echo -e "\n -r|--resources : Directory to deployment resources. Optional. Defaults to /var/opt/opnfv/stack \n"
+ echo -e "\n -v|--virtual : Virtualize overcloud nodes instead of using baremetal. \n"
+ echo -e "\n --no-ha : disable High Availablility deployment scheme, this assumes a single controller and single compute node \n"
}
##translates the command line paramaters into variables
##params: $@ the entire command line is passed
##usage: parse_cmd_line() "$@"
parse_cmdline() {
- if [[ ( $1 == "--help") || $1 == "-h" ]]; then
- display_usage
- exit 0
- fi
-
echo -e "\n\n${blue}This script is used to deploy the Apex Installer and Provision OPNFV Target System${reset}\n\n"
echo "Use -h to display help"
sleep 2
- while [ "`echo $1 | cut -c1`" = "-" ]
+ while [ "${1:0:1}" = "-" ]
do
- echo $1
case "$1" in
- -base_config)
- base_config=$2
- shift 2
- ;;
- -no_parse)
- no_parse="TRUE"
- shift 1
+ -h|--help)
+ display_usage
+ exit 0
;;
- -virtual)
- virtual="TRUE"
- shift 1
+ -c|--config)
+ CONFIG=$2
+ echo "Deployment Configuration Directory Overridden to: $2"
+ shift 2
;;
- -enable_virtual_dhcp)
- enable_virtual_dhcp="TRUE"
- shift 1
+ -i|--instackenv)
+ INSTACKENV=$2
+ shift 2
;;
- -static_ip_range)
- static_ip_range=$2
+ -n|--netenv)
+ NETENV=$2
shift 2
;;
- -ping_site)
+ -p|--ping-site)
ping_site=$2
+ echo "Using $2 as the ping site"
shift 2
;;
- -floating_ip_count)
- floating_ip_count=$2
+ -r|--resources)
+ RESOURCES=$2
+ echo "Deployment Resources Directory Overridden to: $2"
shift 2
;;
+ -v|--virtual)
+ virtual="TRUE"
+ echo "Executing a Virtualized Deployment"
+ shift 1
+ ;;
+ --no-ha )
+ ha_enabled="FALSE"
+ echo "HA Deployment Disabled"
+ shift 1
+ ;;
*)
display_usage
exit 1
;;
esac
done
-
- if [ ! -z "$enable_virtual_dhcp" ] && [ ! -z "$static_ip_range" ]; then
- echo -e "\n\n${red}ERROR: Incorrect Usage. Static IP range cannot be set when using DHCP!. Exiting${reset}\n\n"
- exit 1
- fi
-
- if [ -z "$virtual" ]; then
- if [ ! -z "$enable_virtual_dhcp" ]; then
- echo -e "\n\n${red}ERROR: Incorrect Usage. enable_virtual_dhcp can only be set when using -virtual!. Exiting${reset}\n\n"
- exit 1
- elif [ ! -z "$static_ip_range" ]; then
- echo -e "\n\n${red}ERROR: Incorrect Usage. static_ip_range can only be set when using -virtual!. Exiting${reset}\n\n"
- exit 1
- fi
- fi
-
- if [ -z "$floating_ip_count" ]; then
- floating_ip_count=20
- fi
}
##END FUNCTIONS
main() {
parse_cmdline "$@"
+ configure_deps
setup_instack_vm
+ if [ $virtual == "TRUE" ]; then
+ setup_virtual_baremetal
+ fi
copy_materials
undercloud_prep_overcloud_deploy
}